From 5e87b84187e8d341fc83bdc90f5a1ce25c871610 Mon Sep 17 00:00:00 2001 From: John Keiser Date: Thu, 5 Dec 2013 14:22:19 -0800 Subject: Add ability to run recipes directly from chef-client command line --- lib/chef/run_context.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/chef/run_context.rb') diff --git a/lib/chef/run_context.rb b/lib/chef/run_context.rb index 4d431116f9..2ed29a2e34 100644 --- a/lib/chef/run_context.rb +++ b/lib/chef/run_context.rb @@ -152,6 +152,17 @@ class Chef end end + def load_recipe_file(recipe_file) + if !File.exist?(recipe_file) + raise Chef::Exceptions::RecipeNotFound, "could not find recipe file #{recipe_file}" + end + + Chef::Log.debug("Loading Recipe File #{recipe_file}") + recipe = Chef::Recipe.new('@recipe_files', recipe_file, self) + recipe.from_file(recipe_file) + recipe + 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) -- cgit v1.2.1