BuildSourceBuildProvisionTask

class ProvisionTask

Represents a task that builds the dependencies of a provision and applies the provision itself.

Definitions

def initialize(*arguments, **options)

Initialize the provision task.

Implementation

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

def provision

Signature

returns Build::Dependency::Provision

The provision being built by this task.

Implementation

def provision
	@node.provision
end

def update

Build all dependencies and then apply the provision.

Implementation

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

def local_environment

Signature

returns Build::Environment

The combined local environment for this provision.

Implementation

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

def output_environment

Signature

returns Build::Environment | Nil

The output environment produced by the build task, if any.

Implementation

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

def output_environments

Signature

returns Array(Build::Environment)

All output environments including any public ones.

Implementation

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