chef-utils 18.0.161 → 18.0.169

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 (41) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +201 -201
  3. data/Rakefile +15 -15
  4. data/chef-utils.gemspec +50 -50
  5. data/lib/chef-utils/dist.rb +154 -154
  6. data/lib/chef-utils/dsl/architecture.rb +150 -150
  7. data/lib/chef-utils/dsl/cloud.rb +155 -155
  8. data/lib/chef-utils/dsl/default_paths.rb +60 -60
  9. data/lib/chef-utils/dsl/introspection.rb +134 -134
  10. data/lib/chef-utils/dsl/os.rb +58 -58
  11. data/lib/chef-utils/dsl/path_sanity.rb +39 -39
  12. data/lib/chef-utils/dsl/platform.rb +387 -387
  13. data/lib/chef-utils/dsl/platform_family.rb +360 -360
  14. data/lib/chef-utils/dsl/platform_version.rb +41 -41
  15. data/lib/chef-utils/dsl/service.rb +112 -112
  16. data/lib/chef-utils/dsl/train_helpers.rb +87 -87
  17. data/lib/chef-utils/dsl/virtualization.rb +272 -272
  18. data/lib/chef-utils/dsl/which.rb +123 -123
  19. data/lib/chef-utils/dsl/windows.rb +86 -86
  20. data/lib/chef-utils/internal.rb +114 -114
  21. data/lib/chef-utils/mash.rb +263 -263
  22. data/lib/chef-utils/parallel_map.rb +131 -131
  23. data/lib/chef-utils/version.rb +20 -20
  24. data/lib/chef-utils/version_string.rb +160 -160
  25. data/lib/chef-utils.rb +53 -53
  26. data/spec/spec_helper.rb +100 -100
  27. data/spec/unit/dsl/architecture_spec.rb +151 -151
  28. data/spec/unit/dsl/cloud_spec.rb +93 -93
  29. data/spec/unit/dsl/dsl_spec.rb +34 -34
  30. data/spec/unit/dsl/introspection_spec.rb +201 -201
  31. data/spec/unit/dsl/os_spec.rb +175 -175
  32. data/spec/unit/dsl/path_sanity_spec.rb +86 -86
  33. data/spec/unit/dsl/platform_family_spec.rb +235 -235
  34. data/spec/unit/dsl/platform_spec.rb +252 -252
  35. data/spec/unit/dsl/service_spec.rb +117 -117
  36. data/spec/unit/dsl/virtualization_spec.rb +75 -75
  37. data/spec/unit/dsl/which_spec.rb +171 -171
  38. data/spec/unit/dsl/windows_spec.rb +84 -84
  39. data/spec/unit/mash_spec.rb +51 -51
  40. data/spec/unit/parallel_map_spec.rb +156 -156
  41. metadata +3 -3
