ruby-changes:54463
From: hsbt <ko1@a...>
Date: Tue, 1 Jan 2019 13:53:57 +0900 (JST)
Subject: [ruby-changes:54463] hsbt:r66678 (trunk): Merge rubygems-3.0.2.
hsbt 2019-01-01 13:53:52 +0900 (Tue, 01 Jan 2019) New Revision: 66678 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=66678 Log: Merge rubygems-3.0.2. https://blog.rubygems.org/2019/01/01/3.0.2-released.html Modified files: trunk/lib/rubygems/install_update_options.rb trunk/lib/rubygems/requirement.rb trunk/lib/rubygems.rb trunk/test/rubygems/test_gem.rb trunk/test/rubygems/test_gem_requirement.rb Index: test/rubygems/test_gem.rb =================================================================== --- test/rubygems/test_gem.rb (revision 66677) +++ test/rubygems/test_gem.rb (revision 66678) @@ -150,6 +150,11 @@ class TestGem < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L150 File.umask(umask) end + def test_self_install_permissions_with_format_executable + @format_executable = true + assert_self_install_permissions + end + def assert_self_install_permissions mask = /mingw|mswin/ =~ RUBY_PLATFORM ? 0700 : 0777 options = { @@ -157,6 +162,7 @@ class TestGem < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L162 :prog_mode => 0510, :data_mode => 0640, :wrappers => true, + :format_executable => !!(@format_executable if defined?(@format_executable)) } Dir.chdir @tempdir do Dir.mkdir 'bin' @@ -182,8 +188,10 @@ class TestGem < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L188 prog_mode = (options[:prog_mode] & mask).to_s(8) dir_mode = (options[:dir_mode] & mask).to_s(8) data_mode = (options[:data_mode] & mask).to_s(8) + prog_name = 'foo.cmd' + prog_name = RUBY_INSTALL_NAME.sub('ruby', 'foo.cmd') if options[:format_executable] expected = { - "bin/#{RUBY_INSTALL_NAME.sub('ruby', 'foo.cmd')}" => prog_mode, + "bin/#{prog_name}" => prog_mode, 'gems/foo-1' => dir_mode, 'gems/foo-1/bin' => dir_mode, 'gems/foo-1/data' => dir_mode, Index: test/rubygems/test_gem_requirement.rb =================================================================== --- test/rubygems/test_gem_requirement.rb (revision 66677) +++ test/rubygems/test_gem_requirement.rb (revision 66678) @@ -20,6 +20,12 @@ class TestGemRequirement < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_requirement.rb#L20 refute_requirement_equal "= 1.2", "= 1.3" refute_requirement_equal "= 1.3", "= 1.2" + refute_requirement_equal "~> 1.3", "~> 1.3.0" + refute_requirement_equal "~> 1.3.0", "~> 1.3" + + assert_requirement_equal ["> 2", "~> 1.3"], ["> 2.0", "~> 1.3"] + assert_requirement_equal ["> 2.0", "~> 1.3"], ["> 2", "~> 1.3"] + refute_equal Object.new, req("= 1.2") refute_equal req("= 1.2"), Object.new end Index: lib/rubygems/install_update_options.rb =================================================================== --- lib/rubygems/install_update_options.rb (revision 66677) +++ lib/rubygems/install_update_options.rb (revision 66678) @@ -30,7 +30,7 @@ module Gem::InstallUpdateOptions https://github.com/ruby/ruby/blob/trunk/lib/rubygems/install_update_options.rb#L30 options[:bin_dir] = File.expand_path(value) end - add_option(:"Install/Update", '--[no-]document [TYPES]', Array, + add_option(:"Install/Update", '--document [TYPES]', Array, 'Generate documentation for installed gems', 'List the documentation types you wish to', 'generate. For example: rdoc,ri') do |value, options| Index: lib/rubygems/requirement.rb =================================================================== --- lib/rubygems/requirement.rb (revision 66677) +++ lib/rubygems/requirement.rb (revision 66678) @@ -267,7 +267,22 @@ class Gem::Requirement https://github.com/ruby/ruby/blob/trunk/lib/rubygems/requirement.rb#L267 def ==(other) # :nodoc: return unless Gem::Requirement === other - requirements == other.requirements + + # An == check is always necessary + return false unless requirements == other.requirements + + # An == check is sufficient unless any requirements use ~> + return true unless _tilde_requirements.any? + + # If any requirements use ~> we use the stricter `#eql?` that also checks + # that version precision is the same + _tilde_requirements.eql?(other._tilde_requirements) + end + + protected + + def _tilde_requirements + requirements.select { |r| r.first == "~>" } end private Index: lib/rubygems.rb =================================================================== --- lib/rubygems.rb (revision 66677) +++ lib/rubygems.rb (revision 66678) @@ -9,7 +9,7 @@ https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L9 require 'rbconfig' module Gem - VERSION = "3.0.1".freeze + VERSION = "3.0.2".freeze end # Must be first since it unloads the prelude from 1.9.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/