aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems/command.rb9
-rw-r--r--lib/rubygems/requirement.rb3
2 files changed, 10 insertions, 2 deletions
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)]