Class: Build::ChainNode

Inherits:
Graph::Node
  • Object
show all
Defined in:
lib/build/chain_node.rb

Overview

Responsible for processing a chain into a series of dependency nodes.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(chain, arguments, environment) ⇒ ChainNode

Returns a new instance of ChainNode.



18
19
20
21
22
23
24
25
# File 'lib/build/chain_node.rb', line 18

def initialize(chain, arguments, environment)
	@chain = chain
	@arguments = arguments
	@environment = environment
	
	# Wait here, for all dependent targets, to be done:
	super(Files::List::NONE, :inherit)
end

Instance Attribute Details

#argumentsObject (readonly)

Returns the value of attribute arguments.



28
29
30
# File 'lib/build/chain_node.rb', line 28

def arguments
  @arguments
end

#chainObject (readonly)

Returns the value of attribute chain.



27
28
29
# File 'lib/build/chain_node.rb', line 27

def chain
  @chain
end

#environmentObject (readonly)

Returns the value of attribute environment.



29
30
31
# File 'lib/build/chain_node.rb', line 29

def environment
  @environment
end

Instance Method Details

#==(other) ⇒ Object



32
33
34
35
36
37
# File 'lib/build/chain_node.rb', line 32

def == other
	super and
		@chain == other.chain and
		@arguments == other.arguments and
		@environment == other.environment
end

#apply!(task) ⇒ Object

This is the main entry point when invoking the node from Build::Task.



55
56
57
58
59
60
61
62
# File 'lib/build/chain_node.rb', line 55

def apply!(task)
	# Go through all the dependencies in order and apply them to the build graph:
	@chain.dependencies.each do |dependency|
		task.invoke(
			DependencyNode.new(@chain, dependency, @environment, @arguments)
		)
	end
end

#hashObject



40
41
42
# File 'lib/build/chain_node.rb', line 40

def hash
	super ^ @chain.hash ^ @arguments.hash ^ @environment.hash
end

#inspectObject



65
66
67
# File 'lib/build/chain_node.rb', line 65

def inspect
	"#<#{self.class} #{@environment.inspect}>"
end

#nameObject



50
51
52
# File 'lib/build/chain_node.rb', line 50

def name
	@environment.name
end

#task_class(parent_task) ⇒ Object



45
46
47
# File 'lib/build/chain_node.rb', line 45

def task_class(parent_task)
	Task
end