diff options
author | John Keiser <john@johnkeiser.com> | 2015-04-25 09:54:23 -0700 |
---|---|---|
committer | John Keiser <john@johnkeiser.com> | 2015-05-13 13:42:33 -0700 |
commit | a2e600d2fbd0233603a5ac43b5b953ba095362da (patch) | |
tree | 9c66c61f14c36b5165da35a542e3d4dfeb2c01a2 /lib | |
parent | f605a8676c01e0b9b793a7645b814fe177fbd45e (diff) | |
download | chef-a2e600d2fbd0233603a5ac43b5b953ba095362da.tar.gz |
Remove automatic `provides`
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/resource.rb | 26 | ||||
-rw-r--r-- | lib/chef/resource_resolver.rb | 8 |
2 files changed, 3 insertions, 31 deletions
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb index 194a82b61b..c7d9f9549d 100644 --- a/lib/chef/resource.rb +++ b/lib/chef/resource.rb @@ -973,38 +973,12 @@ class Chef end end - # Cause each subclass to register itself with the DSL - def self.inherited(subclass) - super - if subclass.dsl_name - subclass.provides subclass.dsl_name.to_sym - subclass.using_automatic_dsl = true - end - end - - def self.using_automatic_dsl? - @using_automatic_dsl - end - - def self.using_automatic_dsl=(value) - @using_automatic_dsl = value - end - def self.provides(name, *args, &block) - # If the user specifies provides, then we get rid of the auto-provided DSL - # and let them specify what they want - if using_automatic_dsl? - provides_nothing - end - super - Chef::DSL::Resources.add_resource_dsl(name) end def self.provides_nothing - @using_automatic_dsl = false - unprovided_names = super unprovided_names.each do |name| diff --git a/lib/chef/resource_resolver.rb b/lib/chef/resource_resolver.rb index e9aec11f62..c9bf2e189a 100644 --- a/lib/chef/resource_resolver.rb +++ b/lib/chef/resource_resolver.rb @@ -106,11 +106,9 @@ class Chef resource_class = Chef::Resource.const_get(class_name) if resource_class <= Chef::Resource && !enabled_handlers.include?(resource_class) enabled_handlers << resource_class - if resource_class.using_automatic_dsl? - Chef::Log.warn("Class #{resource_class} was created with Class.new and assigned directly to a constant (#{resource_class.name} = <class>) rather than being created directly (class #{resource_class.name} < <superclass>).") - Chef::Log.warn("This will no longer work in Chef 13: you can either declare your class directly (in any namespace), or specify 'provides #{resource.to_sym.inspect}' in the class definition.") - resource_class.provides resource.to_sym - end + Chef::Log.warn("Class Chef::Resource::#{class_name} does not declare `provides #{resource.inspect}`.") + Chef::Log.warn("This will no longer work in Chef 13: you must use `provides` to provide DSL.") + resource_class.provides resource.to_sym end end end |