mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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:
parent
9004431714
commit
270ece8441
2 changed files with 8 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue