Declare that a gem of name name with reqs
requirements is needed.
# File rubygems/request_set.rb, line 39
def gem name, *reqs
@dependencies << Gem::Dependency.new(name, reqs)
end
Add deps Gem::Dependency objects
to the set.
# File rubygems/request_set.rb, line 46
def import deps
@dependencies += deps
end
# File rubygems/request_set.rb, line 50
def install options, &block
if dir = options[:install_dir]
return install_into dir, false, options, &block
end
cache_dir = options[:cache_dir] || Gem.dir
specs = []
sorted_requests.each do |req|
if req.installed? and
@always_install.none? { |spec| spec == req.spec.spec } then
yield req, nil if block_given?
next
end
path = req.download cache_dir
inst = Gem::Installer.new path, options
yield req, inst if block_given?
specs << inst.install
end
specs
end
# File rubygems/request_set.rb, line 78
def install_into dir, force = true, options = {}
existing = force ? [] : specs_in(dir)
existing.delete_if { |s| @always_install.include? s }
dir = File.expand_path dir
installed = []
sorted_requests.each do |req|
if existing.find { |s| s.full_name == req.spec.full_name }
yield req, nil if block_given?
next
end
path = req.download(dir)
unless path then # already installed
yield req, nil if block_given?
next
end
options[:install_dir] = dir
options[:only_install_dir] = true
inst = Gem::Installer.new path, options
yield req, inst if block_given?
inst.install
installed << req
end
installed
end
Load a dependency management file.
# File rubygems/request_set.rb, line 117
def load_gemdeps path
gf = Gem::RequestSet::GemDepedencyAPI.new self, path
gf.load
end
Resolve the requested dependencies and return an Array of Specification objects to be activated.
# File rubygems/request_set.rb, line 126
def resolve set = nil
resolver = Gem::DependencyResolver.new @dependencies, set
resolver.development = @development
resolver.soft_missing = @soft_missing
@requests = resolver.resolve
end
Resolve the requested dependencies against the gems available via Gem.path and return an Array of Specification objects to be activated.
# File rubygems/request_set.rb, line 138
def resolve_current
resolve Gem::DependencyResolver::CurrentSet.new
end
# File rubygems/request_set.rb, line 142
def sorted_requests
@sorted ||= strongly_connected_components.flatten
end