Class: Teapot::Target
- Inherits:
-
Definition
show all
- Includes:
- Build::Dependency
- Defined in:
- lib/teapot/target.rb
Instance Attribute Summary
Attributes inherited from Definition
#context, #description, #name, #package
Instance Method Summary
collapse
Methods inherited from Definition
#inspect, #path, #to_s
Constructor Details
#initialize ⇒ Target
Returns a new instance of Target.
35
36
37
38
39
|
# File 'lib/teapot/target.rb', line 35
def initialize(*)
super
@build = nil
end
|
Instance Method Details
#build(&block) ⇒ Object
49
50
51
52
53
54
55
|
# File 'lib/teapot/target.rb', line 49
def build(&block)
if block_given?
@build = block
end
return @build
end
|
#freeze ⇒ Object
41
42
43
44
45
46
47
|
# File 'lib/teapot/target.rb', line 41
def freeze
return self if frozen?
@build.freeze
super
end
|
#update_environments! ⇒ Object
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# 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
|