compat_resource 12.5.15 → 12.5.16

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: f6db2428a9f97eb486526016e223b22e7d9aeb90
4
- data.tar.gz: a68c64f80db32ae72d7e8ab455714696930fed20
3
+ metadata.gz: ddf050dc8fb238c52f37f1c06e6a2ea64e6493a5
4
+ data.tar.gz: d21c2b0fef0a359ebc8fc73741f75dadfbd09d62
5
5
  SHA512:
6
- metadata.gz: 2192e789fc249938436c3c2e21de729794d4340bf62e11ee0a500b32b69b8820f5d40d7ed54462d834a8f786c396cdc45c0624954b433c7c07dc744871e00e04
7
- data.tar.gz: 8deb65e3e46dda8f5dab098a79930a30e9cd62456863bc83639449c3d5106bbc02ca90162f9f7d18da703a22c4f22dceed22a7f89fda3a7fabd86a75ba11ce25
6
+ metadata.gz: cf527c7f4d1517a875faea9a0c1099de51f07d66c91f42f862777c4a21bb264dc32f88471fcd41ae79019347644b1e7ab9ca03f2be259545078314def84ff20a
7
+ data.tar.gz: cd579dfb6b9911995ce2082f6299f5d60602f7339b004de9bfeaf96195796ccb82bc085462afcfa2076137158674ab2fb94d925e3cdf4d4f5b03ae7d3d2617dd
data/Rakefile CHANGED
@@ -166,14 +166,7 @@ task :update do
166
166
  line = "#{indent}#{type}#{space}#{class_name} < (defined?(#{original_class}) ? #{original_class} : #{superclass_name})"
167
167
  else
168
168
  # Modules have a harder time of it because of self methods
169
- line += <<-EOM
170
- #{indent} if defined?(#{original_class})
171
- #{indent} include #{original_class}
172
- #{indent} @delegates_to = #{original_class}
173
- #{indent} require 'chef_compat/delegating_class'
174
- #{indent} extend DelegatingClass
175
- #{indent} end
176
- EOM
169
+ line += "#{indent} CopiedFromChef.extend_chef_module(#{original_class}, self) if defined?(#{original_class})"
177
170
  end
178
171
 
179
172
  # If we're not in a class we care about, don't print stuff
@@ -1,6 +1,19 @@
1
1
  module ChefCompat
2
2
  module CopiedFromChef
3
- # This patch to ActionClass is necessary for the include to work
3
+ def self.extend_chef_module(chef_module, target)
4
+ target.instance_eval do
5
+ include chef_module
6
+ @chef_module = chef_module
7
+ def self.method_missing(name, *args, &block)
8
+ @chef_module.send(name, *args, &block)
9
+ end
10
+ def self.const_missing(name)
11
+ @chef_module.const_get(name)
12
+ end
13
+ end
14
+ end
15
+
16
+ # This patch to CopiedFromChef's ActionClass is necessary for the include to work
4
17
  require 'chef/resource'
5
18
  class Chef < ::Chef
6
19
  class Resource < ::Chef::Resource
@@ -24,19 +24,9 @@ module CopiedFromChef
24
24
 
25
25
  class Chef < (defined?(::Chef) ? ::Chef : Object)
26
26
  module DSL
27
- if defined?(::Chef::DSL)
28
- include ::Chef::DSL
29
- @delegates_to = ::Chef::DSL
30
- require 'chef_compat/delegating_class'
31
- extend DelegatingClass
32
- end
27
+ CopiedFromChef.extend_chef_module(::Chef::DSL, self) if defined?(::Chef::DSL)
33
28
  module DeclareResource
34
- if defined?(::Chef::DSL::DeclareResource)
35
- include ::Chef::DSL::DeclareResource
36
- @delegates_to = ::Chef::DSL::DeclareResource
37
- require 'chef_compat/delegating_class'
38
- extend DelegatingClass
39
- end
29
+ CopiedFromChef.extend_chef_module(::Chef::DSL::DeclareResource, self) if defined?(::Chef::DSL::DeclareResource)
40
30
 
41
31
  #
42
32
  # Instantiates a resource (via #build_resource), then adds it to the
@@ -5,27 +5,12 @@ module CopiedFromChef
5
5
  require 'chef_compat/copied_from_chef/chef/dsl/declare_resource'
