summaryrefslogtreecommitdiff
path: root/lib/rubygems/commands/install_command.rb
diff options
context:
space:
mode:
-rw-r--r--lib/rubygems/commands/install_command.rb58
1 files changed, 48 insertions, 10 deletions
@@ -21,6 +21,8 @@ class Gem::Commands::InstallCommand < Gem::Command
def initialize
defaults = Gem::DependencyInstaller::DEFAULT_OPTIONS.merge({
:format_executable => false,
:version => Gem::Requirement.default,
:without_groups => [],
})
@@ -69,6 +71,16 @@ class Gem::Commands::InstallCommand < Gem::Command
o[:explain] = v
end
@installed_specs = []
end
@@ -78,7 +90,7 @@ class Gem::Commands::InstallCommand < Gem::Command
def defaults_str # :nodoc:
"--both --version '#{Gem::Requirement.default}' --document --no-force\n" +
- "--install-dir #{Gem.dir}"
end
def description # :nodoc:
@@ -92,6 +104,25 @@ The wrapper allows you to choose among alternate gem versions using _version_.
For example `rake _0.7.3_ --version` will run rake version 0.7.3 if a newer
version is also installed.
If an extension fails to compile during gem installation the gem
specification is not written out, but the gem remains unpacked in the
repository. You may need to specify the path to the library's headers and
@@ -204,23 +235,20 @@ to write the specification by hand. For example:
install_gem_without_dependencies name, req
else
inst = Gem::DependencyInstaller.new options
if options[:explain]
- request_set = inst.resolve_dependencies name, req
-
puts "Gems to install:"
- request_set.specs.map { |s| s.full_name }.sort.each do |s|
- puts " #{s}"
end
return
else
- inst.install name, req
end
- @installed_specs.push(*inst.installed_gems)
-
show_install_errors inst.errors
end
end
@@ -250,6 +278,14 @@ to write the specification by hand. For example:
inst = Gem::Installer.new gem, options
inst.install
@installed_specs.push(inst.spec)
end
@@ -264,8 +300,10 @@ to write the specification by hand. For example:
rescue Gem::InstallError => e
alert_error "Error installing #{gem_name}:\n\t#{e.message}"
exit_code |= 1
- rescue Gem::GemNotFoundException => e
- show_lookup_failure e.name, e.version, e.errors, options[:domain]
exit_code |= 2
end