module PoiseProfiler::CoreExt::RunContext

Monkeypatch extensions for Chef::RunContext to add support for the recipe_file_loaded event on older Chef.

@since 1.1.0 @api private

Constants

PRE_MAGIC_EVENTS

Public Instance Methods

load_recipe(recipe_name, current_cookbook: nil) click to toggle source
Calls superclass method
# File lib/poise_profiler/core_ext/run_context.rb, line 31
def load_recipe(recipe_name, current_cookbook: nil)
  super.tap do |ret|
    cookbook_name, recipe_short_name = Chef::Recipe.parse_recipe_name(recipe_name, current_cookbook: current_cookbook)
    cookbook = cookbook_collection[cookbook_name]
    recipe_path = cookbook.recipe_filenames_by_name[recipe_short_name]
    if PRE_MAGIC_EVENTS
      events.recipe_file_loaded(recipe_path)
    else
      events.recipe_file_loaded(recipe_path, recipe_name)
    end
  end
end