poise 2.5.0 → 2.6.0

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: 59e1a4b84effd92c53b370ae6e5ad4330ac48672
4
- data.tar.gz: 8ed9df5c50afd344e838bf637c875cae8c1765f0
3
+ metadata.gz: 1545650809810c8ee25795e7b56b933568de0914
4
+ data.tar.gz: f5a89f28a4da2042b4bd722a2a7b334079535d6d
5
5
  SHA512:
6
- metadata.gz: 2f924807105ed9ba4b41616df467768d4a5fc2f0259c8f83d8b6fba5b64d744e4cff6fa38ff66e1ab781f94dd6ed3c4f196aadae0733727cbe384569fc367a7b
7
- data.tar.gz: ad8775e6a9e0c924e7633f390ca82f7982a4eddb32ca058e3b0e0e988da4766fd074c40022977899012571bacee33c882146f27bff3ae940483cb0f6057c8515
6
+ metadata.gz: c5d033b6598795b685e866618581578ee0799710f8297ba43fef51540932d9a3d4e03a509b4c07effcf991a1da613164fb1e4c38a32b0dc7945c79f901909456
7
+ data.tar.gz: ab4f538ab3c09fcbfa5a9950a70c73bde93fb787f070cdcb3c059c00761a73e54eb44c1013ce17ea15af6736616997c99498c2ae5ded3c00d83265ec4584c89c
data/.kitchen.yml CHANGED
@@ -1,18 +1,3 @@
1
1
  ---
2
2
  #<% require 'poise_boiler' %>
3
- <%= PoiseBoiler.kitchen %>
4
-
5
- chef_versions:
6
- - '12.0'
7
- - '12.1'
8
- - '12.2'
9
- - '12'
10
-
11
- platforms:
12
- - name: ubuntu-12.04
13
-
14
- suites:
15
- - name: default
16
- run_list:
17
- - recipe[poise_test]
18
- - recipe[poise_test::inversion]
3
+ <%= PoiseBoiler.kitchen(platforms: 'ubuntu-14.04') %>
data/.travis.yml CHANGED
@@ -1,16 +1,10 @@
1
1
  sudo: false
2
2
  cache: bundler
3
3
  language: ruby
4
- addons:
5
- apt:
6
- packages:
7
- - libgecode-dev
8
4
  rvm:
9
5
  - '2.2'
10
6
  env:
11
7
  global:
12
- - USE_SYSTEM_GECODE=true
13
- - KITCHEN_LOCAL_YAML=.kitchen.travis.yml
14
8
  - secure: ax5czUwK8PVHXu/B3qbRZ8AACqXW4scIElQbn4sBuLp+VyTeutGax1uO6yTi7yv3xJUbEL3Z6gdZD/sOZpSKm8SL0YhkijoSs68HJCsau8cl7fvPJ0+JIlKqWazKEA1PaCmJHQv5J9TEyPyeSxZaIyacqOwOcUTyOkRDGyC+im8=
15
9
  - secure: jEiZqcy6E5WC1nBmfJBSLPpYOUBFdpoo7DsLrvIpKVRpOw7slb+VgIru5AzbONvVD/8CYstgqiVVoGaCP/ywWWqakOQ2thp0BqWN/OVlsuPiemAdLRMMsmekkaFUdAa5l8QUUI0YiTSpSLUXQFWZrXbiARCALGAvDBbsqF1JhgA=
16
10
  - secure: e3TH/N8tcx54wShV7s96OXDXuDbo9YnekLK3L3WrYrCK12gHVcW7xlMxPctGy14h6VaP1PBXJfUjd7cdzmHgudTo8HlR4Ui0kpjp85XrohPsLmVaFDxjAstLFm4VKMpsoKUZoPZY5J8bO9b606p872M5yO4rwKy3bVK/CP6mTBY=
@@ -25,4 +19,5 @@ gemfile:
25
19
  - test/gemfiles/chef-12.3.gemfile
26
20
  - test/gemfiles/chef-12.4.gemfile
27
21
  - test/gemfiles/chef-12.5.gemfile
22
+ - test/gemfiles/chef-12.6.gemfile
28
23
  - test/gemfiles/master.gemfile
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## v2.6.0
4
+
5
+ * New backwards-compatibility helper: `Poise::Backports::VERIFY_PATH`. Use it
6
+ like `verify "myapp -t #{Poise::Backports::VERIFY_PATH}" if defined?(verify)`
7
+ for backwards-compatible usage of file verifications.
8
+ * Fixed Poise's implementation of lazy defaults to more closely match Chef's
9
+ even when both are used in conjunction. Lazy defaults will no longer be
10
+ evaluated when setting a value or getting an existing non-default value.
11
+
3
12
  ## v2.5.0
4
13
 
5
14
  * New property for inversion resources: `provider_no_auto`. Set one or more
data/Gemfile CHANGED
@@ -29,3 +29,4 @@ end
29
29
 
30
30
  dev_gem 'halite'
31
31
  dev_gem 'poise-boiler'
32
+ dev_gem 'poise-profiler'
@@ -21,6 +21,7 @@ module Poise
21
21
  # @since 2.3.0
22
22
  module Backports
23
23
  autoload :NOT_PASSED, 'poise/backports/not_passed'
24
+ autoload :VERIFY_PATH, 'poise/backports/verify_path'
24
25
  end
25
26
 
26
27
  autoload :NOT_PASSED, 'poise/backports/not_passed'
@@ -0,0 +1,33 @@
1
+ #
2
+ # Copyright 2015, Noah Kantrowitz
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+
18
+ module Poise
19
+ module Backports
20
+ # The correct interpolation key for any version of Chef.
21
+ # @since 2.6.0
22
+ # @example
23
+ # file '/path' do
24
+ # content my_content
25
+ # verify "myapp -t #{Poise::Backports::VERIFY_PATH}"
26
+ # end
27
+ VERIFY_PATH = if Gem::Version.create(Chef::VERSION) < Gem::Version.create('12.5.0')
28
+ '%{file}'
29
+ else
30
+ '%{path}'
31
+ end
32
+ end
33
+ end
@@ -47,7 +47,12 @@ module Poise
47
47
  def set_or_return(symbol, arg, validation)
48
48
  if LazyDefault.needs_polyfill? && validation && validation[:default].is_a?(Chef::DelayedEvaluator)
49
49
  validation = validation.dup
50
- validation[:default] = instance_eval(&validation[:default])
50
+ if (arg.nil? || arg == Poise::NOT_PASSED) && (!instance_variable_defined?(:"@#{symbol}") || instance_variable_get(:"@#{symbol}").nil?)
51
+ validation[:default] = instance_eval(&validation[:default])
52
+ else
53
+ # Clear the default.
54
+ validation.delete(:default)
55
+ end
51
56
  end
52
57
  super(symbol, arg, validation)
53
58
  end
data/lib/poise/version.rb CHANGED
@@ -16,5 +16,5 @@
16
16
 
17
17
 
18
18
  module Poise
19
- VERSION = '2.5.0'
19
+ VERSION = '2.6.0'
20
20
  end
File without changes
@@ -23,3 +23,5 @@ end
23
23
  app_config 'user' do
24
24
  content 'user config'
25
25
  end
26
+
27
+ include_recipe 'poise_test::inversion'
@@ -1,7 +1,5 @@
1
1
  #
2
- # Author:: Noah Kantrowitz <noah@coderanger.net>
3
- #
4
- # Copyright 2013, Balanced, Inc.
2
+ # Copyright 2015, Noah Kantrowitz
5
3
  #
6
4
  # Licensed under the Apache License, Version 2.0 (the "License");
7
5
  # you may not use this file except in compliance with the License.
@@ -16,11 +14,6 @@
16
14
  # limitations under the License.
17
15
  #
18
16
 
19
- source 'https://supermarket.chef.io/'
20
- extension 'halite'
21
-
22
- cookbook 'poise', gem: 'poise'
17
+ eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
23
18
 
24
- group :test do
25
- cookbook 'poise_test', path: 'test/cookbooks/poise_test'
26
- end
19
+ gem 'chef', '~> 12.6.0'
@@ -16,4 +16,4 @@
16
16
 
17
17
  eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
18
18
 
19
- gem 'chef', '~> 12.0'
19
+ gem 'chef', '~> 12.6'
@@ -19,3 +19,4 @@ eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
19
19
  gem 'chef', github: 'chef/chef'
20
20
  gem 'halite', github: 'poise/halite'
21
21
  gem 'poise-boiler', github: 'poise/poise-boiler'
22
+ gem 'poise-profiler', github: 'poise/poise-profiler'
@@ -0,0 +1,27 @@
1
+ #
2
+ # Copyright 2015, Noah Kantrowitz
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ require 'spec_helper'
18
+
19
+ # Disable this test if Chef::Resource::File::Verification doesn't exist because
20
+ # it doesn't matter anyway.
21
+ describe Poise::Backports::VERIFY_PATH, if: defined?(Chef::Resource::File::Verification) do
22
+ it do
23
+ verifier = Chef::Resource::File::Verification.new(nil, "mycmd #{subject}", nil)
24
+ expect(Chef::GuardInterpreter).to receive(:for_resource).with(nil, 'mycmd /path', nil).and_return(double(evaluate: nil))
25
+ verifier.verify_command('/path', nil)
26
+ end
27
+ end
@@ -87,4 +87,45 @@ describe Poise::Helpers::LazyDefault do
87
87
 
88
88
  it { is_expected.to run_poise_test('test').with(value: [1, 2]) }
89
89
  end # /context with a mutable value
90
+
91
+ context 'with a broken default' do
92
+ resource(:poise_test) do
93
+ include Poise::Helpers::LWRPPolyfill
94
+ include described_class
95
+ attribute(:value, default: lazy { raise RuntimeError })
96
+ end
97
+ provider(:poise_test) do
98
+ def action_run
99
+ new_resource.value
100
+ end
101
+ end
102
+
103
+ context 'with no value' do
104
+ recipe do
105
+ poise_test 'test'
106
+ end
107
+
108
+ it { expect { subject }.to raise_error RuntimeError }
109
+ end # /context with no value
110
+
111
+ context 'with true' do
112
+ recipe do
113
+ poise_test 'test' do
114
+ value true
115
+ end
116
+ end
117
+
118
+ it { is_expected.to run_poise_test('test') }
119
+ end # /context with true
120
+
121
+ context 'with false' do
122
+ recipe do
123
+ poise_test 'test' do
124
+ value false
125
+ end
126
+ end
127
+
128
+ it { is_expected.to run_poise_test('test') }
129
+ end # /context with false
130
+ end # /context with a broken default
90
131
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: poise
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noah Kantrowitz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-08 00:00:00.000000000 Z
11
+ date: 2016-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: halite
@@ -46,12 +46,10 @@ extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
48
  - ".gitignore"
49
- - ".kitchen.travis.yml"
50
49
  - ".kitchen.yml"
51
50
  - ".rubocop.yml"
52
51
  - ".travis.yml"
53
52
  - ".yardopts"
54
- - Berksfile
55
53
  - CHANGELOG.md
56
54
  - Gemfile
57
55
  - LICENSE
@@ -60,6 +58,7 @@ files:
60
58
  - lib/poise.rb
61
59
  - lib/poise/backports.rb
62
60
  - lib/poise/backports/not_passed.rb
61
+ - lib/poise/backports/verify_path.rb
63
62
  - lib/poise/error.rb
64
63
  - lib/poise/helpers.rb
65
64
  - lib/poise/helpers/chefspec_matchers.rb
@@ -92,13 +91,13 @@ files:
92
91
  - lib/poise/utils/shell_out.rb
93
92
  - lib/poise/version.rb
94
93
  - poise.gemspec
95
- - test/cookbooks/poise_test/attributes/default.rb
96
- - test/cookbooks/poise_test/libraries/app.rb
97
- - test/cookbooks/poise_test/libraries/app_config.rb
98
- - test/cookbooks/poise_test/libraries/inversion.rb
99
- - test/cookbooks/poise_test/metadata.rb
100
- - test/cookbooks/poise_test/recipes/default.rb
101
- - test/cookbooks/poise_test/recipes/inversion.rb
94
+ - test/cookbook/attributes/default.rb
95
+ - test/cookbook/libraries/app.rb
96
+ - test/cookbook/libraries/app_config.rb
97
+ - test/cookbook/libraries/inversion.rb
98
+ - test/cookbook/metadata.rb
99
+ - test/cookbook/recipes/default.rb
100
+ - test/cookbook/recipes/inversion.rb
102
101
  - test/docker/docker.ca
103
102
  - test/docker/docker.pem
104
103
  - test/gemfiles/chef-12.0.gemfile
@@ -107,11 +106,13 @@ files:
107
106
  - test/gemfiles/chef-12.3.gemfile
108
107
  - test/gemfiles/chef-12.4.gemfile
109
108
  - test/gemfiles/chef-12.5.gemfile
109
+ - test/gemfiles/chef-12.6.gemfile
110
110
  - test/gemfiles/chef-12.gemfile
111
111
  - test/gemfiles/master.gemfile
112
112
  - test/integration/default/serverspec/default_spec.rb
113
113
  - test/integration/default/serverspec/inversion_spec.rb
114
114
  - test/spec/backports/not_passed_spec.rb
115
+ - test/spec/backports/verify_path_spec.rb
115
116
  - test/spec/helpers/chefspec_matchers_spec.rb
116
117
  - test/spec/helpers/defined_in_spec.rb
117
118
  - test/spec/helpers/fused_spec.rb
@@ -162,13 +163,13 @@ signing_key:
162
163
  specification_version: 4
163
164
  summary: Helpers for writing extensible Chef cookbooks.
164
165
  test_files:
165
- - test/cookbooks/poise_test/attributes/default.rb
166
- - test/cookbooks/poise_test/libraries/app.rb
167
- - test/cookbooks/poise_test/libraries/app_config.rb
168
- - test/cookbooks/poise_test/libraries/inversion.rb
169
- - test/cookbooks/poise_test/metadata.rb
170
- - test/cookbooks/poise_test/recipes/default.rb
171
- - test/cookbooks/poise_test/recipes/inversion.rb
166
+ - test/cookbook/attributes/default.rb
167
+ - test/cookbook/libraries/app.rb
168
+ - test/cookbook/libraries/app_config.rb
169
+ - test/cookbook/libraries/inversion.rb
170
+ - test/cookbook/metadata.rb
171
+ - test/cookbook/recipes/default.rb
172
+ - test/cookbook/recipes/inversion.rb
172
173
  - test/docker/docker.ca
173
174
  - test/docker/docker.pem
174
175
  - test/gemfiles/chef-12.0.gemfile
@@ -177,11 +178,13 @@ test_files:
177
178
  - test/gemfiles/chef-12.3.gemfile
178
179
  - test/gemfiles/chef-12.4.gemfile
179
180
  - test/gemfiles/chef-12.5.gemfile
181
+ - test/gemfiles/chef-12.6.gemfile
180
182
  - test/gemfiles/chef-12.gemfile
181
183
  - test/gemfiles/master.gemfile
182
184
  - test/integration/default/serverspec/default_spec.rb
183
185
  - test/integration/default/serverspec/inversion_spec.rb
184
186
  - test/spec/backports/not_passed_spec.rb
187
+ - test/spec/backports/verify_path_spec.rb
185
188
  - test/spec/helpers/chefspec_matchers_spec.rb
186
189
  - test/spec/helpers/defined_in_spec.rb
187
190
  - test/spec/helpers/fused_spec.rb
data/.kitchen.travis.yml DELETED
@@ -1,9 +0,0 @@
1
- ---
2
- driver:
3
- name: docker
4
- binary: "./docker"
5
- socket: tcp://docker.poise.io:443
6
- tls_verify: true
7
- tls_cacert: test/docker/docker.ca
8
- tls_cert: test/docker/docker.pem
9
- tls_key: test/docker/docker.key