diff --git a/ext/digest/lib/digest/version.rb b/ext/digest/lib/digest/version.rb index 691323f1099fe0..a56e80c54ee84c 100644 --- a/ext/digest/lib/digest/version.rb +++ b/ext/digest/lib/digest/version.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true module Digest + # The version string VERSION = "3.2.1" end diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index d019891afeacae..7e319cae0de3cf 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -1456,6 +1456,7 @@ rb_zstream_finish(VALUE obj) * call-seq: * flush_next_in -> input * + * Flushes input buffer and returns all data in that buffer. */ static VALUE rb_zstream_flush_next_in(VALUE obj) diff --git a/gem_prelude.rb b/gem_prelude.rb index bcd2560fab52ca..1b78d80c726625 100644 --- a/gem_prelude.rb +++ b/gem_prelude.rb @@ -25,4 +25,3 @@ rescue LoadError warn "`syntax_suggest' was not loaded." end if defined?(SyntaxSuggest) - diff --git a/lib/bundled_gems.rb b/lib/bundled_gems.rb index 852d7c48e3a217..914c8465032fdc 100644 --- a/lib/bundled_gems.rb +++ b/lib/bundled_gems.rb @@ -1,5 +1,10 @@ # -*- frozen-string-literal: true -*- +# :stopdoc: +module Gem +end +# :startdoc: + module Gem::BUNDLED_GEMS # :nodoc: SINCE = { "racc" => "3.3.0", diff --git a/lib/bundler/ruby_version.rb b/lib/bundler/ruby_version.rb index 0ed5cbc6cacfa2..7f60dde4768ddd 100644 --- a/lib/bundler/ruby_version.rb +++ b/lib/bundler/ruby_version.rb @@ -43,7 +43,6 @@ def initialize(versions, patchlevel, engine, engine_version) def to_s(versions = self.versions) output = String.new("ruby #{versions_string(versions)}") - output << "p#{patchlevel}" if patchlevel && patchlevel != "-1" output << " (#{engine} #{versions_string(engine_versions)})" unless engine == "ruby" output @@ -72,8 +71,7 @@ def single_version_string def ==(other) versions == other.versions && engine == other.engine && - engine_versions == other.engine_versions && - patchlevel == other.patchlevel + engine_versions == other.engine_versions end def host diff --git a/lib/delegate.rb b/lib/delegate.rb index 824d02f28b0946..838de675f1f5e3 100644 --- a/lib/delegate.rb +++ b/lib/delegate.rb @@ -39,6 +39,7 @@ # Be advised, RDoc will not detect delegated methods. # class Delegator < BasicObject + # The version string VERSION = "0.4.0" kernel = ::Kernel.dup @@ -77,7 +78,7 @@ def initialize(obj) end # - # Handles the magic of delegation through \_\_getobj\_\_. + # Handles the magic of delegation through +__getobj__+. # ruby2_keywords def method_missing(m, *args, &block) r = true @@ -94,7 +95,7 @@ def initialize(obj) # # Checks for a method provided by this the delegate object by forwarding the - # call through \_\_getobj\_\_. + # call through +__getobj__+. # def respond_to_missing?(m, include_private) r = true @@ -107,7 +108,7 @@ def respond_to_missing?(m, include_private) r end - KERNEL_RESPOND_TO = ::Kernel.instance_method(:respond_to?) + KERNEL_RESPOND_TO = ::Kernel.instance_method(:respond_to?) # :nodoc: private_constant :KERNEL_RESPOND_TO # Handle BasicObject instances @@ -126,7 +127,7 @@ def respond_to_missing?(m, include_private) # # Returns the methods available to this delegate object as the union - # of this object's and \_\_getobj\_\_ methods. + # of this object's and +__getobj__+ methods. # def methods(all=true) __getobj__.methods(all) | super @@ -134,7 +135,7 @@ def methods(all=true) # # Returns the methods available to this delegate object as the union - # of this object's and \_\_getobj\_\_ public methods. + # of this object's and +__getobj__+ public methods. # def public_methods(all=true) __getobj__.public_methods(all) | super @@ -142,7 +143,7 @@ def public_methods(all=true) # # Returns the methods available to this delegate object as the union - # of this object's and \_\_getobj\_\_ protected methods. + # of this object's and +__getobj__+ protected methods. # def protected_methods(all=true) __getobj__.protected_methods(all) | super @@ -175,7 +176,7 @@ def eql?(obj) end # - # Delegates ! to the \_\_getobj\_\_ + # Delegates ! to the +__getobj__+ # def ! !__getobj__ @@ -198,7 +199,7 @@ def __setobj__(obj) end # - # Serialization support for the object returned by \_\_getobj\_\_. + # Serialization support for the object returned by +__getobj__+. # def marshal_dump ivars = instance_variables.reject {|var| /\A@delegate_/ =~ var} @@ -232,7 +233,7 @@ def initialize_dup(obj) # :nodoc: ## # :method: freeze - # Freeze both the object returned by \_\_getobj\_\_ and self. + # Freeze both the object returned by +__getobj__+ and self. # def freeze __getobj__.freeze diff --git a/lib/erb/compiler.rb b/lib/erb/compiler.rb index 08b5eb4ee1d220..8a4d85c6ea5d54 100644 --- a/lib/erb/compiler.rb +++ b/lib/erb/compiler.rb @@ -480,7 +480,6 @@ def initialize from end }.new(caller(0)).c private_constant :WARNING_UPLEVEL - # :startdoc: def warn_invalid_trim_mode(mode, uplevel:) warn "Invalid ERB trim mode: #{mode.inspect} (trim_mode: nil, 0, 1, 2, or String composed of '%' and/or '-', '>', '<>')", uplevel: uplevel + WARNING_UPLEVEL diff --git a/lib/erb/util.rb b/lib/erb/util.rb index efa8ca1d137cbd..9c3d186edefb62 100644 --- a/lib/erb/util.rb +++ b/lib/erb/util.rb @@ -19,6 +19,7 @@ # A subset of ERB::Util. Unlike ERB::Util#html_escape, we expect/hope # Rails will not monkey-patch ERB::Escape#html_escape. module ERB::Escape + # :stopdoc: def html_escape(s) CGI.escapeHTML(s.to_s) end diff --git a/lib/find.rb b/lib/find.rb index 98a79cc76dad7c..8223eea4560319 100644 --- a/lib/find.rb +++ b/lib/find.rb @@ -27,6 +27,7 @@ # module Find + # The version string VERSION = "0.2.0" # diff --git a/lib/forwardable.rb b/lib/forwardable.rb index 71b4e6adad4d9a..5652e728642906 100644 --- a/lib/forwardable.rb +++ b/lib/forwardable.rb @@ -114,6 +114,8 @@ module Forwardable # Version of +forwardable.rb+ VERSION = "1.3.3" VERSION.freeze + + # Version for backward compatibility FORWARDABLE_VERSION = VERSION FORWARDABLE_VERSION.freeze diff --git a/lib/open-uri.rb b/lib/open-uri.rb index de710af261eaa9..5983c7368b1d35 100644 --- a/lib/open-uri.rb +++ b/lib/open-uri.rb @@ -91,8 +91,10 @@ def self.open(name, *rest, &block) module OpenURI + # The version string VERSION = "0.5.0" + # The default options Options = { :proxy => true, :proxy_http_basic_authentication => true, @@ -394,24 +396,28 @@ def OpenURI.open_http(buf, target, proxy, options) # :nodoc: end end + # Raised on HTTP session failure class HTTPError < StandardError - def initialize(message, io) + def initialize(message, io) # :nodoc: super(message) @io = io end + # StringIO having the received data attr_reader :io end # Raised on redirection, # only occurs when +redirect+ option for HTTP is +false+. class HTTPRedirect < HTTPError - def initialize(message, io, uri) + def initialize(message, io, uri) # :nodoc: super(message, io) @uri = uri end + # URI to redirect attr_reader :uri end + # Raised on too many redirection, class TooManyRedirects < HTTPError end diff --git a/lib/open3/version.rb b/lib/open3/version.rb index bfcec44ccc920b..322dd71e2a3a46 100644 --- a/lib/open3/version.rb +++ b/lib/open3/version.rb @@ -1,3 +1,4 @@ module Open3 + # The version string VERSION = "0.2.1" end diff --git a/lib/pp.rb b/lib/pp.rb index 700a39cdc906a2..fcd33ba80e9e2e 100644 --- a/lib/pp.rb +++ b/lib/pp.rb @@ -174,7 +174,7 @@ def pop_inspect_key(id) Thread.current[:__recursive_key__][:inspect].delete id end - private def guard_inspect(object) + private def guard_inspect(object) # :nodoc: recursive_state = Thread.current[:__recursive_key__] if recursive_state&.key?(:inspect) @@ -277,7 +277,7 @@ def seplist(list, sep=nil, iter_method=:each) # :yield: element kwsplat ? yield(*v, **kwsplat) : yield(*v) } end - EMPTY_KWHASH = if RUBY_VERSION >= "3.0" + EMPTY_KWHASH = if RUBY_VERSION >= "3.0" # :nodoc: {}.freeze end private_constant :EMPTY_KWHASH diff --git a/lib/prettyprint.rb b/lib/prettyprint.rb index 6f50192f5daf29..a65407c1304df9 100644 --- a/lib/prettyprint.rb +++ b/lib/prettyprint.rb @@ -33,6 +33,7 @@ # class PrettyPrint + # The version string VERSION = "0.2.0" # This is a convenience method which is same as follows: diff --git a/lib/rubygems/package.rb b/lib/rubygems/package.rb index b56d68cc45bb15..6b21ff1b953303 100644 --- a/lib/rubygems/package.rb +++ b/lib/rubygems/package.rb @@ -642,6 +642,8 @@ def verify raise Gem::Package::FormatError.new e.message, @gem end + private + ## # Verifies the +checksums+ against the +digests+. This check is not # cryptographically secure. Missing checksums are ignored. diff --git a/lib/singleton.rb b/lib/singleton.rb index b8e43a7794891d..74aec8903cdc98 100644 --- a/lib/singleton.rb +++ b/lib/singleton.rb @@ -92,9 +92,10 @@ # p a.strip # => nil # module Singleton + # The version string VERSION = "0.3.0" - module SingletonInstanceMethods + module SingletonInstanceMethods # :nodoc: # Raises a TypeError to prevent cloning. def clone raise TypeError, "can't clone instance of singleton #{self.class}" @@ -143,11 +144,11 @@ def set_mutex(val) end end - def self.module_with_class_methods + def self.module_with_class_methods # :nodoc: SingletonClassMethods end - module SingletonClassProperties + module SingletonClassProperties # :nodoc: def self.included(c) # extending an object with Singleton is a bad idea @@ -196,10 +197,10 @@ def included(klass) end if defined?(Ractor) - module RactorLocalSingleton + module RactorLocalSingleton # :nodoc: include Singleton::SingletonInstanceMethods - module RactorLocalSingletonClassMethods + module RactorLocalSingletonClassMethods # :nodoc: include Singleton::SingletonClassMethods def instance set_mutex(Thread::Mutex.new) if Ractor.current[mutex_key].nil? diff --git a/lib/tempfile.rb b/lib/tempfile.rb index 7292e72c252599..27ebb96439c7f3 100644 --- a/lib/tempfile.rb +++ b/lib/tempfile.rb @@ -564,6 +564,8 @@ def Tempfile.create(basename="", tmpdir=nil, mode: 0, anonymous: false, **option end class << Tempfile +# :stopdoc: + private def create_with_filename(basename="", tmpdir=nil, mode: 0, **options) tmpfile = nil Dir::Tmpname.create(basename, tmpdir, **options) do |tmpname, n, opts| diff --git a/lib/weakref.rb b/lib/weakref.rb index 0a09f7f9936d0f..c7274f96641d81 100644 --- a/lib/weakref.rb +++ b/lib/weakref.rb @@ -17,6 +17,7 @@ # class WeakRef < Delegator + # The version string VERSION = "0.1.4" ## diff --git a/lib/yaml.rb b/lib/yaml.rb index 2cf11fc3dfb04e..c6f0f89fd2a1e0 100644 --- a/lib/yaml.rb +++ b/lib/yaml.rb @@ -66,5 +66,6 @@ # # Syck can also be found on github: https://github.com/ruby/syck module YAML + # The version of YAML wrapper LOADER_VERSION = "0.4.0" end diff --git a/spec/bundler/bundler/ruby_version_spec.rb b/spec/bundler/bundler/ruby_version_spec.rb index 39d0571361ef93..b96893cefe8cc5 100644 --- a/spec/bundler/bundler/ruby_version_spec.rb +++ b/spec/bundler/bundler/ruby_version_spec.rb @@ -100,7 +100,7 @@ describe "#to_s" do it "should return info string with the ruby version, patchlevel, engine, and engine version" do - expect(subject.to_s).to eq("ruby 2.0.0p645 (jruby 2.0.1)") + expect(subject.to_s).to eq("ruby 2.0.0 (jruby 2.0.1)") end context "no patchlevel" do @@ -115,7 +115,7 @@ let(:engine) { "ruby" } it "should return info string with the ruby version and patchlevel" do - expect(subject.to_s).to eq("ruby 2.0.0p645") + expect(subject.to_s).to eq("ruby 2.0.0") end end @@ -149,12 +149,6 @@ it_behaves_like "two ruby versions are not equal" end - context "the patchlevels do not match" do - let(:other_patchlevel) { "21" } - - it_behaves_like "two ruby versions are not equal" - end - context "the engines do not match" do let(:other_engine) { "ruby" } diff --git a/spec/bundler/install/gemfile/ruby_spec.rb b/spec/bundler/install/gemfile/ruby_spec.rb index 3e15d82bbe25cc..313babc81d7595 100644 --- a/spec/bundler/install/gemfile/ruby_spec.rb +++ b/spec/bundler/install/gemfile/ruby_spec.rb @@ -83,7 +83,7 @@ def locked_ruby_version myrack RUBY VERSION - ruby 2.1.4p422 + ruby 2.1.4 BUNDLED WITH #{Bundler::VERSION} diff --git a/test/rubygems/test_gem_package.rb b/test/rubygems/test_gem_package.rb index 8a9cc8558022b7..34fa65b1e03028 100644 --- a/test/rubygems/test_gem_package.rb +++ b/test/rubygems/test_gem_package.rb @@ -1247,71 +1247,25 @@ def test_verify_truncate # end #verify tests - def test_verify_entry - entry = Object.new - def entry.full_name - raise ArgumentError, "whatever" - end - - package = Gem::Package.new @gem - - _, err = use_ui @ui do - e = nil - - out_err = capture_output do - e = assert_raise ArgumentError do - package.verify_entry entry + def test_missing_metadata + invalid_metadata = ["metadataxgz", "foobar\nmetadata", "metadata\nfoobar"] + invalid_metadata.each do |fname| + tar = StringIO.new + + Gem::Package::TarWriter.new(tar) do |gem_tar| + gem_tar.add_file fname, 0o444 do |io| + gz_io = Zlib::GzipWriter.new io, Zlib::BEST_COMPRESSION + gz_io.write "bad metadata" + gz_io.close end end - assert_equal "whatever", e.message - assert_equal "full_name", e.backtrace_locations.first.label - - out_err - end - - assert_equal "Exception while verifying #{@gem}\n", err - - valid_metadata = ["metadata", "metadata.gz"] - valid_metadata.each do |vm| - $spec_loaded = false - $good_name = vm - - entry = Object.new - def entry.full_name - $good_name - end + tar.rewind - package = Gem::Package.new(@gem) - package.instance_variable_set(:@files, []) - def package.load_spec(entry) - $spec_loaded = true - end - - package.verify_entry(entry) - - assert $spec_loaded - end - - invalid_metadata = ["metadataxgz", "foobar\nmetadata", "metadata\nfoobar"] - invalid_metadata.each do |vm| - $spec_loaded = false - $bad_name = vm - - entry = Object.new - def entry.full_name - $bad_name - end - - package = Gem::Package.new(@gem) - package.instance_variable_set(:@files, []) - def package.load_spec(entry) - $spec_loaded = true + package = Gem::Package.new(Gem::Package::IOSource.new(tar)) + assert_raise Gem::Package::FormatError do + package.verify end - - package.verify_entry(entry) - - refute $spec_loaded end end diff --git a/test/test_timeout.rb b/test/test_timeout.rb index 01156867b05609..71d8e1f5c273c5 100644 --- a/test/test_timeout.rb +++ b/test/test_timeout.rb @@ -250,7 +250,7 @@ def test_fork end def test_threadgroup - assert_separately(%w[-rtimeout], <<-'end;') + assert_separately(%w[-W0 -rtimeout], <<-'end;') tg = ThreadGroup.new thr = Thread.new do tg.add(Thread.current) @@ -263,7 +263,7 @@ def test_threadgroup # https://github.com/ruby/timeout/issues/24 def test_handling_enclosed_threadgroup - assert_separately(%w[-rtimeout], <<-'end;') + assert_separately(%w[-W0 -rtimeout], <<-'end;') Thread.new { t = Thread.current group = ThreadGroup.new diff --git a/tool/auto_review_pr.rb b/tool/auto_review_pr.rb index c63640354d3593..07c98c7e0aed9e 100755 --- a/tool/auto_review_pr.rb +++ b/tool/auto_review_pr.rb @@ -46,7 +46,7 @@ def review(pr_number) changed_files = @client.get("/repos/#{REPO}/pulls/#{pr_number}/files").map { it.fetch(:filename) } # Build a Hash: { upstream_repo => files, ... } - upstream_repos = changed_files.group_by { |file| find_upstream_repo(file) } + upstream_repos = SyncDefaultGems::Repository.group(changed_files) upstream_repos.delete(nil) # exclude no-upstream files upstream_repos.delete('prism') if changed_files.include?('prism_compile.c') # allow prism changes in this case if upstream_repos.empty? @@ -70,17 +70,6 @@ def review(pr_number) private - def find_upstream_repo(file) - SyncDefaultGems::REPOSITORIES.each do |repo_name, repository| - repository.mappings.each do |_src, dst| - if file.start_with?(dst) - return repo_name - end - end - end - nil - end - # upstream_repos: { upstream_repo => files, ... } def format_comment(upstream_repos) comment = +'' diff --git a/tool/mkconfig.rb b/tool/mkconfig.rb index ffa4c1c0b263e0..db741157303256 100755 --- a/tool/mkconfig.rb +++ b/tool/mkconfig.rb @@ -394,6 +394,7 @@ def RbConfig.ruby ) end end +# Non-nil if configured for cross compiling. CROSS_COMPILING = nil unless defined? CROSS_COMPILING EOS diff --git a/tool/rdoc-srcdir b/tool/rdoc-srcdir index f830fdc3027ffd..275f12fe421cd3 100755 --- a/tool/rdoc-srcdir +++ b/tool/rdoc-srcdir @@ -17,7 +17,7 @@ options.title = options.title.sub(/Ruby \K.*version/) { .sort # "MAJOR" < "MINOR", fortunately .to_h.values.join(".") } -options.parse ARGV +options.parse ARGV + ["#{invoked}/rbconfig.rb"] options.singleton_class.define_method(:finish) do super() diff --git a/tool/sync_default_gems.rb b/tool/sync_default_gems.rb index 997cd5eddc8f16..ff0518b1a599d4 100755 --- a/tool/sync_default_gems.rb +++ b/tool/sync_default_gems.rb @@ -293,6 +293,20 @@ def lib((upstream, branch), gemspec_in_subdir: false) ]), }.transform_keys(&:to_s) + class << Repository + def find_upstream(file) + REPOSITORIES.find do |repo_name, repository| + if repository.mappings.any? {|_src, dst| file.start_with?(dst) } + break repo_name + end + end + end + + def group(files) + files.group_by {|file| find_upstream(file)} + end + end + # Allow synchronizing commits up to this FETCH_DEPTH. We've historically merged PRs # with about 250 commits to ruby/ruby, so we use this depth for ruby/ruby in general. FETCH_DEPTH = 500