[rubygems/rubygems] Simplify command loading
https://github.com/rubygems/rubygems/commit/95f60f0e60
This commit is contained in:
parent
3d1eb62bf3
commit
02d50d9cb1
@ -230,18 +230,11 @@ class Gem::CommandManager
|
|||||||
def load_and_instantiate(command_name)
|
def load_and_instantiate(command_name)
|
||||||
command_name = command_name.to_s
|
command_name = command_name.to_s
|
||||||
const_name = command_name.capitalize.gsub(/_(.)/) { $1.upcase } << "Command"
|
const_name = command_name.capitalize.gsub(/_(.)/) { $1.upcase } << "Command"
|
||||||
load_error = nil
|
|
||||||
|
|
||||||
begin
|
|
||||||
begin
|
begin
|
||||||
require "rubygems/commands/#{command_name}_command"
|
require "rubygems/commands/#{command_name}_command"
|
||||||
rescue LoadError => e
|
|
||||||
load_error = e
|
|
||||||
end
|
|
||||||
Gem::Commands.const_get(const_name).new
|
Gem::Commands.const_get(const_name).new
|
||||||
rescue StandardError => e
|
rescue StandardError, LoadError => e
|
||||||
e = load_error if load_error
|
|
||||||
|
|
||||||
alert_error clean_text("Loading command: #{command_name} (#{e.class})\n\t#{e}")
|
alert_error clean_text("Loading command: #{command_name} (#{e.class})\n\t#{e}")
|
||||||
ui.backtrace e
|
ui.backtrace e
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user