Class: Doubleshot::Resolver::GemResolver
- Inherits:
-
Doubleshot::Resolver
- Object
- Doubleshot::Resolver
- Doubleshot::Resolver::GemResolver
- Defined in:
- lib/doubleshot/resolver/gem_resolver.rb,
lib/doubleshot/resolver/gem_resolver/graph.rb,
lib/doubleshot/resolver/gem_resolver/demand.rb,
lib/doubleshot/resolver/gem_resolver/errors.rb,
lib/doubleshot/resolver/gem_resolver/solver.rb,
lib/doubleshot/resolver/gem_resolver/source.rb,
lib/doubleshot/resolver/gem_resolver/artifact.rb,
lib/doubleshot/resolver/gem_resolver/dependency.rb,
lib/doubleshot/resolver/gem_resolver/gem_source.rb,
lib/doubleshot/resolver/gem_resolver/solver/variable_row.rb,
lib/doubleshot/resolver/gem_resolver/solver/constraint_row.rb,
lib/doubleshot/resolver/gem_resolver/solver/variable_table.rb,
lib/doubleshot/resolver/gem_resolver/solver/constraint_table.rb
Defined Under Namespace
Modules: Errors Classes: Artifact, Demand, Dependency, GemSource, Graph, Solver, Source
Constant Summary collapse
- DEFAULT_REPOSITORY =
"http://rubygems.org"
Instance Method Summary collapse
-
#initialize(*repositories) ⇒ GemResolver
constructor
A new instance of GemResolver.
- #resolve!(dependencies) ⇒ Object
Methods inherited from Doubleshot::Resolver
Constructor Details
#initialize(*repositories) ⇒ GemResolver
Returns a new instance of GemResolver.
6 7 8 9 |
# File 'lib/doubleshot/resolver/gem_resolver.rb', line 6 def initialize(*repositories) super @graph = Graph.new(*repositories) end |
Instance Method Details
#resolve!(dependencies) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/doubleshot/resolver/gem_resolver.rb', line 11 def resolve!(dependencies) demands = dependencies.map do |dependency| if dependency.requirements.empty? dependency.name else [ dependency.name, *dependency.requirements.map { |requirement| requirement.to_s } ] end end ui = Class.new do def say(*args) STDERR.puts *args end end.new ui = nil results = Solver.new(@graph, demands, ui).resolve results.each_pair do |name, version| dependencies.fetch(name).lock(version) end dependencies end |