From ecebf2f2365a5d8e7c6629a39580d47d586a0e40 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 30 Dec 2009 08:49:48 +0000 Subject: * lib/rubygems/command_manager.rb (Gem#load_and_instantiate): rescue only NameError from const_get. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@26200 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rubygems/command_manager.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/rubygems/command_manager.rb b/lib/rubygems/command_manager.rb index 0a190161c..cd1fd6b56 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 -- cgit