Sha256: 30acf370c60bc29c1525494030351b10280f2d9d31f8c8b74cfa8f05703378ca

Contents?: true

Size: 1.36 KB

Versions: 22

Compression:

Stored size: 1.36 KB

Contents

module Librarian
  #
  # 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.
  #
  class Resolution
    attr_reader :dependencies, :manifests, :manifests_index

    def initialize(dependencies, manifests)
      @dependencies, @manifests = dependencies, manifests
      @manifests_index = build_manifests_index(manifests)
    end

    def correct?
      manifests && manifests_consistent_with_dependencies? && manifests_internally_consistent?
    end

    def sources
      manifests.map{|m| m.source}.uniq
    end

  private

    def build_manifests_index(manifests)
      Hash[manifests.map{|m| [m.name, m]}] if manifests
    end

    def manifests_consistent_with_dependencies?
      ManifestSet.new(manifests).in_compliance_with?(dependencies)
    end

    def manifests_internally_consistent?
      ManifestSet.new(manifests).consistent?
    end

  end
end

Version data entries

22 entries across 22 versions & 3 rubygems

Version Path
librarian-puppet-0.9.10 vendor/librarian/lib/librarian/resolution.rb
librarian-puppet-0.9.9 vendor/librarian/lib/librarian/resolution.rb
librarian-puppet-0.9.8 vendor/librarian/lib/librarian/resolution.rb
librarian-puppet-maestrodev-0.9.7.5 vendor/librarian/lib/librarian/resolution.rb
librarian-puppet-maestrodev-0.9.7.4 vendor/librarian/lib/librarian/resolution.rb
librarian-puppet-maestrodev-0.9.7.3 vendor/librarian/lib/librarian/resolution.rb
librarian-puppet-maestrodev-0.9.7.2 vendor/librarian/lib/librarian/resolution.rb
librarian-puppet-maestrodev-0.9.7.1 vendor/librarian/lib/librarian/resolution.rb
librarian-puppet-maestrodev-0.9.7 vendor/librarian/lib/librarian/resolution.rb
librarian-puppet-0.9.7 vendor/librarian/lib/librarian/resolution.rb
librarian-puppet-0.9.6 vendor/librarian/lib/librarian/resolution.rb
librarian-puppet-0.9.5 vendor/librarian/lib/librarian/resolution.rb
librarian-puppet-0.9.4 vendor/librarian/lib/librarian/resolution.rb
librarian-puppet-0.9.3 vendor/librarian/lib/librarian/resolution.rb
librarian-puppet-0.9.2 vendor/librarian/lib/librarian/resolution.rb
librarian-puppet-0.9.2.pre vendor/librarian/lib/librarian/resolution.rb
librarian-0.0.24 lib/librarian/resolution.rb
librarian-puppet-0.9.1 vendor/librarian/lib/librarian/resolution.rb
librarian-puppet-0.9.0 vendor/librarian/lib/librarian/resolution.rb
librarian-puppet-0.0.1.pre2 vendor/librarian/lib/librarian/resolution.rb