Class: Build::ProvisionTask

Inherits:
Task
  • Object
show all
Defined in:
lib/build/provision_node.rb

Instance Attribute Summary collapse

Attributes inherited from Task

#group, #logger

Instance Method Summary collapse

Methods inherited from Task

#name, #node_string, #task_class

Constructor Details

#initialize(*arguments, **options) ⇒ ProvisionTask

Returns a new instance of ProvisionTask.



74
75
76
77
78
79
80
81
82
83
# File 'lib/build/provision_node.rb', line 74

def initialize(*arguments, **options)
	super
	
	@dependencies = []
	
	@environments = []
	@public_environments = []
	
	@build_task = nil
end

Instance Attribute Details

#build_taskObject (readonly)

Returns the value of attribute build_task.



88
89
90
# File 'lib/build/provision_node.rb', line 88

def build_task
  @build_task
end

#environmentsObject (readonly)

Returns the value of attribute environments.



85
86
87
# File 'lib/build/provision_node.rb', line 85

def environments
  @environments
end

#public_environmentsObject (readonly)

Returns the value of attribute public_environments.



86
87
88
# File 'lib/build/provision_node.rb', line 86

def public_environments
  @public_environments
end

Instance Method Details

#local_environmentObject



106
107
108
# File 'lib/build/provision_node.rb', line 106

def local_environment
	Build::Environment.combine(@node.environment, *@environments)&.evaluate(name: @node.name).freeze
end

#output_environmentObject



110
111
112
113
114
# File 'lib/build/provision_node.rb', line 110

def output_environment
	if @build_task
		@build_task.output_environment.dup(parent: nil)
	end
end

#output_environmentsObject



116
117
118
119
120
121
122
123
124
# File 'lib/build/provision_node.rb', line 116

def output_environments
	environments = @public_environments.dup
	
	if environment = self.output_environment
		environments << environment
	end
	
	return environments
end

#provisionObject



90
91
92
# File 'lib/build/provision_node.rb', line 90

def provision
	@node.provision
end

#updateObject



94
95
96
97
98
99
100
101
102
103
104
# File 'lib/build/provision_node.rb', line 94

def update
	provision.each_dependency do |dependency|
		@dependencies << invoke(@node.dependency_node_for(dependency))
	end
	
	if wait_for_children?
		update_environments!
	else
		fail!(DependenciesFailed)
	end
end