@@ -1,235 +1,235 @@
1
- # frozen_string_literal: true
2
- #
3
- # Copyright:: Copyright (c) Chef Software Inc.
4
- # License:: Apache License, Version 2.0
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- require "spec_helper"
20
- require "fauxhai"
21
-
22
- def pf_reports_true_for(*args)
23
- args.each do |method|
24
- it "reports true for #{method}" do
25
- expect(described_class.send(method, node)).to be true
26
- end
27
- end
28
- (PLATFORM_FAMILY_HELPERS - %i{windows_ruby? macos_ruby?} - args).each do |method|
29
- it "reports false for #{method}" do
30
- expect(described_class.send(method, node)).to be false
31
- end
32
- end
33
- end
34
-
35
- RSpec.describe ChefUtils::DSL::PlatformFamily do
36
- let(:node) { Fauxhai.mock(options).data }
37
-
38
- ( HELPER_MODULES - [ described_class ] ).each do |klass|
39
- it "does not have methods that collide with #{klass}" do
40
- expect((klass.methods - Module.methods) & PLATFORM_FAMILY_HELPERS).to be_empty
41
- end
42
- end
43
-
44
- ( PLATFORM_FAMILY_HELPERS - %i{windows_ruby? macos_ruby?}).each do |helper|
45
- it "has the #{helper} in the ChefUtils module" do
46
- expect(ChefUtils).to respond_to(helper)
47
- end
48
- end
49
-
50
- context "on ubuntu" do
51
- let(:options) { { platform: "ubuntu" } }
52
-
53
- pf_reports_true_for(:debian?)
54
- end
55
-
56
- context "on raspbian" do
57
- let(:options) { { platform: "raspbian" } }
58
-
59
- pf_reports_true_for(:debian?)
60
- end
61
-
62
- context "on linuxmint" do
63
- let(:options) { { platform: "linuxmint" } }
64
-
65
- pf_reports_true_for(:debian?)
66
- end
67
-
68
- context "on debian" do
69
- let(:options) { { platform: "debian" } }
70
-
71
- pf_reports_true_for(:debian?)
72
- end
73
-
74
- context "on aix" do
75
- let(:options) { { platform: "aix" } }
76
-
77
- pf_reports_true_for(:aix?)
78
- end
79
-
80
- context "on amazon" do
81
- let(:options) { { platform: "amazon" } }
82
-
83
- pf_reports_true_for(:amazon?, :amazon_linux?, :rpm_based?, :fedora_derived?)
84
- end
85
-
86
- context "on arch" do
87
- let(:options) { { platform: "arch" } }
88
-
89
- pf_reports_true_for(:arch?, :arch_linux?)
90
- end
91
-
92
- context "on centos6" do
93
- let(:options) { { platform: "centos", version: "6" } }
94
-
95
- pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel6?)
96
- end
97
-
98
- context "on centos7" do
99
- let(:options) { { platform: "centos", version: "7" } }
100
-
101
- pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel7?)
102
- end
103
-
104
- context "on centos8" do
105
- let(:options) { { platform: "centos", version: "8" } }
106
-
107
- pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel8?)
108
- end
109
-
110
- context "on clearos7" do
111
- let(:options) { { platform: "clearos", version: "7" } }
112
-
113
- pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel7?)
114
- end
115
-
116
- context "on dragonfly4" do
117
- let(:options) { { platform: "dragonfly4" } }
118
-
119
- pf_reports_true_for(:dragonflybsd?)
120
- end
121
-
122
- context "on fedora" do
123
- let(:options) { { platform: "fedora" } }
124
-
125
- pf_reports_true_for(:fedora?, :rpm_based?, :fedora_derived?, :redhat_based?)
126
- end
127
-
128
- context "on freebsd" do
129
- let(:options) { { platform: "freebsd" } }
130
-
131
- pf_reports_true_for(:freebsd?, :bsd_based?)
132
- end
133
-
134
- context "on gentoo" do
135
- let(:options) { { platform: "gentoo" } }
136
-
137
- pf_reports_true_for(:gentoo?)
138
- end
139
-
140
- context "on mac_os_x" do
141
- let(:options) { { platform: "mac_os_x" } }
142
-
143
- pf_reports_true_for(:mac_os_x?, :mac?, :osx?, :macos?)
144
- end
145
-
146
- context "on openbsd" do
147
- let(:options) { { platform: "openbsd" } }
148
-
149
- pf_reports_true_for(:openbsd?, :bsd_based?)
150
- end
151
-
152
- context "on opensuse" do
153
- let(:options) { { platform: "opensuse" } }
154
-
155
- pf_reports_true_for(:suse?, :rpm_based?)
156
- end
157
-
158
- context "on oracle6" do
159
- let(:options) { { platform: "oracle", version: "6" } }
160
-
161
- pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel6?)
162
- end
163
-
164
- context "on oracle7" do
165
- let(:options) { { platform: "oracle", version: "7" } }
166
-
167
- pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel7?)
168
- end
169
-
170
- context "on redhat6" do
171
- let(:options) { { platform: "redhat", version: "6" } }
172
-
173
- pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel6?)
174
- end
175
-
176
- context "on redhat7" do
177
- let(:options) { { platform: "redhat", version: "7" } }
178
-
179
- pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel7?)
180
- end
181
-
182
- context "on redhat8" do
183
- let(:options) { { platform: "redhat", version: "8" } }
184
-
185
- pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel8?)
186
- end
187
-
188
- context "on smartos" do
189
- let(:options) { { platform: "smartos" } }
190
-
191
- pf_reports_true_for(:smartos?, :solaris_based?)
192
- end
193
-
194
- context "on solaris2" do
195
- let(:options) { { platform: "solaris2" } }
196
-
197
- pf_reports_true_for(:solaris?, :solaris2?, :solaris_based?)
198
- end
199
-
200
- context "on suse" do
201
- let(:options) { { platform: "suse" } }
202
-
203
- pf_reports_true_for(:suse?, :rpm_based?)
204
- end
205
-
206
- context "on windows" do
207
- let(:options) { { platform: "windows" } }
208
-
209
- pf_reports_true_for(:windows?)
210
- end
211
-
212
- context "node-independent windows APIs" do
213
- if RUBY_PLATFORM.match?(/mswin|mingw|windows/)
214
- it "reports true for :windows_ruby?" do
215
- expect(described_class.windows_ruby?).to be true
216
- end
217
- else
218
- it "reports false for :windows_ruby?" do
219
- expect(described_class.windows_ruby?).to be false
220
- end
221
- end
222
- end
223
-
224
- context "node-independent mac APIs" do
225
- if RUBY_PLATFORM.match?(/darwin/)
226
- it "reports true for :macos_ruby?" do
227
- expect(described_class.macos_ruby?).to be true
228
- end
229
- else
230
- it "reports false for :macos_ruby?" do
231
- expect(described_class.macos_ruby?).to be false
232
- end
233
- end
234
- end
235
- end
1
+ # frozen_string_literal: true
2
+ #
3
+ # Copyright:: Copyright (c) Chef Software Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require "spec_helper"
20
+ require "fauxhai"
21
+
22
+ def pf_reports_true_for(*args)
23
+ args.each do |method|
24
+ it "reports true for #{method}" do
25
+ expect(described_class.send(method, node)).to be true
26
+ end
27
+ end
28
+ (PLATFORM_FAMILY_HELPERS - %i{windows_ruby? macos_ruby?} - args).each do |method|
29
+ it "reports false for #{method}" do
30
+ expect(described_class.send(method, node)).to be false
31
+ end
32
+ end
33
+ end
34
+
35
+ RSpec.describe ChefUtils::DSL::PlatformFamily do
36
+ let(:node) { Fauxhai.mock(options).data }
37
+
38
+ ( HELPER_MODULES - [ described_class ] ).each do |klass|
39
+ it "does not have methods that collide with #{klass}" do
40
+ expect((klass.methods - Module.methods) & PLATFORM_FAMILY_HELPERS).to be_empty
41
+ end
42
+ end
43
+
44
+ ( PLATFORM_FAMILY_HELPERS - %i{windows_ruby? macos_ruby?}).each do |helper|
45
+ it "has the #{helper} in the ChefUtils module" do
46
+ expect(ChefUtils).to respond_to(helper)
47
+ end
48
+ end
49
+
50
+ context "on ubuntu" do
51
+ let(:options) { { platform: "ubuntu" } }
52
+
53
+ pf_reports_true_for(:debian?)
54
+ end
55
+
56
+ context "on raspbian" do
57
+ let(:options) { { platform: "raspbian" } }
58
+
59
+ pf_reports_true_for(:debian?)
60
+ end
61
+
62
+ context "on linuxmint" do
63
+ let(:options) { { platform: "linuxmint" } }
64
+
65
+ pf_reports_true_for(:debian?)
66
+ end
67
+
68
+ context "on debian" do
69
+ let(:options) { { platform: "debian" } }
70
+
71
+ pf_reports_true_for(:debian?)
72
+ end
73
+
74
+ context "on aix" do
75
+ let(:options) { { platform: "aix" } }
76
+
77
+ pf_reports_true_for(:aix?)
78
+ end
79
+
80
+ context "on amazon" do
81
+ let(:options) { { platform: "amazon" } }
82
+
83
+ pf_reports_true_for(:amazon?, :amazon_linux?, :rpm_based?, :fedora_derived?)
84
+ end
85
+
86
+ context "on arch" do
87
+ let(:options) { { platform: "arch" } }
88
+
89
+ pf_reports_true_for(:arch?, :arch_linux?)
90
+ end
91
+
92
+ context "on centos6" do
93
+ let(:options) { { platform: "centos", version: "6" } }
94
+
95
+ pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel6?)
96
+ end
97
+
98
+ context "on centos7" do
99
+ let(:options) { { platform: "centos", version: "7" } }
100
+
101
+ pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel7?)
102
+ end
103
+
104
+ context "on centos8" do
105
+ let(:options) { { platform: "centos", version: "8" } }
106
+
107
+ pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel8?)
108
+ end
109
+
110
+ context "on clearos7" do
111
+ let(:options) { { platform: "clearos", version: "7" } }
112
+
113
+ pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel7?)
114
+ end
115
+
116
+ context "on dragonfly4" do
117
+ let(:options) { { platform: "dragonfly4" } }
118
+
119
+ pf_reports_true_for(:dragonflybsd?)
120
+ end
121
+
122
+ context "on fedora" do
123
+ let(:options) { { platform: "fedora" } }
124
+
125
+ pf_reports_true_for(:fedora?, :rpm_based?, :fedora_derived?, :redhat_based?)
126
+ end
127
+
128
+ context "on freebsd" do
129
+ let(:options) { { platform: "freebsd" } }
130
+
131
+ pf_reports_true_for(:freebsd?, :bsd_based?)
132
+ end
133
+
134
+ context "on gentoo" do
135
+ let(:options) { { platform: "gentoo" } }
136
+
137
+ pf_reports_true_for(:gentoo?)
138
+ end
139
+
140
+ context "on mac_os_x" do
141
+ let(:options) { { platform: "mac_os_x" } }
142
+
143
+ pf_reports_true_for(:mac_os_x?, :mac?, :osx?, :macos?)
144
+ end
145
+
146
+ context "on openbsd" do
147
+ let(:options) { { platform: "openbsd" } }
148
+
149
+ pf_reports_true_for(:openbsd?, :bsd_based?)
150
+ end
151
+
152
+ context "on opensuse" do
153
+ let(:options) { { platform: "opensuse" } }
154
+
155
+ pf_reports_true_for(:suse?, :rpm_based?)
156
+ end
157
+
158
+ context "on oracle6" do
159
+ let(:options) { { platform: "oracle", version: "6" } }
160
+
161
+ pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel6?)
162
+ end
163
+
164
+ context "on oracle7" do
165
+ let(:options) { { platform: "oracle", version: "7" } }
166
+
167
+ pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel7?)
168
+ end
169
+
170
+ context "on redhat6" do
171
+ let(:options) { { platform: "redhat", version: "6" } }
172
+
173
+ pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel6?)
174
+ end
175
+
176
+ context "on redhat7" do
177
+ let(:options) { { platform: "redhat", version: "7" } }
178
+
179
+ pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel7?)
180
+ end
181
+
182
+ context "on redhat8" do
183
+ let(:options) { { platform: "redhat", version: "8" } }
184
+
185
+ pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel8?)
186
+ end
187
+
188
+ context "on smartos" do
189
+ let(:options) { { platform: "smartos" } }
190
+
191
+ pf_reports_true_for(:smartos?, :solaris_based?)
192
+ end
193
+
194
+ context "on solaris2" do
195
+ let(:options) { { platform: "solaris2" } }
196
+
197
+ pf_reports_true_for(:solaris?, :solaris2?, :solaris_based?)
198
+ end
199
+
200
+ context "on suse" do
201
+ let(:options) { { platform: "suse" } }
202
+
203
+ pf_reports_true_for(:suse?, :rpm_based?)
204
+ end
205
+
206
+ context "on windows" do
207
+ let(:options) { { platform: "windows" } }
208
+
209
+ pf_reports_true_for(:windows?)
210
+ end
211
+
212
+ context "node-independent windows APIs" do
213
+ if RUBY_PLATFORM.match?(/mswin|mingw|windows/)
214
+ it "reports true for :windows_ruby?" do
215
+ expect(described_class.windows_ruby?).to be true
216
+ end
217
+ else
218
+ it "reports false for :windows_ruby?" do
219
+ expect(described_class.windows_ruby?).to be false
220
+ end
221
+ end
222
+ end
223
+
224
+ context "node-independent mac APIs" do
225
+ if RUBY_PLATFORM.match?(/darwin/)
226
+ it "reports true for :macos_ruby?" do
227
+ expect(described_class.macos_ruby?).to be true
228
+ end
229
+ else
230
+ it "reports false for :macos_ruby?" do
231
+ expect(described_class.macos_ruby?).to be false
232
+ end
233
+ end
234
+ end
235
+ end