6
6
  class Chef < (defined?(::Chef) ? ::Chef : Object)
7
7
  module DSL
8
- if defined?(::Chef::DSL)
9
- include ::Chef::DSL
10
- @delegates_to = ::Chef::DSL
11
- require 'chef_compat/delegating_class'
12
- extend DelegatingClass
13
- end
8
+ CopiedFromChef.extend_chef_module(::Chef::DSL, self) if defined?(::Chef::DSL)
14
9
  module Recipe
15
- if defined?(::Chef::DSL::Recipe)
16
- include ::Chef::DSL::Recipe
17
- @delegates_to = ::Chef::DSL::Recipe
18
- require 'chef_compat/delegating_class'
19
- extend DelegatingClass
20
- end
10
+ CopiedFromChef.extend_chef_module(::Chef::DSL::Recipe, self) if defined?(::Chef::DSL::Recipe)
21
11
  include Chef::DSL::DeclareResource
22
12
  module FullDSL
23
- if defined?(::Chef::DSL::Recipe::FullDSL)
24
- include ::Chef::DSL::Recipe::FullDSL
25
- @delegates_to = ::Chef::DSL::Recipe::FullDSL
26
- require 'chef_compat/delegating_class'
27
- extend DelegatingClass
28
- end
13
+ CopiedFromChef.extend_chef_module(::Chef::DSL::Recipe::FullDSL, self) if defined?(::Chef::DSL::Recipe::FullDSL)
29
14
  include Chef::DSL::Recipe
30
15
  end
31
16
  end
@@ -25,19 +25,9 @@ require 'chef_compat/copied_from_chef/chef/delayed_evaluator'
25
25
 
26
26
  class Chef < (defined?(::Chef) ? ::Chef : Object)
27
27
  module Mixin
28
- if defined?(::Chef::Mixin)
29
- include ::Chef::Mixin
30
- @delegates_to = ::Chef::Mixin
31
- require 'chef_compat/delegating_class'
32
- extend DelegatingClass
33
- end
28
+ CopiedFromChef.extend_chef_module(::Chef::Mixin, self) if defined?(::Chef::Mixin)
34
29
  module ParamsValidate
35
- if defined?(::Chef::Mixin::ParamsValidate)
36
- include ::Chef::Mixin::ParamsValidate
37
- @delegates_to = ::Chef::Mixin::ParamsValidate
38
- require 'chef_compat/delegating_class'
39
- extend DelegatingClass
40
- end
30
+ CopiedFromChef.extend_chef_module(::Chef::Mixin::ParamsValidate, self) if defined?(::Chef::Mixin::ParamsValidate)
41
31
 
42
32
  # Takes a hash of options, along with a map to validate them. Returns the original
43
33
  # options hash, plus any changes that might have been made (through things like setting
@@ -8,26 +8,11 @@ require 'chef_compat/copied_from_chef/chef/property'
8
8
 
9
9
  class Chef < (defined?(::Chef) ? ::Chef : Object)
10
10
  module Mixin
11
- if defined?(::Chef::Mixin)
12
- include ::Chef::Mixin
13
- @delegates_to = ::Chef::Mixin
14
- require 'chef_compat/delegating_class'
15
- extend DelegatingClass
16
- end
11
+ CopiedFromChef.extend_chef_module(::Chef::Mixin, self) if defined?(::Chef::Mixin)
17
12
  module Properties
18
- if defined?(::Chef::Mixin::Properties)
19
- include ::Chef::Mixin::Properties
20
- @delegates_to = ::Chef::Mixin::Properties
21
- require 'chef_compat/delegating_class'
22
- extend DelegatingClass
23
- end
13
+ CopiedFromChef.extend_chef_module(::Chef::Mixin::Properties, self) if defined?(::Chef::Mixin::Properties)
24
14
  module ClassMethods
25
- if defined?(::Chef::Mixin::Properties::ClassMethods)
26
- include ::Chef::Mixin::Properties::ClassMethods
27
- @delegates_to = ::Chef::Mixin::Properties::ClassMethods
28
- require 'chef_compat/delegating_class'
29
- extend DelegatingClass
30
- end
15
+ CopiedFromChef.extend_chef_module(::Chef::Mixin::Properties::ClassMethods, self) if defined?(::Chef::Mixin::Properties::ClassMethods)
31
16
  #
32
17
  # The list of properties defined on this resource.
