summaryrefslogtreecommitdiff
path: root/lib/rubygems/command_manager.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/command_manager.rb')
-rw-r--r--lib/rubygems/command_manager.rb18
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/rubygems/command_manager.rb b/lib/rubygems/command_manager.rb
index 60d82c865e..3665f31d0f 100644
--- a/lib/rubygems/command_manager.rb
+++ b/lib/rubygems/command_manager.rb
@@ -44,6 +44,13 @@ class Gem::CommandManager
end
##
+ # Reset the authoritative instance of the command manager.
+
+ def self.reset
+ @command_manager = nil
+ end
+
+ ##
# Register all the subcommands supported by the gem command.
def initialize
@@ -87,6 +94,13 @@ class Gem::CommandManager
end
##
+ # Unregister the Symbol +command+ as a gem command.
+
+ def unregister_command(command)
+ @commands.delete command
+ end
+
+ ##
# Return the registered command from the command name.
def [](command_name)
@@ -166,7 +180,7 @@ class Gem::CommandManager
retried = false
begin
- commands.const_get const_name
+ commands.const_get(const_name).new
rescue NameError
raise if retried
@@ -179,7 +193,7 @@ class Gem::CommandManager
Gem.configuration.backtrace
end
retry
- end.new
+ end
end
end