diff options
author | Lamont Granquist <lamont@chef.io> | 2020-02-27 16:50:22 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-27 16:50:22 -0800 |
commit | 8a47d92a77c34b80c531fc8426c2f11064a68397 (patch) | |
tree | 331ea064a32e99c4bca201ebe6b6f9e8b6bd0f7a | |
parent | 36a727691ea93d1f5fe8cf267fae5dd92516a9f0 (diff) | |
parent | 35391308b245a651a258f841745296a66b18944b (diff) | |
download | chef-8a47d92a77c34b80c531fc8426c2f11064a68397.tar.gz |
Merge pull request #9411 from chef/lcg/remove-core-dsl
Remove the "Core" DSL for Chef-16
-rw-r--r-- | lib/chef/dsl/core.rb | 52 | ||||
-rw-r--r-- | lib/chef/dsl/recipe.rb | 21 | ||||
-rw-r--r-- | lib/chef/dsl/universal.rb | 10 | ||||
-rw-r--r-- | lib/chef/provider.rb | 5 | ||||
-rw-r--r-- | lib/chef/resource/action_class.rb | 2 |
5 files changed, 13 insertions, 77 deletions
diff --git a/lib/chef/dsl/core.rb b/lib/chef/dsl/core.rb deleted file mode 100644 index f564dd0418..0000000000 --- a/lib/chef/dsl/core.rb +++ /dev/null @@ -1,52 +0,0 @@ -#-- -# Author:: Adam Jacob (<adam@chef.io>) -# Author:: Christopher Walters (<cw@chef.io>) -# Copyright:: Copyright 2008-2019, Chef Software Inc. -# License:: Apache License, Version 2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -require_relative "declare_resource" -require_relative "universal" -require_relative "../mixin/notifying_block" -require_relative "../mixin/lazy_module_include" - -class Chef - module DSL - # Part of a family of DSL mixins. - # - # Chef::DSL::Recipe mixes into Recipes and LWRP Providers. - # - this does not target core chef resources and providers. - # - this is restricted to recipe/resource/provider context where a resource collection exists. - # - cookbook authors should typically include modules into here. - # - # Chef::DSL::Core mixes into Recipes, LWRP Providers and Core Providers - # - this adds cores providers on top of the Recipe DSL. - # - this is restricted to recipe/resource/provider context where a resource collection exists. - # - core chef authors should typically include modules into here. - # - # Chef::DSL::Universal mixes into Recipes, LWRP Resources+Providers, Core Resources+Providers, and Attributes files. - # - this adds resources and attributes files. - # - do not add helpers which manipulate the resource collection. - # - this is for general-purpose stuff that is useful nearly everywhere. - # - it also pollutes the namespace of nearly every context, watch out. - # - module Core - include Chef::DSL::Universal - include Chef::DSL::DeclareResource - include Chef::Mixin::NotifyingBlock - extend Chef::Mixin::LazyModuleInclude - end - end -end diff --git a/lib/chef/dsl/recipe.rb b/lib/chef/dsl/recipe.rb index 1d02d9c03e..647ae4feb9 100644 --- a/lib/chef/dsl/recipe.rb +++ b/lib/chef/dsl/recipe.rb @@ -1,7 +1,7 @@ # # Author:: Adam Jacob (<adam@chef.io>) # Author:: Christopher Walters (<cw@chef.io>) -# Copyright:: Copyright 2008-2019, Chef Software Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,23 +22,19 @@ require_relative "resources" require_relative "definitions" require_relative "include_recipe" require_relative "reboot_pending" -require_relative "core" +require_relative "universal" +require_relative "declare_resource" +require_relative "../mixin/notifying_block" require_relative "../mixin/lazy_module_include" class Chef module DSL # Part of a family of DSL mixins. # - # Chef::DSL::Recipe mixes into Recipes and LWRP Providers. - # - this does not target core chef resources and providers. + # Chef::DSL::Recipe mixes into Recipes and Providers. # - this is restricted to recipe/resource/provider context where a resource collection exists. # - cookbook authors should typically include modules into here. # - # Chef::DSL::Core mixes into Recipes, LWRP Providers and Core Providers - # - this adds cores providers on top of the Recipe DSL. - # - this is restricted to recipe/resource/provider context where a resource collection exists. - # - core chef authors should typically include modules into here. - # # Chef::DSL::Universal mixes into Recipes, LWRP Resources+Providers, Core Resources+Providers, and Attributes files. # - this adds resources and attributes files. # - do not add helpers which manipulate the resource collection. @@ -46,7 +42,9 @@ class Chef # - it also pollutes the namespace of nearly every context, watch out. # module Recipe - include Chef::DSL::Core + include Chef::DSL::Universal + include Chef::DSL::DeclareResource + include Chef::Mixin::NotifyingBlock include Chef::DSL::IncludeRecipe include Chef::DSL::RebootPending include Chef::DSL::Resources @@ -69,6 +67,3 @@ class Chef end end end - -# Avoid circular references for things that are only used in instance methods -require_relative "../resource" diff --git a/lib/chef/dsl/universal.rb b/lib/chef/dsl/universal.rb index c9afa38f98..fe276de5a6 100644 --- a/lib/chef/dsl/universal.rb +++ b/lib/chef/dsl/universal.rb @@ -1,7 +1,7 @@ #-- # Author:: Adam Jacob (<adam@chef.io>) # Author:: Christopher Walters (<cw@chef.io>) -# Copyright:: Copyright 2008-2019, Chef Software Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -30,16 +30,10 @@ class Chef module DSL # Part of a family of DSL mixins. # - # Chef::DSL::Recipe mixes into Recipes and LWRP Providers. - # - this does not target core chef resources and providers. + # Chef::DSL::Recipe mixes into Recipes and Providers. # - this is restricted to recipe/resource/provider context where a resource collection exists. # - cookbook authors should typically include modules into here. # - # Chef::DSL::Core mixes into Recipes, LWRP Providers and Core Providers - # - this adds cores providers on top of the Recipe DSL. - # - this is restricted to recipe/resource/provider context where a resource collection exists. - # - core chef authors should typically include modules into here. - # # Chef::DSL::Universal mixes into Recipes, LWRP Resources+Providers, Core Resources+Providers, and Attributes files. # - this adds resources and attributes files. # - do not add helpers which manipulate the resource collection. diff --git a/lib/chef/provider.rb b/lib/chef/provider.rb index 3fa097ce38..06e0341089 100644 --- a/lib/chef/provider.rb +++ b/lib/chef/provider.rb @@ -23,7 +23,7 @@ require_relative "mixin/enforce_ownership_and_permissions" require_relative "mixin/why_run" require_relative "mixin/shell_out" require_relative "mixin/provides" -require_relative "dsl/core" +require_relative "dsl/recipe" require_relative "platform/service_helpers" require_relative "node_map" require "forwardable" unless defined?(Forwardable) @@ -44,8 +44,7 @@ class Chef extend Chef::Mixin::Provides extend Forwardable - # includes the "core" DSL and not the "recipe" DSL by design - include Chef::DSL::Core + include Chef::DSL::Recipe # the class only gets the Universal DSL (no resource_collection at class parsing time) extend Chef::DSL::Universal diff --git a/lib/chef/resource/action_class.rb b/lib/chef/resource/action_class.rb index 5e9e26b02d..1b4ddd453b 100644 --- a/lib/chef/resource/action_class.rb +++ b/lib/chef/resource/action_class.rb @@ -1,6 +1,6 @@ # # Author:: John Keiser (<jkeiser@chef.io) -# Copyright:: Copyright 2015-2019, Chef Software Inc. +# Copyright:: Copyright 2015-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); |