class Gem::Commands::InstallCommand

Gem installer command line tool

See `gem help install`

Public Class Methods

new() click to toggle source
Calls superclass method Gem::Command.new
# File lib/rubygems/commands/install_command.rb, line 21
def initialize
  defaults = Gem::DependencyInstaller::DEFAULT_OPTIONS.merge({
    :format_executable => false,
    :version           => Gem::Requirement.default,
  })

  super 'install', 'Install a gem into the local repository', defaults

  add_install_update_options
  add_local_remote_options
  add_platform_option
  add_version_option
  add_prerelease_option "to be installed. (Only for listed gems)"

  add_option(:"Install/Update", '-g', '--file FILE',
             'Read from a gem dependencies API file and',
             '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

Public Instance Methods

execute() click to toggle source
# File lib/rubygems/commands/install_command.rb, line 131
def execute
  if gf = options[:gemdeps] then
    install_from_gemdeps gf
    return
  end

  @installed_specs = []

  ENV.delete 'GEM_PATH' if options[:install_dir].nil? and RUBY_VERSION > '1.9'

  check_install_dir
  check_version

  load_hooks

  exit_code = install_gems

  show_installed

  raise Gem::SystemExitException, exit_code
end