diff options
author | danielsdeleo <dan@opscode.com> | 2012-12-18 12:24:49 -0800 |
---|---|---|
committer | danielsdeleo <dan@opscode.com> | 2012-12-19 15:39:53 -0800 |
commit | 3927c163d868af1ee6d0865a7048b86b179c898d (patch) | |
tree | 27b9863bfdd91044b8cfc9067e30adc7d0f278bb /lib/chef/provider.rb | |
parent | 8acaa8fe1c52e34579bb78e2cf84a9fba44535ce (diff) | |
download | chef-3927c163d868af1ee6d0865a7048b86b179c898d.tar.gz |
Extract provider LWRP code to LWRPBase
Diffstat (limited to 'lib/chef/provider.rb')
-rw-r--r-- | lib/chef/provider.rb | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/lib/chef/provider.rb b/lib/chef/provider.rb index a7f60c0383..3fe057bd9b 100644 --- a/lib/chef/provider.rb +++ b/lib/chef/provider.rb @@ -172,57 +172,5 @@ class Chef end end - public - - class << self - include Chef::Mixin::ConvertToClassName - - def build_from_file(cookbook_name, filename, run_context) - pname = filename_to_qualified_string(cookbook_name, filename) - - # Add log entry if we override an existing light-weight provider. - class_name = convert_to_class_name(pname) - overriding = Chef::Provider.const_defined?(class_name) - Chef::Log.info("#{class_name} light-weight provider already initialized -- overriding!") if overriding - - new_provider_class = Class.new self do |cls| - - include Chef::DSL::Recipe - - # These were previously provided by Chef::Mixin::RecipeDefinitionDSLCore. - # They are not included by its replacment, Chef::DSL::Recipe, but - # they may be used in existing LWRPs. - include Chef::DSL::PlatformIntrospection - include Chef::DSL::DataQuery - - def load_current_resource - # silence Chef::Exceptions::Override exception - end - - class << cls - include Chef::Mixin::FromFile - - # setup DSL's shortcut methods - def action(name, &block) - define_method("action_#{name.to_s}") do - instance_eval(&block) - end - end - end - - # load provider definition from file - cls.class_from_file(filename) - end - - # register new class as a Chef::Provider - pname = filename_to_qualified_string(cookbook_name, filename) - class_name = convert_to_class_name(pname) - Chef::Provider.const_set(class_name, new_provider_class) - Chef::Log.debug("Loaded contents of #{filename} into a provider named #{pname} defined in Chef::Provider::#{class_name}") - - new_provider_class - end - end - end end |