Class: Dapp::Dimg::Config::Directive::Chef
- Inherits:
-
Base
- Object
- Config::Directive::Base
- Base
- Dapp::Dimg::Config::Directive::Chef
- Defined in:
- lib/dapp/dimg/config/directive/chef.rb
Defined Under Namespace
Classes: Attributes
Instance Attribute Summary collapse
-
#_attributes ⇒ Object
Returns the value of attribute _attributes.
-
#_cookbook ⇒ Object
Returns the value of attribute _cookbook.
-
#_dimod ⇒ Object
Returns the value of attribute _dimod.
-
#_recipe ⇒ Object
Returns the value of attribute _recipe.
Instance Method Summary collapse
- #attributes ⇒ Object
- #cookbook(name, version_constraint = nil, **kwargs) ⇒ Object
- #dimod(name, *args) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(**kwargs, &blk) ⇒ Chef
constructor
A new instance of Chef.
- #recipe(name) ⇒ Object
Methods inherited from Base
Methods inherited from Config::Directive::Base
Constructor Details
#initialize(**kwargs, &blk) ⇒ Chef
Returns a new instance of Chef.
8 9 10 11 12 13 14 |
# File 'lib/dapp/dimg/config/directive/chef.rb', line 8 def initialize(**kwargs, &blk) @_dimod = [] @_recipe = [] @_cookbook = {} super(**kwargs, &blk) end |
Instance Attribute Details
#_attributes ⇒ Object
Returns the value of attribute _attributes.
6 7 8 |
# File 'lib/dapp/dimg/config/directive/chef.rb', line 6 def _attributes @_attributes end |
#_cookbook ⇒ Object
Returns the value of attribute _cookbook.
6 7 8 |
# File 'lib/dapp/dimg/config/directive/chef.rb', line 6 def _cookbook @_cookbook end |
#_dimod ⇒ Object
Returns the value of attribute _dimod.
6 7 8 |
# File 'lib/dapp/dimg/config/directive/chef.rb', line 6 def _dimod @_dimod end |
#_recipe ⇒ Object
Returns the value of attribute _recipe.
6 7 8 |
# File 'lib/dapp/dimg/config/directive/chef.rb', line 6 def _recipe @_recipe end |
Instance Method Details
#attributes ⇒ Object
27 28 29 |
# File 'lib/dapp/dimg/config/directive/chef.rb', line 27 def attributes @_attributes ||= Attributes.new end |
#cookbook(name, version_constraint = nil, **kwargs) ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/dapp/dimg/config/directive/chef.rb', line 31 def cookbook(name, version_constraint = nil, **kwargs) sub_directive_eval do @_cookbook[name] = {}.tap do |desc| desc.update(kwargs) desc[:name] = name desc[:version_constraint] = version_constraint if version_constraint desc[:path] = File.(desc[:path], dapp.path) if desc.key? :path end end end |
#dimod(name, *args) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/dapp/dimg/config/directive/chef.rb', line 16 def dimod(name, *args) sub_directive_eval do @_dimod << name cookbook(name, *args) end end |
#empty? ⇒ Boolean
63 64 65 |
# File 'lib/dapp/dimg/config/directive/chef.rb', line 63 def empty? (@_dimod + @_recipe).empty? && attributes.empty? end |
#recipe(name) ⇒ Object
23 24 25 |
# File 'lib/dapp/dimg/config/directive/chef.rb', line 23 def recipe(name) sub_directive_eval { @_recipe << name } end |