compat_resource 12.5.16 → 12.5.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/{files → Users/jkeiser/src/cookbooks/compat_resource/files}/lib/chef_compat/copied_from_chef.rb +0 -0
  3. data/{files → Users/jkeiser/src/cookbooks/compat_resource/files}/lib/chef_compat/copied_from_chef/chef/constants.rb +0 -0
  4. data/{files → Users/jkeiser/src/cookbooks/compat_resource/files}/lib/chef_compat/copied_from_chef/chef/delayed_evaluator.rb +0 -0
  5. data/{files → Users/jkeiser/src/cookbooks/compat_resource/files}/lib/chef_compat/copied_from_chef/chef/dsl/declare_resource.rb +0 -0
  6. data/{files → Users/jkeiser/src/cookbooks/compat_resource/files}/lib/chef_compat/copied_from_chef/chef/dsl/recipe.rb +0 -0
  7. data/{files → Users/jkeiser/src/cookbooks/compat_resource/files}/lib/chef_compat/copied_from_chef/chef/mixin/params_validate.rb +0 -0
  8. data/{files → Users/jkeiser/src/cookbooks/compat_resource/files}/lib/chef_compat/copied_from_chef/chef/mixin/properties.rb +0 -0
  9. data/{files → Users/jkeiser/src/cookbooks/compat_resource/files}/lib/chef_compat/copied_from_chef/chef/property.rb +0 -0
  10. data/{files → Users/jkeiser/src/cookbooks/compat_resource/files}/lib/chef_compat/copied_from_chef/chef/provider.rb +0 -0
  11. data/{files → Users/jkeiser/src/cookbooks/compat_resource/files}/lib/chef_compat/copied_from_chef/chef/resource.rb +0 -0
  12. data/{files → Users/jkeiser/src/cookbooks/compat_resource/files}/lib/chef_compat/copied_from_chef/chef/resource/action_class.rb +0 -0
  13. data/{files → Users/jkeiser/src/cookbooks/compat_resource/files}/lib/chef_compat/copied_from_chef/chef/resource_builder.rb +0 -0
  14. data/{files → Users/jkeiser/src/cookbooks/compat_resource/files}/lib/chef_compat/mixin/properties.rb +0 -0
  15. data/{files → Users/jkeiser/src/cookbooks/compat_resource/files}/lib/chef_compat/monkeypatches.rb +0 -0
  16. data/{files → Users/jkeiser/src/cookbooks/compat_resource/files}/lib/chef_compat/monkeypatches/chef.rb +0 -0
  17. data/{files → Users/jkeiser/src/cookbooks/compat_resource/files}/lib/chef_compat/monkeypatches/chef/exceptions.rb +0 -0
  18. data/{files → Users/jkeiser/src/cookbooks/compat_resource/files}/lib/chef_compat/monkeypatches/chef/provider.rb +0 -0
  19. data/{files → Users/jkeiser/src/cookbooks/compat_resource/files}/lib/chef_compat/monkeypatches/chef/recipe.rb +0 -0
  20. data/{files → Users/jkeiser/src/cookbooks/compat_resource/files}/lib/chef_compat/monkeypatches/chef/resource.rb +0 -0
  21. data/{files → Users/jkeiser/src/cookbooks/compat_resource/files}/lib/chef_compat/monkeypatches/chef/resource/lwrp_base.rb +0 -0
  22. data/{files → Users/jkeiser/src/cookbooks/compat_resource/files}/lib/chef_compat/monkeypatches/chef/run_context.rb +0 -0
  23. data/{files → Users/jkeiser/src/cookbooks/compat_resource/files}/lib/chef_compat/property.rb +0 -0
  24. data/{files → Users/jkeiser/src/cookbooks/compat_resource/files}/lib/chef_compat/recipe.rb +0 -0
  25. data/{files → Users/jkeiser/src/cookbooks/compat_resource/files}/lib/chef_compat/resource.rb +0 -0
  26. data/{files → Users/jkeiser/src/cookbooks/compat_resource/files}/lib/chef_compat/resource/lwrp_base.rb +0 -0
  27. data/{files/lib/chef_compat.rb → Users/jkeiser/src/cookbooks/compat_resource/files/lib/compat_resource.rb} +2 -5
  28. data/Users/jkeiser/src/cookbooks/compat_resource/files/lib/compat_resource/gemspec.rb +33 -0
  29. data/Users/jkeiser/src/cookbooks/compat_resource/files/lib/compat_resource/version.rb +3 -0
  30. data/Users/jkeiser/src/cookbooks/compat_resource/files/spec/cookbook_spec.rb +71 -0
  31. data/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/Gemfile +5 -0
  32. data/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/Gemfile.lock +125 -0
  33. data/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/config.rb +2 -0
  34. data/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/cookbooks/future/libraries/future_custom_resource.rb +8 -0
  35. data/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/cookbooks/future/libraries/super_properties.rb +8 -0
  36. data/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/cookbooks/future/metadata.rb +4 -0
  37. data/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/cookbooks/future/recipes/declare_resource.rb +3 -0
  38. data/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/cookbooks/future/resources/resource.rb +54 -0
  39. data/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/cookbooks/future/resources/super_resource.rb +7 -0
  40. data/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/cookbooks/hybrid/libraries/normal_hwrp.rb +24 -0
  41. data/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/cookbooks/hybrid/metadata.rb +4 -0
  42. data/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/cookbooks/hybrid/providers/resource.rb +4 -0
  43. data/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/cookbooks/hybrid/resources/resource.rb +5 -0
  44. data/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/cookbooks/normal/libraries/normal_hwrp.rb +24 -0
  45. data/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/cookbooks/normal/metadata.rb +3 -0
  46. data/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/cookbooks/normal/providers/resource.rb +6 -0
  47. data/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/cookbooks/normal/recipes/declare_resource.rb +3 -0
  48. data/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/cookbooks/normal/resources/resource.rb +4 -0
  49. data/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/cookbooks/test/metadata.rb +6 -0
  50. data/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/cookbooks/test/recipes/default.rb +13 -0
  51. data/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/cookbooks/test/recipes/test.rb +41 -0
  52. data/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/nodes/ettores-mbp.lan.json +3 -0
  53. data/Users/jkeiser/src/cookbooks/compat_resource/files/spec/spec_helper.rb +10 -0
  54. metadata +55 -30
  55. data/files/lib/chef_compat/version.rb +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ddf050dc8fb238c52f37f1c06e6a2ea64e6493a5
