Module: Chef::Mixin::LanguageIncludeRecipe

Included in:
Compile, Recipe
Defined in:
lib/chef/mixin/language_include_recipe.rb

Instance Method Summary collapse

Instance Method Details

#include_recipe(*args) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/chef/mixin/language_include_recipe.rb', line 25

def include_recipe(*args)
  args.flatten.each do |recipe|
    if @node.run_state[:seen_recipes].has_key?(recipe)
      Chef::Log.debug("I am not loading #{recipe}, because I have already seen it.")
      next
    end        

    Chef::Log.debug("Loading Recipe #{recipe} via include_recipe")
    @node.run_state[:seen_recipes][recipe] = true

    rmatch = recipe.match(/(.+?)::(.+)/)
    if rmatch
      cookbook = @cookbook_loader[rmatch[1]]
      cookbook.load_recipe(rmatch[2], @node, @collection, @definitions, @cookbook_loader)
    else
      cookbook = @cookbook_loader[recipe]
      cookbook.load_recipe("default", @node, @collection, @definitions, @cookbook_loader)
    end
  end
end

#require_recipe(*args) ⇒ Object



46
47
48
# File 'lib/chef/mixin/language_include_recipe.rb', line 46

def require_recipe(*args)
  include_recipe(*args)
end