Skip to content

Commit

Permalink
* lib/rubygems/command.rb (Gem::Command#get_all_gem_names_and_versions):
Browse files Browse the repository at this point in the history
  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
  • Loading branch information
unak committed Nov 30, 2012
1 parent 4bb1bfa commit 952beb5
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
11 changes: 11 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
Sat Dec 1 01:21:07 2012 NAKAMURA Usaku <[email protected]>

* 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 <[email protected]>

* ext/fiddle/extconf.rb, ext/fiddle/function.c
Expand Down
9 changes: 8 additions & 1 deletion lib/rubygems/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#++

require 'optparse'
require 'rubygems/requirement'
require 'rubygems/user_interaction'

##
Expand Down Expand Up @@ -186,7 +187,13 @@ def get_all_gem_names
# 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

##
Expand Down
3 changes: 2 additions & 1 deletion lib/rubygems/requirement.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)]

Expand Down
2 changes: 1 addition & 1 deletion test/rubygems/test_gem_commands_install_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ def test_execute_installs_dependencies
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'

Expand Down

0 comments on commit 952beb5

Please sign in to comment.