From 4c2304f0004e9f1784540f3d36976aad9eab1f68 Mon Sep 17 00:00:00 2001 From: drbrain Date: Mon, 22 Jul 2013 22:46:50 +0000 Subject: * lib/rubygems: Import RubyGems from master as of commit b165260 * test/rubygems: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rubygems/command_manager.rb | 77 ++++++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 40 deletions(-) (limited to 'lib/rubygems/command_manager.rb') diff --git a/lib/rubygems/command_manager.rb b/lib/rubygems/command_manager.rb index 2af582177d..fdee064fed 100644 --- a/lib/rubygems/command_manager.rb +++ b/lib/rubygems/command_manager.rb @@ -33,6 +33,39 @@ class Gem::CommandManager include Gem::UserInteraction + BUILTIN_COMMANDS = [ # :nodoc: + :build, + :cert, + :check, + :cleanup, + :contents, + :dependency, + :environment, + :fetch, + :generate_index, + :help, + :install, + :list, + :lock, + :mirror, + :outdated, + :owner, + :pristine, + :push, + :query, + :rdoc, + :search, + :server, + :sources, + :specification, + :stale, + :uninstall, + :unpack, + :update, + :which, + :yank, + ] + ## # Return the authoritative instance of the command manager. @@ -61,36 +94,10 @@ class Gem::CommandManager def initialize require 'timeout' @commands = {} - register_command :build - register_command :cert - register_command :check - register_command :cleanup - register_command :contents - register_command :dependency - register_command :environment - register_command :fetch - register_command :generate_index - register_command :help - register_command :install - register_command :list - register_command :lock - register_command :mirror - register_command :outdated - register_command :owner - register_command :pristine - register_command :push - register_command :query - register_command :rdoc - register_command :search - register_command :server - register_command :sources - register_command :specification - register_command :stale - register_command :uninstall - register_command :unpack - register_command :update - register_command :which - register_command :yank + + BUILTIN_COMMANDS.each do |name| + register_command name + end end ## @@ -132,14 +139,6 @@ class Gem::CommandManager alert_error "While executing gem ... (#{ex.class})\n #{ex.to_s}" ui.backtrace ex - if Gem.configuration.really_verbose and \ - ex.kind_of?(Gem::Exception) and ex.source_exception - e = ex.source_exception - - ui.errs.puts "Because of: (#{e.class})\n #{e.to_s}" - ui.backtrace e - end - terminate_interaction(1) rescue Interrupt alert_error "Interrupted" @@ -147,8 +146,6 @@ class Gem::CommandManager end def process_args(args, build_args=nil) - args = args.to_str.split(/\s+/) if args.respond_to?(:to_str) - if args.empty? then say Gem::Command::HELP terminate_interaction 1 -- cgit v1.2.3