class Librarian::Resolution

Represents the output of the resolution process. Captures the declared dependencies plus the full set of resolved manifests. The sources are already known by the dependencies and by the resolved manifests, so they do not need to be captured explicitly.

This representation may be produced by the resolver, may be serialized into a lockfile, and may be deserialized from a lockfile. It is expected that the lockfile is a direct representation in text of this representation, so that the serialization-deserialization process is just the identity function.

Attributes

dependencies[RW]
manifests[RW]
manifests_index[RW]

Public Class Methods

new(dependencies, manifests) click to toggle source
# File lib/librarian/resolution.rb, line 17
def initialize(dependencies, manifests)
  self.dependencies = dependencies
  self.manifests = manifests
  self.manifests_index = build_manifests_index(manifests)
end

Public Instance Methods

correct?() click to toggle source
# File lib/librarian/resolution.rb, line 23
def correct?
  manifests && manifests_consistent_with_dependencies? && manifests_internally_consistent?
end
sources() click to toggle source
# File lib/librarian/resolution.rb, line 27
def sources
  manifests.map(&:source).uniq
end

Private Instance Methods

build_manifests_index(manifests) click to toggle source
# File lib/librarian/resolution.rb, line 33
def build_manifests_index(manifests)
  Hash[manifests.map{|m| [m.name, m]}] if manifests
end
manifests_consistent_with_dependencies?() click to toggle source
# File lib/librarian/resolution.rb, line 37
def manifests_consistent_with_dependencies?
  ManifestSet.new(manifests).in_compliance_with?(dependencies)
end
manifests_internally_consistent?() click to toggle source
# File lib/librarian/resolution.rb, line 41
def manifests_internally_consistent?
  ManifestSet.new(manifests).consistent?
end