diff options
author | danielsdeleo <dan@opscode.com> | 2012-11-29 16:50:07 -0800 |
---|---|---|
committer | danielsdeleo <dan@opscode.com> | 2012-11-30 14:51:48 -0800 |
commit | d6f673118b60c7425e213212d48ddb5a5f89fefe (patch) | |
tree | d836dc693daff572e3d761fb8084b41512a39916 /lib/chef/run_context.rb | |
parent | 549d048726dd27d88024334d31a85bc27bc527d4 (diff) | |
download | chef-d6f673118b60c7425e213212d48ddb5a5f89fefe.tar.gz |
[CHEF-3376] rdoc more methods, reorganize
Diffstat (limited to 'lib/chef/run_context.rb')
-rw-r--r-- | lib/chef/run_context.rb | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/lib/chef/run_context.rb b/lib/chef/run_context.rb index b5d4f1fe48..d6fb6269b0 100644 --- a/lib/chef/run_context.rb +++ b/lib/chef/run_context.rb @@ -66,18 +66,6 @@ class Chef compiler.compile end - # Looks up an attribute file given the +cookbook_name+ and - # +attr_file_name+. Used by DSL::IncludeAttribute - def resolve_attribute(cookbook_name, attr_file_name) - cookbook = cookbook_collection[cookbook_name] - raise Chef::Exceptions::CookbookNotFound, "could not find cookbook #{cookbook_name} while loading attribute #{name}" unless cookbook - - attribute_filename = cookbook.attribute_filenames_by_short_filename[attr_file_name] - raise Chef::Exceptions::AttributeNotFound, "could not find filename for attribute #{attr_file_name} in cookbook #{cookbook_name}" unless attribute_filename - - attribute_filename - end - def notifies_immediately(notification) nr = notification.notifying_resource if nr.instance_of?(Chef::Resource) @@ -112,6 +100,7 @@ class Chef end end + # Evaluates the recipes +recipe_names+. Used by DSL::IncludeRecipe def include_recipe(*recipe_names) result_recipes = Array.new recipe_names.flatten.each do |recipe_name| @@ -122,6 +111,7 @@ class Chef result_recipes end + # Evaluates the recipe +recipe_name+. Used by DSL::IncludeRecipe def load_recipe(recipe_name) Chef::Log.debug("Loading Recipe #{recipe_name} via include_recipe") @@ -137,6 +127,18 @@ class Chef end end + # Looks up an attribute file given the +cookbook_name+ and + # +attr_file_name+. Used by DSL::IncludeAttribute + def resolve_attribute(cookbook_name, attr_file_name) + cookbook = cookbook_collection[cookbook_name] + raise Chef::Exceptions::CookbookNotFound, "could not find cookbook #{cookbook_name} while loading attribute #{name}" unless cookbook + + attribute_filename = cookbook.attribute_filenames_by_short_filename[attr_file_name] + raise Chef::Exceptions::AttributeNotFound, "could not find filename for attribute #{attr_file_name} in cookbook #{cookbook_name}" unless attribute_filename + + attribute_filename + end + def loaded_fully_qualified_recipe?(cookbook, recipe) @loaded_recipes.has_key?("#{cookbook}::#{recipe}") end |