aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems/commands/install_command.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/commands/install_command.rb')
-rw-r--r--lib/rubygems/commands/install_command.rb17
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/rubygems/commands/install_command.rb b/lib/rubygems/commands/install_command.rb
index 0b58fa665e..ac78764af5 100644
--- a/lib/rubygems/commands/install_command.rb
+++ b/lib/rubygems/commands/install_command.rb
@@ -4,8 +4,6 @@ require 'rubygems/dependency_installer'
require 'rubygems/local_remote_options'
require 'rubygems/validator'
require 'rubygems/version_option'
-require 'rubygems/install_message' # must come before rdoc for messaging
-require 'rubygems/rdoc'
##
# Gem installer command line tool
@@ -39,6 +37,12 @@ class Gem::Commands::InstallCommand < Gem::Command
'install the listed gems') do |v,o|
o[:gemdeps] = v
end
+
+ add_option(:"Install/Update", '--default',
+ 'Add the gem\'s full specification to',
+ 'specifications/default and extract only its bin') do |v,o|
+ o[:install_as_default] = v
+ end
@installed_specs = nil
end
@@ -153,7 +157,14 @@ to write the specification by hand. For example:
alert_error "Can't use --version w/ multiple gems. Use name:ver instead."
terminate_interaction 1
end
-
+
+ # load post-install hooks appropriate to options
+ if options[:install_as_default]
+ require 'rubygems/install_default_message'
+ else
+ require 'rubygems/install_message'
+ end
+ require 'rubygems/rdoc'
get_all_gem_names_and_versions.each do |gem_name, gem_version|
gem_version ||= options[:version]