4
- data.tar.gz: d21c2b0fef0a359ebc8fc73741f75dadfbd09d62
3
+ metadata.gz: fd7d77cbb7b769939244e86b283daf3d5dd7448d
4
+ data.tar.gz: 9f11b1e58931a2acb07ef1155c71d6f862aba044
5
5
  SHA512:
6
- metadata.gz: cf527c7f4d1517a875faea9a0c1099de51f07d66c91f42f862777c4a21bb264dc32f88471fcd41ae79019347644b1e7ab9ca03f2be259545078314def84ff20a
7
- data.tar.gz: cd579dfb6b9911995ce2082f6299f5d60602f7339b004de9bfeaf96195796ccb82bc085462afcfa2076137158674ab2fb94d925e3cdf4d4f5b03ae7d3d2617dd
6
+ metadata.gz: 48ee7ceb7d1aa50e8b2b4cfc00a695f83649c231ff775accf986002b32f87549d237c0615c09b3b7fd403750757565332850da53323d38ce843960abf6e89a3f
7
+ data.tar.gz: af8d70ab20a3a72753a3b5061188ea301e7c1a74cb5328eee466a3aeb61394fa8cf2af823f6691076a851799d030090317b436c79b50ca9fcf0698546de98c05
@@ -1,14 +1,11 @@
1
-
2
1
  if Gem::Requirement.new(">= 12.0").satisfied_by?(Gem::Version.new(Chef::VERSION))
3
2
 
4
- require 'chef_compat/version'
3
+ require 'compat_resource/version'
4
+ require 'compat_resource/gemspec'
5
5
  require 'chef_compat/resource'
