aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/rubygems.rb2
-rw-r--r--lib/rubygems/install_update_options.rb2
-rw-r--r--lib/rubygems/requirement.rb17
-rw-r--r--test/rubygems/test_gem.rb10
-rw-r--r--test/rubygems/test_gem_requirement.rb6
5 files changed, 33 insertions, 4 deletions
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index 118268dce2..e114c5abd4 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -9,7 +9,7 @@
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
diff --git a/lib/rubygems/install_update_options.rb b/lib/rubygems/install_update_options.rb
index f05491a31c..38a0682958 100644
--- a/lib/rubygems/install_update_options.rb
+++ b/lib/rubygems/install_update_options.rb
@@ -30,7 +30,7 @@ module Gem::InstallUpdateOptions
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|
diff --git a/lib/rubygems/requirement.rb b/lib/rubygems/requirement.rb
index 1a73274c01..48f4b00d63 100644
--- a/lib/rubygems/requirement.rb
+++ b/lib/rubygems/requirement.rb
@@ -267,7 +267,22 @@ class Gem::Requirement
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
diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb
index b65787470c..e740a5ab94 100644
--- a/test/rubygems/test_gem.rb
+++ b/test/rubygems/test_gem.rb
@@ -150,6 +150,11 @@ class TestGem < Gem::TestCase
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
: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
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,
diff --git a/test/rubygems/test_gem_requirement.rb b/test/rubygems/test_gem_requirement.rb
index 1564ffb0ed..7a59243b6a 100644
--- a/test/rubygems/test_gem_requirement.rb
+++ b/test/rubygems/test_gem_requirement.rb
@@ -20,6 +20,12 @@ class TestGemRequirement < Gem::TestCase
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