ruby-changes:26017
From: usa <ko1@a...>
Date: Sat, 1 Dec 2012 01:28:04 +0900 (JST)
Subject: [ruby-changes:26017] usa:r38074 (trunk): * lib/rubygems/command.rb (Gem::Command#get_all_gem_names_and_versions):
usa 2012-12-01 01:27:52 +0900 (Sat, 01 Dec 2012) New Revision: 38074 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38074 Log: * 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. Modified files: trunk/ChangeLog trunk/lib/rubygems/command.rb trunk/lib/rubygems/requirement.rb trunk/test/rubygems/test_gem_commands_install_command.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 38073) +++ ChangeLog (revision 38074) @@ -1,3 +1,14 @@ +Sat Dec 1 01:21:07 2012 NAKAMURA Usaku <usa@r...> + + * 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@g...> * ext/fiddle/extconf.rb, ext/fiddle/function.c Index: lib/rubygems/command.rb =================================================================== --- lib/rubygems/command.rb (revision 38073) +++ lib/rubygems/command.rb (revision 38074) @@ -5,6 +5,7 @@ #++ require 'optparse' +require 'rubygems/requirement' require 'rubygems/user_interaction' ## @@ -186,7 +187,13 @@ # 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 ## Index: lib/rubygems/requirement.rb =================================================================== --- lib/rubygems/requirement.rb (revision 38073) +++ lib/rubygems/requirement.rb (revision 38074) @@ -27,7 +27,8 @@ } 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)] Index: test/rubygems/test_gem_commands_install_command.rb =================================================================== --- test/rubygems/test_gem_commands_install_command.rb (revision 38073) +++ test/rubygems/test_gem_commands_install_command.rb (revision 38074) @@ -664,7 +664,7 @@ 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' -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/