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.
25
26
27
|
# File 'lib/stove/plugins/base.rb', line 25
def initialize(cookbook, options = {})
@cookbook, @options = cookbook, options
end
|
Instance Attribute Details
#cookbook ⇒ Object
Returns the value of attribute cookbook.
22
23
24
|
# File 'lib/stove/plugins/base.rb', line 22
def cookbook
@cookbook
end
|
#options ⇒ Object
Returns the value of attribute options.
23
24
25
|
# File 'lib/stove/plugins/base.rb', line 23
def options
@options
end
|
Class Method Details
.actions ⇒ Object
14
15
16
|
# File 'lib/stove/plugins/base.rb', line 14
def actions
@actions ||= []
end
|
.run(description, &block) ⇒ Object
7
8
9
10
11
12
|
# File 'lib/stove/plugins/base.rb', line 7
def run(description, &block)
actions << Proc.new do |instance|
Stove::Log.info { description }
instance.instance_eval(&block)
end
end
|
Instance Method Details
#run ⇒ Object
29
30
31
32
|
# File 'lib/stove/plugins/base.rb', line 29
def run
run_validations
run_actions
end
|
#run_actions ⇒ Object
40
41
42
43
44
|
# File 'lib/stove/plugins/base.rb', line 40
def run_actions
self.class.actions.each do |action|
action.call(self)
end
end
|
#run_validations ⇒ Object
34
35
36
37
38
|
# File 'lib/stove/plugins/base.rb', line 34
def run_validations
self.class.validations.each do |id, validation|
validation.run(cookbook, options)
end
end
|