Method: Chef::RunContext::CookbookCompiler#cookbook_order

Defined in:
lib/chef/run_context/cookbook_compiler.rb

#cookbook_orderObject

Extracts the cookbook names from the expanded run list, then iterates over the list, recursing through dependencies to give a run_list ordered array of cookbook names with no duplicates. Dependencies appear before the cookbook(s) that depend on them.



81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/chef/run_context/cookbook_compiler.rb', line 81

def cookbook_order
  @cookbook_order ||= begin
    ordered_cookbooks = []
    seen_cookbooks = {}
    run_list_expansion.recipes.each do |recipe|
      cookbook = Chef::Recipe.parse_recipe_name(recipe).first
      add_cookbook_with_deps(ordered_cookbooks, seen_cookbooks, cookbook)
    end
    Chef::Log.debug("Cookbooks to compile: #{ordered_cookbooks.inspect}")
    ordered_cookbooks
  end
end