Class: Build::DependencyTask

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

Overview

Represents a task that resolves and builds all provisions for a dependency.

Instance Attribute Summary collapse

Attributes inherited from Task

#group

Instance Method Summary collapse

Methods inherited from Task

#name, #node_string, #task_class

Constructor Details

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

Initialize the dependency task.



86
87
88
89
90
91
92
93
# File 'lib/build/dependency_node.rb', line 86

def initialize(*arguments, **options)
  super
  
  @provisions = []
  
  @environments = nil
  @environment = nil
end

Instance Attribute Details

#environmentObject (readonly)

Returns the value of attribute environment.



95
96
97
# File 'lib/build/dependency_node.rb', line 95

def environment
  @environment
end

Instance Method Details

#dependencyObject



98
99
100
# File 'lib/build/dependency_node.rb', line 98

def dependency
  @node.dependency
end

#updateObject

Build all provisions for the dependency and combine the resulting environments.



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/build/dependency_node.rb', line 103

def update
  Console.debug(self) do |buffer|
    buffer.puts "building #{@node} which #{@node.dependency}"
    @node.provisions.each do |provision|
      buffer.puts "\tbuilding #{provision.provider.name} which #{provision}"
    end
  end
  
  # Lookup what things this dependency provides:
  @node.provisions.each do |provision|
    @provisions << invoke(
      @node.provision_node_for(provision)
    )
  end
  
  if wait_for_children?
    update_environments!
  else
    fail!(ProvisionsFailed)
  end
end