Method: Chef::CookbookLoader#initialize

Defined in:
lib/chef/cookbook_loader.rb

#initialize(*repo_paths) ⇒ CookbookLoader

Returns a new instance of CookbookLoader.

Raises:

  • (ArgumentError)


38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/chef/cookbook_loader.rb', line 38

def initialize(*repo_paths)
  @repo_paths = repo_paths.flatten
  raise ArgumentError, "You must specify at least one cookbook repo path" if @repo_paths.empty?
  @cookbooks_by_name = Mash.new
  @loaded_cookbooks = {}
   = Mash.new
  @cookbooks_paths = Hash.new {|h,k| h[k] = []} # for deprecation warnings

  # Used to track which cookbooks appear in multiple places in the cookbook repos
  # and are merged in to a single cookbook by file shadowing. This behavior is
  # deprecated, so users of this class may issue warnings to the user by checking
  # this variable
  @merged_cookbooks = []

  load_cookbooks
end