mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Import rubygems 1.6.0 (released version @ 58d8a0b9)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
86bb0af7ea
commit
25a9b62d45
73 changed files with 2408 additions and 719 deletions
|
@ -17,6 +17,7 @@ require 'tsort'
|
|||
# correct order to avoid conflicts.
|
||||
|
||||
class Gem::DependencyList
|
||||
attr_reader :specs
|
||||
|
||||
include Enumerable
|
||||
include TSort
|
||||
|
@ -56,6 +57,10 @@ class Gem::DependencyList
|
|||
@specs.push(*gemspecs)
|
||||
end
|
||||
|
||||
def clear
|
||||
@specs.clear
|
||||
end
|
||||
|
||||
##
|
||||
# Return a list of the gem specifications in the dependency list, sorted in
|
||||
# order so that no gemspec in the list depends on a gemspec earlier in the
|
||||
|
@ -110,11 +115,26 @@ class Gem::DependencyList
|
|||
# Are all the dependencies in the list satisfied?
|
||||
|
||||
def ok?
|
||||
@specs.all? do |spec|
|
||||
spec.runtime_dependencies.all? do |dep|
|
||||
@specs.find { |s| s.satisfies_requirement? dep }
|
||||
why_not_ok?(:quick).empty?
|
||||
end
|
||||
|
||||
def why_not_ok? quick = false
|
||||
unsatisfied = Hash.new { |h,k| h[k] = [] }
|
||||
source_index = Gem.source_index
|
||||
@specs.each do |spec|
|
||||
spec.runtime_dependencies.each do |dep|
|
||||
inst = source_index.any? { |_, installed_spec|
|
||||
dep.name == installed_spec.name and
|
||||
dep.requirement.satisfied_by? installed_spec.version
|
||||
}
|
||||
|
||||
unless inst or @specs.find { |s| s.satisfies_requirement? dep } then
|
||||
unsatisfied[spec.name] << dep
|
||||
return unsatisfied if quick
|
||||
end
|
||||
end
|
||||
end
|
||||
unsatisfied
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -146,6 +166,18 @@ class Gem::DependencyList
|
|||
}
|
||||
end
|
||||
|
||||
##
|
||||
# Remove everything in the DependencyList that matches but doesn't
|
||||
# satisfy items in +dependencies+ (a hash of gem names to arrays of
|
||||
# dependencies).
|
||||
|
||||
def remove_specs_unsatisfied_by dependencies
|
||||
specs.reject! { |spec|
|
||||
dep = dependencies[spec.name]
|
||||
dep and not dep.requirement.satisfied_by? spec.version
|
||||
}
|
||||
end
|
||||
|
||||
##
|
||||
# Removes the gemspec matching +full_name+ from the dependency list
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue