Module: Build

Defined in:
lib/build/name.rb,
lib/build/rule.rb,
lib/build/task.rb,
lib/build/version.rb,
lib/build/graphviz.rb,
lib/build/rulebook.rb,
lib/build/rule_node.rb,
lib/build/build_node.rb,
lib/build/chain_node.rb,
lib/build/controller.rb,
lib/build/provision_node.rb,
lib/build/dependency_node.rb

Defined Under Namespace

Modules: DependenciesFailed, ProvisionsFailed Classes: BuildNode, BuildTask, ChainNode, Controller, DependencyNode, DependencyTask, Name, NoApplicableRule, ProvisionNode, ProvisionTask, Rule, RuleNode, Rulebook, Task

Constant Summary collapse

VERSION =
"2.7.0"

Class Method Summary collapse

Class Method Details

.graph_visualisation(walker) ⇒ Object

Generate a Graphviz graph visualisation of the build graph.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/build/graphviz.rb', line 10

def self.graph_visualisation(walker)
	graph = Graphviz::Graph.new("G", rankdir: "LR")
	
	walker.tasks.each do |node, task|
		input_nodes = []
		output_nodes = []
		
		task.inputs.each do |path|
			input_nodes << graph.add_node(path.basename)
		end
		
		task.outputs.each do |path|
			output_nodes << graph.add_node(path.basename)
		end
		
		if output_nodes.size == 1
			input_nodes.each do |input_node|
				edge = input_node.connect(output_nodes.first)
				edge.attributes[:label] = node.title
			end
		end
	end
	
	return graph
end