class Teapot::Target

Public Class Methods

new(*) click to toggle source
Calls superclass method Teapot::Definition::new
# File lib/teapot/target.rb, line 35
def initialize(*)
        super
        
        @build = nil
end

Public Instance Methods

build(&block) click to toggle source
# File lib/teapot/target.rb, line 49
def build(&block)
        if block_given?
                @build = block
        end
        
        return @build
end
freeze() click to toggle source
Calls superclass method Teapot::Definition#freeze
# File lib/teapot/target.rb, line 41
def freeze
        return self if frozen?
        
        @build.freeze
        
        super
end
update_environments!() click to toggle source
# File lib/teapot/target.rb, line 57
def update_environments!
        return unless @build
        
        self.provisions.each do |key, provision|
                build = @build
                original = provision.value
                
                wrapper = proc do |*arguments|
                        self.instance_exec(*arguments, &original) if original
                        self.instance_exec(*arguments, &build) if build
                end
                
                provision.value = wrapper
        end
        
        @build = nil
end