6
6
  require 'chef_compat/property'
7
7
  require 'chef_compat/mixin/properties'
8
8
 
9
- module ChefCompat
10
- end
11
-
12
9
  else
13
10
 
14
11
  class Chef
@@ -0,0 +1,33 @@
1
+ if defined?(CompatResource::GEMSPEC)
2
+ raise "Already loaded ChefCompat from #{CompatResource::GEMSPEC.require_path}/compat_resource/gemspec.rb. Cannot load a second time from #{__FILE__}"
3
+ end
4
+
5
+ require_relative 'version'
6
+
7
+ module CompatResource
8
+ GEMSPEC = Gem::Specification.new do |s|
9
+ # Gem path is cookbook root
10
+ s.full_gem_path = File.expand_path('../../../..', __FILE__)
11
+ s.name = "compat_resource"
12
+ s.version = CompatResource::VERSION
13
+ s.platform = Gem::Platform::RUBY
14
+ s.summary = 'Bring some new features of Chef 12.5 to previous 12.X releases'
15
+ s.description = s.summary
16
+ s.author = 'John Keiser'
17
+ s.email = 'john@johnkeiser.com'
18
+ s.homepage = 'http://chef.io'
19
+ s.license = 'Apache 2.0'
20
+
21
+ s.add_development_dependency 'rake'
22
+ s.add_development_dependency 'rspec'
23
+ s.add_development_dependency 'cheffish'
24
+ s.add_development_dependency 'stove'
25
+ s.add_development_dependency 'chef'
26
+
27
+ s.bindir = "files/bin"
28
+ s.executables = []
29
+ s.require_path = "files/lib"
30
+ s.files = %w(LICENSE README.md CHANGELOG.md Gemfile Rakefile) +
31
+ Dir.glob("#{s.full_gem_path}/files/{lib,spec}/**/*", File::FNM_DOTMATCH).reject {|f| File.directory?(f) }
32
+ end
33
+ end
@@ -0,0 +1,3 @@
1
+ module CompatResource
2
+ VERSION = '12.5.18'
3
+ end
@@ -0,0 +1,71 @@
1
+ require 'tmpdir'
2
+ require 'chef/version'
3
+
4
+ describe "compat_resource cookbook" do
5
+ let(:chef_repo_path) { Dir.mktmpdir }
6
+ let(:cookbooks_path) { path = File.join(chef_repo_path, 'cookbooks'); Dir.mkdir(path); path }
7
+ before do
8
+ File.symlink(File.expand_path('../data/config.rb', __FILE__),
9
+ File.join(chef_repo_path, 'config.rb'))
10
+ File.symlink(File.expand_path('../../..', __FILE__),
11
+ File.join(cookbooks_path, 'compat_resource'))
12
+ File.symlink(File.expand_path('../data/cookbooks/test', __FILE__),
13
+ File.join(cookbooks_path, 'test'))
14
+ File.symlink(File.expand_path('../data/cookbooks/future', __FILE__),
15
+ File.join(cookbooks_path, 'future'))
16
+ File.symlink(File.expand_path('../data/cookbooks/normal', __FILE__),
17
+ File.join(cookbooks_path, 'normal'))
18
+ File.symlink(File.expand_path('../data/cookbooks/hybrid', __FILE__),
19
+ File.join(cookbooks_path, 'hybrid'))
20
+ end
21
+
22
+ require 'chef/mixin/shell_out'
23
+ include Chef::Mixin::ShellOut
24
+ before :all do
25
+ Bundler.with_clean_env do
26
+ shell_out!("bundle install --gemfile #{File.expand_path('../data/Gemfile', __FILE__)}")
27
+ end
28
+ end
29
+
30
+ def run_chef(args)
31
+ Bundler.with_clean_env do
32
+ shell_out!("bundle exec chef-client -c #{File.join(chef_repo_path, 'config.rb')} -F doc #{args}",
33
+ environment: { 'BUNDLE_GEMFILE' => File.expand_path('../data/Gemfile', __FILE__) })
34
+ end
35
+ end
36
+
37
+ it "when chef-client runs the test recipe, it succeeds" do
38
+ result = run_chef("-o test::test,test")
39
+ puts result.stdout
40
+ puts result.stderr
41
+ # expect(result.stdout).to match(/
42
+ # Recipe: test::test
43
+ # \* future_resource\[sets neither x nor y\] action create \(up to date\)
44
+ # \* future_resource\[sets both x and y\] action create
45
+ # - update sets both x and y
46
+ # - set x to "hi" \(was "initial_x"\)
47
+ # - set y to 10 \(was 2\)
48
+ # \* future_resource\[sets neither x nor y explicitly\] action create \(up to date\)
49
+ # \* future_resource\[sets only y\] action create
50
+ # - update sets only y
51
+ # - set y to 20 (was 10)
52
+ # \* future_resource\[deletes resource\] action delete \(up to date\)
53
+ # \* future_resource\[sets x and y via creation\] action create
54
+ # - create sets x and y via creation
55
+ # - set x to "hi"
56
+ # - set y to 20
57
+ # \* future_resource\[deletes resource again\] action delete \(up to date\)
58
+ # \* future_resource\[sets x and y to their defaults via creation\] action create
59
+ # - create sets x and y to their defaults via creation
60
+ # - set x to "16" \(default value\)
61
+ # - set y to 4 \(default value\)
62
+ # /)
63
+ end
64
+ if Chef::VERSION.to_f <= 12.5
65
+ it "when chef-client tries to declare_resource with extra parameters, it fails" do
66
+ expect {
67
+ run_chef("-o normal::declare_resource")
68
+ }.to raise_error(Mixlib::ShellOut::ShellCommandFailed)
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,5 @@
1
+ if ENV['GEMFILE_MOD']
2
+ instance_eval(ENV['GEMFILE_MOD'])
3
+ else
4
+ gem 'chef'
5
+ end
@@ -0,0 +1,125 @@
1
+ GEM
2
+ specs:
3
+ builder (3.2.2)
4
+ chef (12.5.1)
5
+ chef-config (= 12.5.1)
6
+ chef-zero (~> 4.2, >= 4.2.2)
7
+ diff-lcs (~> 1.2, >= 1.2.4)
8
+ erubis (~> 2.7)
9
+ ffi-yajl (~> 2.2)
10
+ highline (~> 1.6, >= 1.6.9)
11
+ mixlib-authentication (~> 1.3)
12
+ mixlib-cli (~> 1.4)
13
+ mixlib-log (~> 1.3)
14
+ mixlib-shellout (~> 2.0)
15
+ net-ssh (~> 2.6)
16
+ net-ssh-multi (~> 1.1)
17
+ ohai (>= 8.6.0.alpha.1, < 9)
18
+ plist (~> 3.1.0)
19
+ pry (~> 0.9)
20
+ rspec-core (~> 3.2)
21
+ rspec-expectations (~> 3.2)
22
+ rspec-mocks (~> 3.2)
23
+ rspec_junit_formatter (~> 0.2.0)
24
+ serverspec (~> 2.7)
25
+ specinfra (~> 2.10)
26
+ syslog-logger (~> 1.6)
27
+ chef-config (12.5.1)
28
+ mixlib-config (~> 2.0)
29
+ mixlib-shellout (~> 2.0)
30
+ chef-zero (4.3.2)
31
+ ffi-yajl (~> 2.2)
32
+ hashie (>= 2.0, < 4.0)
33
+ mixlib-log (~> 1.3)
34
+ rack
35
+ uuidtools (~> 2.1)
36
+ coderay (1.1.0)
37
+ diff-lcs (1.2.5)
38
+ erubis (2.7.0)
39
+ ffi (1.9.10)
40
+ ffi-yajl (2.2.2)
41
+ libyajl2 (~> 1.2)
42
+ hashie (3.4.3)
43
+ highline (1.7.8)
44
+ ipaddress (0.8.0)
45
+ libyajl2 (1.2.0)
46
+ method_source (0.8.2)
47
+ mixlib-authentication (1.3.0)
48
+ mixlib-log
49
+ mixlib-cli (1.5.0)
50
+ mixlib-config (2.2.1)
51
+ mixlib-log (1.6.0)
52
+ mixlib-shellout (2.2.5)
53
+ multi_json (1.11.2)
54
+ net-scp (1.2.1)
55
+ net-ssh (>= 2.6.5)
56
+ net-ssh (2.9.2)
57
+ net-ssh-gateway (1.2.0)
58
+ net-ssh (>= 2.6.5)
59
+ net-ssh-multi (1.2.1)
60
+ net-ssh (>= 2.6.5)
61
+ net-ssh-gateway (>= 1.2.0)
62
+ net-telnet (0.1.1)
63
+ ohai (8.8.1)
64
+ chef-config (>= 12.5.0.alpha.1, < 13)
65
+ ffi (~> 1.9)
66
+ ffi-yajl (~> 2.2)
67
+ ipaddress
68
+ mixlib-cli
69
+ mixlib-config (~> 2.0)
70
+ mixlib-log
71
+ mixlib-shellout (~> 2.0)
72
+ rake (~> 10.1)
73
+ systemu (~> 2.6.4)
74
+ wmi-lite (~> 1.0)
75
+ plist (3.1.0)
76
+ pry (0.10.3)
77
+ coderay (~> 1.1.0)
78
+ method_source (~> 0.8.1)
79
+ slop (~> 3.4)
80
+ rack (1.6.4)
81
+ rake (10.4.2)
82
+ rspec (3.4.0)
83
+ rspec-core (~> 3.4.0)
84
+ rspec-expectations (~> 3.4.0)
85
+ rspec-mocks (~> 3.4.0)
86
+ rspec-core (3.4.1)
87
+ rspec-support (~> 3.4.0)
88
+ rspec-expectations (3.4.0)
89
+ diff-lcs (>= 1.2.0, < 2.0)
90
+ rspec-support (~> 3.4.0)
91
+ rspec-its (1.2.0)
92
+ rspec-core (>= 3.0.0)
93
+ rspec-expectations (>= 3.0.0)
94
+ rspec-mocks (3.4.0)
95
+ diff-lcs (>= 1.2.0, < 2.0)
96
+ rspec-support (~> 3.4.0)
97
+ rspec-support (3.4.1)
98
+ rspec_junit_formatter (0.2.3)
99
+ builder (< 4)
100
+ rspec-core (>= 2, < 4, != 2.12.0)
101
+ serverspec (2.24.3)
102
+ multi_json
103
+ rspec (~> 3.0)
104
+ rspec-its
105
+ specinfra (~> 2.43)
106
+ sfl (2.2)
107
+ slop (3.6.0)
108
+ specinfra (2.44.7)
109
+ net-scp
110
+ net-ssh (~> 2.7)
111
+ net-telnet
112
+ sfl
113
+ syslog-logger (1.6.8)
114
+ systemu (2.6.5)
115
+ uuidtools (2.1.5)
116
+ wmi-lite (1.0.0)
117
+
118
+ PLATFORMS
119
+ ruby
120
+
121
+ DEPENDENCIES
122
+ chef
123
+
124
+ BUNDLED WITH
125
+ 1.10.6
@@ -0,0 +1,2 @@
1
+ local_mode true
2
+ chef_repo_path File.dirname(__FILE__)
@@ -0,0 +1,8 @@
1
+ class FutureCustomResource < ChefCompat::Resource
2
+ resource_name :future_custom_resource
3
+ property :x
4
+ action :create do
5
+ converge_if_changed do
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module FutureCookbook
2
+ module SuperProperties
3
+ include ChefCompat::Mixin::Properties
4
+
5
+ property :x, default: 10
6
+ property :y, default: 20
7
+ end
8
+ end
@@ -0,0 +1,4 @@
1
+ name "future"
2
+ description "cookbook that depends on compat_resource"
3
+ version "1.0.0"
4
+ depends "compat_resource"
@@ -0,0 +1,3 @@
1
+ declare_resource(:ruby_block, 'y', caller[0], create_if_missing: true) do
2
+ block { puts 'hi' }
3
+ end
@@ -0,0 +1,54 @@
1
+ # Make sure and emit a property that triggers deprecation
2
+ property :n, name_property: true, default: 5
3
+ property :x, String, coerce: proc { |x| x.to_s }, default: lazy { y*y }
4
+ property :y, Integer, default: 4
5
+
6
+ class ::Globals
7
+ @@exists = true
8
+ def self.exists
9
+ @@exists
10
+ end
11
+ def self.exists=(value)
12
+ @@exists = value
13
+ end
14
+
15
+ @@global_x = 'initial_x'
16
+ def self.global_x
17
+ @@global_x
18
+ end
19
+ def self.global_x=(value)
20
+ @@global_x = value
21
+ end
22
+
23
+ @@global_y = 2
24
+ def self.global_y
25
+ @@global_y
26
+ end
27
+ def self.global_y=(value)
28
+ @@global_y = value
29
+ end
30
+ end
31
+
32
+ load_current_value do
33
+ current_value_does_not_exist! if !Globals.exists
34
+
35
+ x Globals.global_x
36
+ y Globals.global_y
37
+ end
38
+
39
+ action :create do
40
+ converge_if_changed do
41
+ Globals.exists = true
42
+ Globals.global_x = x
43
+ Globals.global_y = y
44
+ end
45
+ file ::File.expand_path('~/x.txt') do
46
+ content 'hi'
47
+ end
48
+ # return is how people exit from 12.5 actions. Test that it works across versions.
49
+ return
50
+ end
51
+
52
+ action :delete do
53
+ Globals.exists = false
54
+ end
@@ -0,0 +1,7 @@
1
+ include FutureCookbook::SuperProperties
2
+
3
+ action :create do
4
+ file ::File.expand_path('~/y.txt') do
5
+ content "#{x}#{y}"
6
+ end
7
+ end
@@ -0,0 +1,24 @@
1
+ class Chef::Resource::NormalHwrp < Chef::Resource
2
+ def initialize(*args)
3
+ super
4
+ @resource_name = :normal_hwrp
5
+ @allowed_actions = [ :create ]
6
+ @action = :create
7
+ end
8
+
9
+ provides :normal_hwrp
10
+
11
+ def x(arg=nil)
12
+ set_or_return(:x, arg, {})
13
+ end
14
+
15
+ end
16
+
17
+ class Chef::Provider::NormalHwrp < Chef::Resource
18
+ provides :normal_hwrp
19
+ def load_current_resource
20
+ end
21
+ def action_create
22
+ new_resource.updated_by_last_resource(true)
23
+ end
24
+ end
@@ -0,0 +1,4 @@
1
+ name "hybrid"
2
+ description "cookbook that depends on compat_resource, but has LWRPs"
3
+ version "1.0.0"
4
+ depends "compat_resource"
@@ -0,0 +1,4 @@
1
+ action :create do
2
+ converge_by "update!" do
3
+ end
4
+ end
@@ -0,0 +1,5 @@
1
+
2
+ actions :create
3
+ default_action :create
4
+
5
+ attribute :x, kind_of: [ String ], name_attribute: true
@@ -0,0 +1,24 @@
1
+ class Chef::Resource::NormalHwrp < Chef::Resource
2
+ def initialize(*args)
3
+ super
4
+ @resource_name = :normal_hwrp
5
+ @allowed_actions = [ :create ]
6
+ @action = :create
7
+ end
8
+
9
+ provides :normal_hwrp
10
+
11
+ def x(arg=nil)
12
+ set_or_return(:x, arg, {})
13
+ end
14
+
15
+ end
16
+
17
+ class Chef::Provider::NormalHwrp < Chef::Resource
18
+ provides :normal_hwrp
19
+ def load_current_resource
20
+ end
21
+ def action_create
22
+ new_resource.updated_by_last_resource(true)
23
+ end
24
+ end
@@ -0,0 +1,3 @@
1
+ name "normal"
2
+ description "cookbook that does not depend on compat_resource"
3
+ version "1.0.0"
@@ -0,0 +1,6 @@
1
+ action :create do
2
+ converge_by "update!" do
3
+ end
4
+ # next is how people generally exit from actions in traditional providers
5
+ next
6
+ end
@@ -0,0 +1,3 @@
1
+ declare_resource(:ruby_block, 'y', caller[0], create_if_missing: true) do
2
+ block { puts 'hi' }
3
+ end
@@ -0,0 +1,4 @@
1
+ actions :create
2
+ default_action :create
3
+
4
+ attribute :x, kind_of: [ String ], name_attribute: true
@@ -0,0 +1,6 @@
1
+ name "test"
2
+ description "le test cookbook"
3
+ version "1.0.0"
4
+ depends "normal"
5
+ depends "future"
6
+ # depends "hybrid"
@@ -0,0 +1,13 @@
1
+ normal_resource 'blah' do
2
+ x 'hi'
3
+ end
4
+ # normal_hwrp 'blah2' do
5
+ # x 'hi2'
6
+ # end
7
+ future_resource 'blah3' do
8
+ x 'hi3'
9
+ end
10
+ future_custom_resource 'blah4' do
11
+ x 'hi4'
12
+ end
13
+ include_recipe 'future::declare_resource'
@@ -0,0 +1,41 @@
1
+ future_resource 'sets neither x nor y' do
2
+ end
3
+
4
+ future_resource 'sets both x and y' do
5
+ x 'hi'
6
+ y 10
7
+ end
8
+
9
+ future_resource 'sets neither x nor y explicitly' do
10
+ x 'hi'
11
+ y 10
12
+ end
13
+
14
+ future_resource 'sets only y' do
15
+ y 20
16
+ end
17
+
18
+ future_resource 'deletes resource' do
19
+ action :delete
20
+ end
21
+
22
+ future_resource 'sets x and y via creation' do
23
+ x 'hi'
24
+ y 20
25
+ end
26
+
27
+ future_resource 'deletes resource again' do
28
+ action :delete
29
+ end
30
+
31
+ future_resource 'sets x and y to their defaults via creation' do
32
+ end
33
+
34
+ future_super_resource 'brings in its defaults' do
35
+ end
36
+ future_super_resource 'lets you set x and y' do
37
+ x 100
38
+ y 200
39
+ end
40
+
41
+ ChefCompat::CopiedFromChef::Chef.log_deprecation "hi there"
@@ -0,0 +1,10 @@
1
+ require 'cheffish/rspec'
2
+
3
+ RSpec.configure do |config|
4
+ config.filter_run :focus => true
5
+ config.run_all_when_everything_filtered = true
6
+
7
+ config.before :each do
8
+ Chef::Config.reset
9
+ end
10
+ 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.16
4
+ version: 12.5.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Keiser
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: files/bin
10
10
  cert_chain: []
