Class: Dapp::Dimg::Config::Directive::Chef

Inherits:
Base show all
Defined in:
lib/dapp/dimg/config/directive/chef.rb

Defined Under Namespace

Classes: Attributes

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#_attributesObject

Returns the value of attribute _attributes.



6
7
8
# File 'lib/dapp/dimg/config/directive/chef.rb', line 6

def _attributes
  @_attributes
end

#_cookbookObject

Returns the value of attribute _cookbook.



6
7
8
# File 'lib/dapp/dimg/config/directive/chef.rb', line 6

def _cookbook
  @_cookbook
end

#_dimodObject

Returns the value of attribute _dimod.



6
7
8
# File 'lib/dapp/dimg/config/directive/chef.rb', line 6

def _dimod
  @_dimod
end

#_recipeObject

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

#attributesObject



25
26
27
# File 'lib/dapp/dimg/config/directive/chef.rb', line 25

def attributes
  @_attributes ||= Attributes.new
end

#cookbook(name, version_constraint = nil, **kwargs) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/dapp/dimg/config/directive/chef.rb', line 29

def cookbook(name, version_constraint=nil, **kwargs)
  @_cookbook[name] = {}.tap do |desc|
    desc.update(kwargs)
    desc[:name] = name
    desc[:version_constraint] = version_constraint if version_constraint
    desc[:path] = File.expand_path(desc[:path], dapp.path) if desc.key? :path
  end
end

#dimod(name, *args) ⇒ Object



16
17
18
19
# File 'lib/dapp/dimg/config/directive/chef.rb', line 16

def dimod(name, *args)
  @_dimod << name
  cookbook(name, *args)
end

#recipe(name) ⇒ Object



21
22
23
# File 'lib/dapp/dimg/config/directive/chef.rb', line 21

def recipe(name)
  @_recipe << name
end