Method: Chef::RunContext::CookbookCompiler#compile_libraries

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

#compile_librariesObject

Loads library files from cookbooks according to #cookbook_order.



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/chef/run_context/cookbook_compiler.rb', line 130

def compile_libraries
  events.library_load_start(count_files_by_segment(:libraries))
  cookbook_order.each do |cookbook|
    eager_load_libraries = cookbook_collection[cookbook]..eager_load_libraries
    if eager_load_libraries == true # actually true, not truthy
      load_libraries_from_cookbook(cookbook)
    else
      $LOAD_PATH.unshift File.expand_path("libraries", cookbook_collection[cookbook].root_dir)
      if eager_load_libraries # we have a String or Array<String> and not false
        load_libraries_from_cookbook(cookbook, eager_load_libraries)
      end
    end
  end
  events.library_load_complete
end