compat_resource 12.5.9 → 12.5.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 76949ff44732b75fb7e04e74c65181774f17fabf
4
- data.tar.gz: 04db25250587278316439ba74da269af6df1e7e3
3
+ metadata.gz: 0fa16b436f408af71be67cea805e6efe50489f91
4
+ data.tar.gz: d9d1497a1f8053979e585cd1058b7d536dc93e65
5
5
  SHA512:
6
- metadata.gz: a01c8f143411741c1f6121463ebb53656b104f99985fbb78929de625be3f7e875525c921c0db8bb685c291edbf432639ddac6db51fa4c678500446f43ee9839e
7
- data.tar.gz: 3f07e13505ffd1f4ba1350c14966b8ce037de5c75ae59777c248c737913284a049ae7bd757ce97499c245d7fd6e9eed03393132d834f3085bdabc5120c6316c0
6
+ metadata.gz: f29ddaf1dfee4d494888d4afd987696ecb393bd18d371049e71ae1b398292da6708c49d41b9a35e6084b2b734d6fff44c996393755cbe0dca90c1a2563262ec5
7
+ data.tar.gz: f4747ca15c2b9ff2ca15e867f61168974657df45af2b2c7b625f90b70904e657e35d2746aeab9bf215ad776c9bbd515f67cf875d00f7e1c53e61a3b8e3a9d0a9
data/README.md CHANGED
@@ -6,6 +6,45 @@
6
6
 
7
7
  This cookbook brings the custom resource syntax from Chef 12.5 to earlier Chef 12.X releases.
8
8
 
9
+ ## Converting cookbooks from the old resource model to the new
10
+
11
+ ### Boilerplate
12
+
13
+ 1. Depend on compat_resource
14
+ - Descend resources from ChefCompat::Resource
15
+ - Set resource_name in the class instead of the constructor
16
+ 2. Convert Attributes to Properties
17
+ - Rename attribute -> property
18
+ - Move set_or_return -> property
19
+ - Take kind_of/equal_to/regexes and make them types
20
+ - Use true/false/nil instead of TrueClass/FalseClass/NilClass
21
+ - Remove default: nil (it's the default)
22
+ 3. Convert Top-Level Providers to Actions
23
+ - Create any resources that don't already exist (for example in
24
+ multi-provider cases) and descend from the base resource
25
+ - Remove allowed_actions / @actions
26
+ - @action -> default_action
27
+ - Move `provides` and `action :x` to the resource
28
+ - Remove use_inline_resources and def whyrun_safe?
29
+ - Move other methods to `action_class.class_eval do`
30
+
31
+ Now you have everything in a resource, are using properties, and have gotten rid
32
+ of a bunch of boilerplate. Of course, this is just getting it *moved*. Now you
33
+ can start to really use the new features. And if you're making resources for
34
+ the first time, congrats--you probably didn't have to do very much of this :)
35
+
36
+ ### Advanced Concepts
37
+
38
+ 1. Resource Inheritance
39
+ 2. Resources That Are Different On Each OS?
40
+ 3. Coercion: Handling User Input
41
+ 4. Lazy Defaults
42
+ 5. Using Load Current Resource
43
+ 6. Using Converge If Changed
44
+ 7. Defaults Are For Creation
45
+ 8. Shared types: using a type multiple places
46
+
47
+
9
48
 
10
49
  Requirements
11
50
  ------------
@@ -49,4 +88,4 @@ Unless required by applicable law or agreed to in writing, software
49
88
  distributed under the License is distributed on an "AS IS" BASIS,
50
89
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
51
90
  See the License for the specific language governing permissions and
52
- limitations under the License.
91
+ limitations under the License.
@@ -14,5 +14,22 @@ class Chef::Provider
14
14
  include Chef::DSL::PlatformIntrospection
15
15
  include Chef::DSL::DataQuery
16
16
  include Chef::DSL::IncludeRecipe
17
+
18
+ module ::ChefCompat
19
+ module Monkeypatches
20
+ module InlineResources
21
+ module ClassMethods
22
+ def action(name, &block)
23
+ super(name) { send("compile_action_#{name}") }
24
+ # We put the action in its own method so that super() works.
25
+ define_method("compile_action_#{name}", &block)
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ module ClassMethods
32
+ prepend ChefCompat::Monkeypatches::InlineResources::ClassMethods
33
+ end
17
34
  end
18
35
  end
@@ -1,3 +1,3 @@
1
1
  module ChefCompat
2
- VERSION = '12.5.9' if !defined?(VERSION)
2
+ VERSION = '12.5.10' if !defined?(VERSION)
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: compat_resource
3
3
  version: !ruby/object:Gem::Version
4
- version: 12.5.9
4
+ version: 12.5.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Keiser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-12 00:00:00.000000000 Z
11
+ date: 2015-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake