Class: Stove::Plugin::Base
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
extended, included
validate, validations
Constructor Details
#initialize(cookbook, options = {}) ⇒ Base
Returns a new instance of Base.
27
28
29
|
# File 'lib/stove/plugins/base.rb', line 27
def initialize(cookbook, options = {})
@cookbook, @options = cookbook, options
end
|
Instance Attribute Details
#cookbook ⇒ Object
Returns the value of attribute cookbook.
24
25
26
|
# File 'lib/stove/plugins/base.rb', line 24
def cookbook
@cookbook
end
|
#options ⇒ Object
Returns the value of attribute options.
25
26
27
|
# File 'lib/stove/plugins/base.rb', line 25
def options
@options
end
|
Class Method Details
.actions ⇒ Object
16
17
18
|
# File 'lib/stove/plugins/base.rb', line 16
def actions
@actions ||= []
end
|
.run(description, &block) ⇒ Object
9
10
11
12
13
14
|
# File 'lib/stove/plugins/base.rb', line 9
def run(description, &block)
actions << Proc.new do |instance|
log.info { description }
instance.instance_eval(&block)
end
end
|
Instance Method Details
#run ⇒ Object
31
32
33
34
|
# File 'lib/stove/plugins/base.rb', line 31
def run
run_validations
run_actions
end
|
#run_actions ⇒ Object
42
43
44
45
46
|
# File 'lib/stove/plugins/base.rb', line 42
def run_actions
self.class.actions.each do |action|
action.call(self)
end
end
|
#run_validations ⇒ Object
36
37
38
39
40
|
# File 'lib/stove/plugins/base.rb', line 36
def run_validations
self.class.validations.each do |id, validation|
validation.run(cookbook, options)
end
end
|