diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-12-30 08:49:48 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-12-30 08:49:48 +0000 |
commit | 270ece8441b26dbfbd0ca3fdcb70efec263791a8 (patch) | |
tree | ec8bb34811fa2b478296dff279d116967a0d605b /lib/rubygems | |
parent | 9004431714f2aec1fe3cbcf096f9424e87ca5429 (diff) | |
download | ruby-270ece8441b26dbfbd0ca3fdcb70efec263791a8.tar.gz |
* 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
Diffstat (limited to 'lib/rubygems')
-rw-r--r-- | lib/rubygems/command_manager.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/rubygems/command_manager.rb b/lib/rubygems/command_manager.rb index 0a190161ca..cd1fd6b568 100644 --- a/lib/rubygems/command_manager.rb +++ b/lib/rubygems/command_manager.rb @@ -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 |