chef-sugar 3.0.0 → 3.0.1

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: d36f781f9ad16a91e542337396dbd4bfb7eb9a5c
4
- data.tar.gz: 5582a86da12f5153b7d7983ff1837a9e32809c6e
3
+ metadata.gz: 0a4445aeb371367f5395edf0f995fd4f52e6314a
4
+ data.tar.gz: 92dcd636d49954fd5095234337e363905a402c69
5
5
  SHA512:
6
- metadata.gz: 1de9ff9c1e94dd9725ab54f5aa5cf51f76645dcbe56cb3b86c2b5a261326956128ba44bf91fc89e790842b8f616feac65724eec2dd65e96ce988fff35ae29617
7
- data.tar.gz: f52967095ea599f2a1c524d1287546196b67e88251ca98a42e5a8a786b2068ae0e7436bb56e194fa0db981d2f60c278b5ee86ff1b6a6477838f0cef502e77ba8
6
+ metadata.gz: 3c97a0235cba4f0600e1f7213edfb881443a37867962a89d878d3b9976e0dc3b8198a7440a17ca0a7cf8d78a365e1b0653aedd915cea4d0a8a1aad06a0352b35
7
+ data.tar.gz: 067a00297c93cbb0ad32842070f7b0002e39703f7a13881d8a8c36931b56fdfd6e7da2e34c77dd3d16485ffb036431f117dafd50f9005367cf9fd64f595fca5b
@@ -2,6 +2,13 @@ Chef Sugar Changelog
2
2
  =========================
3
3
  This file is used to list changes made in each version of the chef-sugar cookbook and gem.
4
4
 
5
+ v3.0.1 (2015-03-20)
6
+ -------------------
7
+ ### Breaking Changes
8
+ - Rename `compile_time` `to at_compile_time` - if your recipes are affected by
9
+ this breaking change, your Chef Client run will produce a verbose error
10
+ message with details on how to fix the error.
11
+
5
12
  v3.0.0 (2015-03-17)
6
13
  -------------------
7
14
  ### Breaking Changes
data/README.md CHANGED
@@ -412,13 +412,13 @@ end
412
412
  ```
413
413
 
414
414
  ### Filters
415
- - `compile_time` - accepts a block of resources to run at compile time
415
+ - `at_compile_time` - accepts a block of resources to run at compile time
416
416
  - `before` - insert resource in the collection before the given resource
417
417
  - `after` - insert resource in the collection after the given resource
418
418
 
419
419
  #### Examples
420
420
  ```ruby
421
- compile_time do
421
+ at_compile_time do
422
422
  package 'apache2'
423
423
  end
424
424
 
@@ -41,6 +41,7 @@ class Chef
41
41
  end
42
42
 
43
43
  Chef::Recipe.send(:include, Chef::Sugar::DSL)
44
+ Chef::Recipe.send(:include, Chef::Sugar::RecipeDSL) # TODO: this is a hack
44
45
  Chef::Resource.send(:include, Chef::Sugar::DSL)
45
46
  Chef::Provider.send(:include, Chef::Sugar::DSL)
46
47
 
@@ -4,7 +4,7 @@ class Chef
4
4
  #
5
5
  # Evaluate resources at compile time instead of converge time.
6
6
  #
7
- class CompileTime
7
+ class AtCompileTime
8
8
  def initialize(recipe)
9
9
  @recipe = recipe
10
10
  end
@@ -94,19 +94,19 @@ class Chef
94
94
  # end.run_action(:install)
95
95
  #
96
96
  # @example The new way
97
- # compile_time do
97
+ # at_compile_time do
98
98
  # package('apache2')
99
99
  # end
100
100
  #
101
101
  # @example Resource actions are run in order
102
- # compile_time do
102
+ # at_compile_time do
103
103
  # service 'apache2' do
104
104
  # action [:enable, :start] # run_action(:enable), run_action(:start)
105
105
  # end
106
106
  # end
107
107
  #
108
- def compile_time(&block)
109
- Chef::Sugar::Filters::CompileTime.new(self).evaluate(&block)
108
+ def at_compile_time(&block)
109
+ Chef::Sugar::Filters::AtCompileTime.new(self).evaluate(&block)
110
110
  end
111
111
 
112
112
  #
