Gathers all dependencies necessary for the installation from local and
remote sources unless the ignore_dependencies was given.
# File lib/rubygems/dependency_installer.rb, line 311
def gather_dependencies # :nodoc:
specs = @available.all_specs
# these gems were listed by the user, always install them
keep_names = specs.map { |spec| spec.full_name }
if @dev_shallow
@toplevel_specs = keep_names
end
dependency_list = Gem::DependencyList.new @development
dependency_list.add(*specs)
to_do = specs.dup
add_found_dependencies to_do, dependency_list unless @ignore_dependencies
# REFACTOR maybe abstract away using Gem::Specification.include? so
# that this isn't dependent only on the currently installed gems
dependency_list.specs.reject! { |spec|
not keep_names.include?(spec.full_name) and
Gem::Specification.include?(spec)
}
unless dependency_list.ok? or @ignore_dependencies or @force then
reason = dependency_list.why_not_ok?.map { |k,v|
"#{k} requires #{v.join(", ")}"
}.join("; ")
raise Gem::DependencyError, "Unable to resolve dependencies: #{reason}"
end
@gems_to_install = dependency_list.dependency_order.reverse
end