summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-30 16:27:52 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-30 16:27:52 +0000
commit952beb5ff4a866a012fb646bf598ae112acdfb82 (patch)
treedd4f74a0e37169cef6d22671b2070e8e9c5ef551
parent4bb1bfa0ed10a3a1e2ca04ada24d72e0227ebce7 (diff)
* lib/rubygems/command.rb (Gem::Command#get_all_gem_names_and_versions):
who assumes that the pathname of a gem never contains ':' ? yes, on Unixen pathnames can contain ':', and on Windows they almost certainly contain ':'. see [ruby-core:50388]. * lib/rubygems/requirement.rb (Gem::Requirement::PATTERN_RAW): extract the regexp to match the version specifier from PATTERN to use in above method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog11
-rw-r--r--lib/rubygems/command.rb9
-rw-r--r--lib/rubygems/requirement.rb3
-rw-r--r--test/rubygems/test_gem_commands_install_command.rb2
4 files changed, 22 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index eb0245a5dc..b382b207b2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+Sat Dec 1 01:21:07 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * lib/rubygems/command.rb (Gem::Command#get_all_gem_names_and_versions):
+ who assumes that the pathname of a gem never contains ':' ?
+ yes, on Unixen pathnames can contain ':', and on Windows they almost
+ certainly contain ':'. see [ruby-core:50388].
+
+ * lib/rubygems/requirement.rb (Gem::Requirement::PATTERN_RAW): extract
+ the regexp to match the version specifier from PATTERN to use in
+ above method.
+
Sat Dec 1 00:48:19 2012 Naohisa Goto <ngotogenome@gmail.com>
* ext/fiddle/extconf.rb, ext/fiddle/function.c
diff --git a/lib/rubygems/command.rb b/lib/rubygems/command.rb
index 69cbf3c269..cba79b9196 100644
--- a/lib/rubygems/command.rb
+++ b/lib/rubygems/command.rb
@@ -5,6 +5,7 @@
#++
require 'optparse'
+require 'rubygems/requirement'
require 'rubygems/user_interaction'
##
@@ -186,7 +187,13 @@ class Gem::Command
# An argument in the form gem:ver is pull apart into the gen name and version,
# respectively.
def get_all_gem_names_and_versions
- get_all_gem_names.map { |name| name.split(":", 2) }
+ get_all_gem_names.map do |name|
+ if /\A(.*):(#{Gem::Requirement::PATTERN_RAW})\z/ =~ name
+ [$1, $2]
+ else
+ [name]
+ end
+ end
end
##
diff --git a/lib/rubygems/requirement.rb b/lib/rubygems/requirement.rb
index b80e8dca19..ed768924a8 100644
--- a/lib/rubygems/requirement.rb
+++ b/lib/rubygems/requirement.rb
@@ -27,7 +27,8 @@ class Gem::Requirement
}
quoted = OPS.keys.map { |k| Regexp.quote k }.join "|"
- PATTERN = /\A\s*(#{quoted})?\s*(#{Gem::Version::VERSION_PATTERN})\s*\z/
+ PATTERN_RAW = "\\s*(#{quoted})?\\s*(#{Gem::Version::VERSION_PATTERN})\\s*"
+ PATTERN = /\A#{PATTERN_RAW}\z/
DefaultRequirement = [">=", Gem::Version.new(0)]
diff --git a/test/rubygems/test_gem_commands_install_command.rb b/test/rubygems/test_gem_commands_install_command.rb
index 6a3293e356..28b4e474ba 100644
--- a/test/rubygems/test_gem_commands_install_command.rb
+++ b/test/rubygems/test_gem_commands_install_command.rb
@@ -664,7 +664,7 @@ ERROR: Possible alternatives: non_existent_with_hint
assert_equal 0, e.exit_code
end
- def test_execute_satisify_deps_of_local_from_sources
+ def test_execute_satisfy_deps_of_local_from_sources
r, r_gem = util_gem 'r', '1', 'q' => '= 1'
q, q_gem = util_gem 'q', '1'