@@ -149,5 +149,89 @@ class Chef
149
149
  Chef::Sugar::Filters::Injector.new(self, identifier, :after).evaluate(&block)
150
150
  end
151
151
  end
152
+
153
+ module RecipeDSL
154
+ #
155
+ # @deprecated The description is in the method body pretty accurately...
156
+ #
157
+ def compile_time(&block)
158
+ message = <<-EOH
159
+
160
+ The Chef Sugar recipe DSL method `compile_time' has been renamed to
161
+ `at_compile_time'! This is a breaking change that was released in a patch
162
+ version, so please continue reading to understand the necessary semantic
163
+ versioning violation.
164
+
165
+ Despite having existed since October 15, 2013 (b4d4c0e) and being one of the
166
+ most widely used cookbooks in the Chef ecosystem, Chef Software decided to
167
+ implement their own version of `compile_time' in Chef 12.1, breaking any cookbook
168
+ that uses or depends on Chef Sugar on Chef 12.1:
169
+
170
+ https://www.chef.io/blog/2015/03/03/chef-12-1-0-released
171
+
172
+ As is common with Chef-ecosystem tooling, no warning was given, and maintainers
173
+ are left to pick up the pieces from upset Chef users who get rather bespoke
174
+ error messages now:
175
+
176
+ https://github.com/sethvargo/chef-sugar/issues/89
177
+ https://github.com/opscode-cookbooks/xml/issues/22
178
+ https://github.com/opscode-cookbooks/aws/pull/110
179
+
180
+ In order to progress Chef Sugar forward, the DSL method has been renamed to
181
+ avoid the namespace collision.
182
+
183
+ In short, you should change this:
184
+
185
+ compile_time do
186
+ # ...
187
+ end
188
+
189
+ to this:
190
+
191
+ at_compile_time do
192
+ # ...
193
+ end
194
+
195
+ EOH
196
+
197
+ if Chef::Resource::ChefGem.instance_methods(false).include?(:compile_time)
198
+ message << <<-EOH
199
+ You are running a version of Chef Client that includes the `compile_time'
200
+ attribute on core Chef resources (most likely Chef 12.1+). Instead of continuing
201
+ and having Chef provide you with an obscure error message, I am going to error
202
+ here. There is no way for the Chef Recipe to successfully continue unless you
203
+ change the Chef Sugar `compile_time' method to `at_compile_time' in your Chef
204
+ recipes.
205
+
206
+ You should NOT change resource-level `compile_time' attributes:
207
+
208
+ package "foo" do
209
+ compile_time true # Do NOT change these
210
+ end
211
+
212
+ I truly apologize for the inconvienence and hope the reason for introducing this
213
+ breaking change is clear. I am sorry if it causes extra work, but I promise this
214
+ error message is much more informative that "wrong number of arguments".
215
+
216
+ If you have any questions, please feel free to open an issue on GitHub at:
217
+
218
+ https://github.com/sethvargo/chef-sugar
219
+
220
+ Thank you, and have a great day!
221
+ EOH
222
+ raise RuntimeError, message
223
+ else
224
+ message << <<-EOH
225
+ You are running a version of Chef Client that does not include the
226
+ `compile_time' attribute on core Chef resources (most likely less than
227
+ Chef 12.1), so this is just a warning. Please consider changing the Chef Sugar
228
+ `compile_time' method to `at_compile_time' in your Chef recipes. If you upgrade
229
+ Chef, your recipes WILL break.
230
+ EOH
231
+ Chef::Log.warn(message)
232
+ at_compile_time(&block)
233
+ end
234
+ end
235
+ end
152
236
  end
153
237
  end
@@ -16,6 +16,6 @@
16
16
 
17
17
  class Chef
18
18
  module Sugar
19
- VERSION = '3.0.0'
19
+ VERSION = '3.0.1'
20
20
  end
21
21
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-sugar
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seth Vargo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-17 00:00:00.000000000 Z
11
+ date: 2015-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -90,7 +90,6 @@ extensions: []
90
90
  extra_rdoc_files: []
91
91
  files:
92
92
  - ".gitignore"
93
- - ".hound.yml"
94
93
  - ".kitchen.yml"
95
94
  - ".travis.yml"
96
95
  - CHANGELOG.md
data/.hound.yml DELETED
@@ -1,2 +0,0 @@
1
- DotPosition:
2
- EnforcedStyle: leading