11
- date: 2015-12-09 00:00:00.000000000 Z
11
+ date: 2015-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -86,38 +86,63 @@ executables: []
86
86
  extensions: []
87
87
  extra_rdoc_files: []
88
88
  files:
89
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef.rb"
90
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/constants.rb"
91
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/delayed_evaluator.rb"
92
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/dsl/declare_resource.rb"
93
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/dsl/recipe.rb"
94
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/mixin/params_validate.rb"
95
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/mixin/properties.rb"
96
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/property.rb"
97
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider.rb"
98
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource.rb"
99
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource/action_class.rb"
100
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource_builder.rb"
101
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/lib/chef_compat/mixin/properties.rb"
102
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches.rb"
103
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef.rb"
104
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/exceptions.rb"
105
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/provider.rb"
106
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/recipe.rb"
107
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/resource.rb"
108
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/resource/lwrp_base.rb"
109
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/run_context.rb"
110
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/lib/chef_compat/property.rb"
111
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/lib/chef_compat/recipe.rb"
112
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/lib/chef_compat/resource.rb"
113
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/lib/chef_compat/resource/lwrp_base.rb"
114
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/lib/compat_resource.rb"
115
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/lib/compat_resource/gemspec.rb"
116
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/lib/compat_resource/version.rb"
117
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/spec/cookbook_spec.rb"
118
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/Gemfile"
119
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/Gemfile.lock"
120
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/config.rb"
121
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/cookbooks/future/libraries/future_custom_resource.rb"
122
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/cookbooks/future/libraries/super_properties.rb"
123
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/cookbooks/future/metadata.rb"
124
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/cookbooks/future/recipes/declare_resource.rb"
125
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/cookbooks/future/resources/resource.rb"
126
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/cookbooks/future/resources/super_resource.rb"
127
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/cookbooks/hybrid/libraries/normal_hwrp.rb"
128
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/cookbooks/hybrid/metadata.rb"
129
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/cookbooks/hybrid/providers/resource.rb"
130
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/cookbooks/hybrid/resources/resource.rb"
131
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/cookbooks/normal/libraries/normal_hwrp.rb"
132
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/cookbooks/normal/metadata.rb"
133
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/cookbooks/normal/providers/resource.rb"
134
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/cookbooks/normal/recipes/declare_resource.rb"
135
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/cookbooks/normal/resources/resource.rb"
136
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/cookbooks/test/metadata.rb"
137
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/cookbooks/test/recipes/default.rb"
138
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/cookbooks/test/recipes/test.rb"
139
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/spec/data/nodes/ettores-mbp.lan.json"
140
+ - "/Users/jkeiser/src/cookbooks/compat_resource/files/spec/spec_helper.rb"
89
141
  - CHANGELOG.md
