* lib/rubygems/command_manager.rb (Gem#load_and_instantiate):

rescue only NameError from const_get.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26200 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-12-30 08:49:48 +00:00
Родитель 9004431714
Коммит 270ece8441
2 изменённых файлов: 8 добавлений и 4 удалений

Просмотреть файл

@ -1,4 +1,7 @@
Wed Dec 30 17:45:53 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
Wed Dec 30 17:49:47 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/rubygems/command_manager.rb (Gem#load_and_instantiate):
rescue only NameError from const_get.
* lib/rubygems/source_index.rb (Gem#load_specification): don't use
RUBY_VERSION to branch.

Просмотреть файл

@ -154,11 +154,12 @@ class Gem::CommandManager
def load_and_instantiate(command_name)
command_name = command_name.to_s
const_name = command_name.capitalize.gsub(/_(.)/) { $1.upcase } << "Command"
commands = Gem::Commands
retried = false
begin
const_name = command_name.capitalize.gsub(/_(.)/) { $1.upcase }
Gem::Commands.const_get("#{const_name}Command").new
commands.const_get(const_name)
rescue NameError
if retried then
raise
@ -167,7 +168,7 @@ class Gem::CommandManager
require "rubygems/commands/#{command_name}_command"
retry
end
end
end.new
end
end