[rubygems/rubygems] Fix plugin command loading
The `LoadError` needs to be ignored because command may have been defined and registered from a rubygems_plugin.rb file. https://github.com/rubygems/rubygems/commit/31f13d449b
This commit is contained in:
parent
fc08f72621
commit
83456d1e9a
@ -231,10 +231,15 @@ class Gem::CommandManager
|
|||||||
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"
|
||||||
|
|
||||||
|
begin
|
||||||
begin
|
begin
|
||||||
require "rubygems/commands/#{command_name}_command"
|
require "rubygems/commands/#{command_name}_command"
|
||||||
|
rescue LoadError
|
||||||
|
# it may have been defined from a rubygems_plugin.rb file
|
||||||
|
end
|
||||||
|
|
||||||
Gem::Commands.const_get(const_name).new
|
Gem::Commands.const_get(const_name).new
|
||||||
rescue StandardError, LoadError => e
|
rescue StandardError => e
|
||||||
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