90
142
  - Gemfile
91
143
  - LICENSE
92
144
  - README.md
93
145
  - Rakefile
94
- - files/lib/chef_compat.rb
95
- - files/lib/chef_compat/copied_from_chef.rb
96
- - files/lib/chef_compat/copied_from_chef/chef/constants.rb
97
- - files/lib/chef_compat/copied_from_chef/chef/delayed_evaluator.rb
98
- - files/lib/chef_compat/copied_from_chef/chef/dsl/declare_resource.rb
99
- - files/lib/chef_compat/copied_from_chef/chef/dsl/recipe.rb
100
- - files/lib/chef_compat/copied_from_chef/chef/mixin/params_validate.rb
101
- - files/lib/chef_compat/copied_from_chef/chef/mixin/properties.rb
102
- - files/lib/chef_compat/copied_from_chef/chef/property.rb
103
- - files/lib/chef_compat/copied_from_chef/chef/provider.rb
104
- - files/lib/chef_compat/copied_from_chef/chef/resource.rb
105
- - files/lib/chef_compat/copied_from_chef/chef/resource/action_class.rb
106
- - files/lib/chef_compat/copied_from_chef/chef/resource_builder.rb
107
- - files/lib/chef_compat/mixin/properties.rb
108
- - files/lib/chef_compat/monkeypatches.rb
109
- - files/lib/chef_compat/monkeypatches/chef.rb
110
- - files/lib/chef_compat/monkeypatches/chef/exceptions.rb
111
- - files/lib/chef_compat/monkeypatches/chef/provider.rb
112
- - files/lib/chef_compat/monkeypatches/chef/recipe.rb
113
- - files/lib/chef_compat/monkeypatches/chef/resource.rb
114
- - files/lib/chef_compat/monkeypatches/chef/resource/lwrp_base.rb
115
- - files/lib/chef_compat/monkeypatches/chef/run_context.rb
116
- - files/lib/chef_compat/property.rb
117
- - files/lib/chef_compat/recipe.rb
118
- - files/lib/chef_compat/resource.rb
119
- - files/lib/chef_compat/resource/lwrp_base.rb
120
- - files/lib/chef_compat/version.rb
121
146
  homepage: http://chef.io
122
147
  licenses:
123
148
  - Apache 2.0
@@ -1,3 +0,0 @@
1
- module ChefCompat
2
- VERSION = '12.5.16' if !defined?(VERSION)
3
- end