Class: Build::BuildNode

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(environment, provision, arguments) ⇒ BuildNode

Returns a new instance of BuildNode.



28
29
30
31
32
33
34
# File 'lib/build/build_node.rb', line 28

def initialize(environment, provision, arguments)
	@environment = environment
	@provision = provision
	@arguments = arguments
	
	super(Files::List::NONE, :inherit)
end

Instance Attribute Details

#argumentsObject (readonly)

Returns the value of attribute arguments.



38
39
40
# File 'lib/build/build_node.rb', line 38

def arguments
  @arguments
end

#environmentObject (readonly)

Returns the value of attribute environment.



36
37
38
# File 'lib/build/build_node.rb', line 36

def environment
  @environment
end

#provisionObject (readonly)

Returns the value of attribute provision.



37
38
39
# File 'lib/build/build_node.rb', line 37

def provision
  @provision
end

Instance Method Details

#==(other) ⇒ Object



40
41
42
43
44
45
# File 'lib/build/build_node.rb', line 40

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

#apply!(task) ⇒ Object



63
64
65
66
67
68
69
# File 'lib/build/build_node.rb', line 63

def apply!(task)
	output_environment = self.initial_environment
	
	output_environment.construct!(task, *@arguments, &@provision.value)
	
	task.output_environment = output_environment
end

#hashObject



47
48
49
# File 'lib/build/build_node.rb', line 47

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

#initial_environmentObject



55
56
57
# File 'lib/build/build_node.rb', line 55

def initial_environment
	Build::Environment.new(@environment)
end

#nameObject



59
60
61
# File 'lib/build/build_node.rb', line 59

def name
	@environment.name
end

#task_class(parent_task) ⇒ Object



51
52
53
# File 'lib/build/build_node.rb', line 51

def task_class(parent_task)
	task_class = Rulebook.for(@environment).with(BuildTask, environment: @environment)
end