Installs gems for this RequestSet using the Gem::Installeroptions.
If a block is given an activation request and
installer are yielded. The installer will be nil
if a gem matching the request was
already installed.
# File lib/rubygems/request_set.rb, line 139
def install options, &block # :yields: request, installer
if dir = options[:install_dir]
requests = install_into dir, false, options, &block
return requests
end
cache_dir = options[:cache_dir] || Gem.dir
@prerelease = options[:prerelease]
requests = []
sorted_requests.each do |req|
if req.installed? then
req.spec.spec.build_extensions
if @always_install.none? { |spec| spec == req.spec.spec } then
yield req, nil if block_given?
next
end
end
path = req.download cache_dir
inst = Gem::Installer.new path, options
yield req, inst if block_given?
requests << inst.install
end
requests
ensure
raise if $!
return requests if options[:gemdeps]
specs = requests.map do |request|
case request
when Gem::Resolver::ActivationRequest then
request.spec.spec
else
request
end
end
require 'rubygems/dependency_installer'
inst = Gem::DependencyInstaller.new options
inst.installed_gems.replace specs
Gem.done_installing_hooks.each do |hook|
hook.call inst, specs
end unless Gem.done_installing_hooks.empty?
end