Class SemanticPuppet::Dependency::Graph
In: lib/semantic_puppet/dependency/graph.rb
Parent: Object

Methods

Included Modules

GraphNode

Attributes

modules  [R] 

Public Class methods

Create a new instance of a dependency graph.

@param modules [{String => VersionRange}] the required module

       set and their version constraints

Public Instance methods

Constrains graph solutions based on the given block. Graph constraints are used to describe fundamental truths about the tooling or module system (e.g.: module names contain a namespace component which is dropped during install, so module names must be unique excluding the namespace).

@example Ensuring a single source for all modules

    @graph.add_constraint('installed', mod.name) do |nodes|
      nodes.count { |node| node.source } == 1
    end

@see considering_solution?

@param source [String, Symbol] a name describing the source of the

              constraint

@yieldparam nodes [Array<GraphNode>] the nodes to test the constraint

            against

@yieldreturn [Boolean] whether the node passed the constraint @return [void]

Checks the proposed solution (or partial solution) against the graph‘s constraints.

@see add_graph_constraint

@return [Boolean] true if none of the graph constraints are violated

[Validate]