Class: Build::ProvisionTask
- Defined in:
- lib/build/provision_node.rb
Overview
Represents a task that builds the dependencies of a provision and applies the provision itself.
Instance Attribute Summary collapse
-
#build_task ⇒ Object
readonly
Returns the value of attribute build_task.
-
#environments ⇒ Object
readonly
Returns the value of attribute environments.
-
#public_environments ⇒ Object
readonly
Returns the value of attribute public_environments.
Attributes inherited from Task
Instance Method Summary collapse
-
#initialize(*arguments, **options) ⇒ ProvisionTask
constructor
Initialize the provision task.
- #local_environment ⇒ Object
- #output_environment ⇒ Object
- #output_environments ⇒ Object
- #provision ⇒ Object
-
#update ⇒ Object
Build all dependencies and then apply the provision.
Methods inherited from Task
#name, #node_string, #task_class
Constructor Details
#initialize(*arguments, **options) ⇒ ProvisionTask
Initialize the provision task.
76 77 78 79 80 81 82 83 84 85 |
# File 'lib/build/provision_node.rb', line 76 def initialize(*arguments, **) super @dependencies = [] @environments = [] @public_environments = [] @build_task = nil end |
Instance Attribute Details
#build_task ⇒ Object (readonly)
Returns the value of attribute build_task.
90 91 92 |
# File 'lib/build/provision_node.rb', line 90 def build_task @build_task end |
#environments ⇒ Object (readonly)
Returns the value of attribute environments.
87 88 89 |
# File 'lib/build/provision_node.rb', line 87 def environments @environments end |
#public_environments ⇒ Object (readonly)
Returns the value of attribute public_environments.
88 89 90 |
# File 'lib/build/provision_node.rb', line 88 def public_environments @public_environments end |
Instance Method Details
#local_environment ⇒ Object
111 112 113 |
# File 'lib/build/provision_node.rb', line 111 def local_environment Build::Environment.combine(@node.environment, *@environments)&.evaluate(name: @node.name).freeze end |
#output_environment ⇒ Object
116 117 118 119 120 |
# File 'lib/build/provision_node.rb', line 116 def output_environment if @build_task @build_task.output_environment.dup(parent: nil) end end |
#output_environments ⇒ Object
123 124 125 126 127 128 129 130 131 |
# File 'lib/build/provision_node.rb', line 123 def output_environments environments = @public_environments.dup if environment = self.output_environment environments << environment end return environments end |
#provision ⇒ Object
93 94 95 |
# File 'lib/build/provision_node.rb', line 93 def provision @node.provision end |
#update ⇒ Object
Build all dependencies and then apply the provision.
98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/build/provision_node.rb', line 98 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 |