Skip to content

Commit 83456d1

Browse files
deivid-rodriguezmatzbot
authored andcommitted
[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. rubygems/rubygems@31f13d449b
1 parent fc08f72 commit 83456d1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/rubygems/command_manager.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,14 @@ def load_and_instantiate(command_name)
232232
const_name = command_name.capitalize.gsub(/_(.)/) { $1.upcase } << "Command"
233233

234234
begin
235-
require "rubygems/commands/#{command_name}_command"
235+
begin
236+
require "rubygems/commands/#{command_name}_command"
237+
rescue LoadError
238+
# it may have been defined from a rubygems_plugin.rb file
239+
end
240+
236241
Gem::Commands.const_get(const_name).new
237-
rescue StandardError, LoadError => e
242+
rescue StandardError => e
238243
alert_error clean_text("Loading command: #{command_name} (#{e.class})\n\t#{e}")
239244
ui.backtrace e
240245
end

0 commit comments

Comments
 (0)