33
18
  #
@@ -111,12 +111,7 @@ super if defined?(::Chef::Provider)
111
111
  include InlineResources
112
112
  end
113
113
  module InlineResources
114
- if defined?(::Chef::Provider::InlineResources)
115
- include ::Chef::Provider::InlineResources
116
- @delegates_to = ::Chef::Provider::InlineResources
117
- require 'chef_compat/delegating_class'
118
- extend DelegatingClass
119
- end
114
+ CopiedFromChef.extend_chef_module(::Chef::Provider::InlineResources, self) if defined?(::Chef::Provider::InlineResources)
120
115
  def compile_and_converge_action(&block)
121
116
  old_run_context = run_context
122
117
  @run_context = run_context.create_child
@@ -130,12 +125,7 @@ super if defined?(::Chef::Provider)
130
125
  @run_context = old_run_context
131
126
  end
132
127
  module ClassMethods
133
- if defined?(::Chef::Provider::InlineResources::ClassMethods)
134
- include ::Chef::Provider::InlineResources::ClassMethods
135
- @delegates_to = ::Chef::Provider::InlineResources::ClassMethods
136
- require 'chef_compat/delegating_class'
137
- extend DelegatingClass
138
- end
128
+ CopiedFromChef.extend_chef_module(::Chef::Provider::InlineResources::ClassMethods, self) if defined?(::Chef::Provider::InlineResources::ClassMethods)
139
129
  def action(name, &block)
140
130
  # We need the block directly in a method so that `super` works
141
131
  define_method("compile_action_#{name}", &block)
@@ -24,12 +24,7 @@ module CopiedFromChef
24
24
  class Chef < (defined?(::Chef) ? ::Chef : Object)
25
25
  class Resource < (defined?(::Chef::Resource) ? ::Chef::Resource : Object)
26
26
  module ActionClass
27
- if defined?(::Chef::Resource::ActionClass)
28
- include ::Chef::Resource::ActionClass
29
- @delegates_to = ::Chef::Resource::ActionClass
30
- require 'chef_compat/delegating_class'
31
- extend DelegatingClass
32
- end
27
+ CopiedFromChef.extend_chef_module(::Chef::Resource::ActionClass, self) if defined?(::Chef::Resource::ActionClass)
33
28
  #
34
29
  # If load_current_value! is defined on the resource, use that.
35
30
  #
@@ -72,12 +67,7 @@ class Chef < (defined?(::Chef) ? ::Chef : Object)
72
67
  end
73
68
 
74
69
  module ClassMethods
75
- if defined?(::Chef::Resource::ActionClass::ClassMethods)
76
- include ::Chef::Resource::ActionClass::ClassMethods
77
- @delegates_to = ::Chef::Resource::ActionClass::ClassMethods
78
- require 'chef_compat/delegating_class'
79
- extend DelegatingClass
80
- end
70
+ CopiedFromChef.extend_chef_module(::Chef::Resource::ActionClass::ClassMethods, self) if defined?(::Chef::Resource::ActionClass::ClassMethods)
81
71
  #
82
72
  # The Chef::Resource class this ActionClass was declared against.
83
73
  #
@@ -1,3 +1,3 @@
1
1
  module ChefCompat
2
- VERSION = '12.5.15' if !defined?(VERSION)
2
+ VERSION = '12.5.16' 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.15
4
+ version: 12.5.16
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-12-08 00:00:00.000000000 Z
11
+ date: 2015-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -104,7 +104,6 @@ files:
104
104
  - files/lib/chef_compat/copied_from_chef/chef/resource.rb
105
105
  - files/lib/chef_compat/copied_from_chef/chef/resource/action_class.rb
106
106
  - files/lib/chef_compat/copied_from_chef/chef/resource_builder.rb
107
- - files/lib/chef_compat/delegating_class.rb
108
107
  - files/lib/chef_compat/mixin/properties.rb
109
108
  - files/lib/chef_compat/monkeypatches.rb
110
109
  - files/lib/chef_compat/monkeypatches/chef.rb
@@ -1,10 +0,0 @@
1
- module ChefCompat
2
- module DelegatingClass
3
- def method_missing(name, *args, &block)
4
- @delegates_to.send(name, *args, &block)
5
- end
6
- def const_missing(name)
7
- @delegates_to.const_get(name)
8
- end
9
- end
10
- end