poise 2.7.2 → 2.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -2
- data/.travis.yml +61 -26
- data/.yardopts +2 -0
- data/.yo-rc.json +7 -0
- data/CHANGELOG.md +7 -0
- data/Gemfile +1 -1
- data/LICENSE +201 -202
- data/lib/poise.rb +1 -1
- data/lib/poise/helpers/option_collector.rb +2 -0
- data/lib/poise/helpers/resource_subclass.rb +5 -1
- data/lib/poise/version.rb +1 -1
- data/poise.gemspec +3 -1
- data/test/cookbook/libraries/app.rb +24 -17
- data/test/cookbook/libraries/app_config.rb +28 -20
- data/test/gemfiles/chef-12.0.gemfile +4 -0
- data/test/gemfiles/chef-12.1.gemfile +4 -0
- data/test/gemfiles/chef-12.10.gemfile +4 -0
- data/test/gemfiles/chef-12.11.gemfile +4 -0
- data/test/gemfiles/chef-12.12.gemfile +22 -0
- data/test/gemfiles/chef-12.13.gemfile +22 -0
- data/test/gemfiles/chef-12.14.gemfile +19 -0
- data/test/gemfiles/chef-12.15.gemfile +19 -0
- data/test/gemfiles/chef-12.16.gemfile +19 -0
- data/test/gemfiles/chef-12.17.gemfile +19 -0
- data/test/gemfiles/chef-12.18.gemfile +19 -0
- data/test/gemfiles/chef-12.19.gemfile +19 -0
- data/test/gemfiles/chef-12.2.gemfile +4 -0
- data/test/gemfiles/chef-12.3.gemfile +4 -0
- data/test/gemfiles/chef-12.4.gemfile +5 -2
- data/test/gemfiles/chef-12.5.gemfile +4 -0
- data/test/gemfiles/chef-12.6.gemfile +4 -0
- data/test/gemfiles/chef-12.7.gemfile +4 -0
- data/test/gemfiles/chef-12.8.gemfile +4 -0
- data/test/gemfiles/chef-12.9.gemfile +4 -0
- data/test/gemfiles/chef-12.gemfile +1 -1
- data/test/gemfiles/chef-13.0.gemfile +19 -0
- data/test/gemfiles/chef-13.gemfile +19 -0
- data/test/gemfiles/master.gemfile +8 -4
- data/test/spec/helpers/fused_spec.rb +4 -1
- data/test/spec/helpers/inversion_spec.rb +51 -48
- data/test/spec/helpers/option_collector_spec.rb +25 -3
- data/test/spec/helpers/resource_cloning_spec.rb +9 -7
- data/test/spec/utils_spec.rb +29 -17
- metadata +47 -5
data/lib/poise.rb
CHANGED
@@ -99,6 +99,8 @@ module Poise
|
|
99
99
|
raise Poise::Error.new("Parser must be a Proc or Symbol: #{parser.inspect}") if parser && !(parser.is_a?(Proc) || parser.is_a?(Symbol))
|
100
100
|
# Cast to a set at definition time.
|
101
101
|
forced_keys = Set.new(forced_keys) unless forced_keys.is_a?(Set)
|
102
|
+
# Never allow name to be called accidentally since it does really wonky things.
|
103
|
+
forced_keys.add(:name)
|
102
104
|
# Unlike LWRPBase.attribute, I don't care about Ruby 1.8. Worlds tiniest violin.
|
103
105
|
define_method(name.to_sym) do |arg=nil, &block|
|
104
106
|
iv_sym = :"@#{name}"
|
@@ -39,7 +39,11 @@ module Poise
|
|
39
39
|
# Deal with the node maps.
|
40
40
|
node_maps = {}
|
41
41
|
node_maps['handler map'] = Chef.provider_handler_map if defined?(Chef.provider_handler_map)
|
42
|
-
node_maps['priority map'] =
|
42
|
+
node_maps['priority map'] = if defined?(Chef.provider_priority_map)
|
43
|
+
Chef.provider_priority_map
|
44
|
+
else
|
45
|
+
Chef::Platform::ProviderPriorityMap.instance.send(:priority_map)
|
46
|
+
end
|
43
47
|
# Patch anything in the descendants tracker.
|
44
48
|
Chef::Provider.descendants.each do |provider|
|
45
49
|
node_maps["#{provider} node map"] = provider.node_map if defined?(provider.node_map)
|
data/lib/poise/version.rb
CHANGED
data/poise.gemspec
CHANGED
@@ -26,13 +26,15 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.description = "Helpers for writing extensible Chef cookbooks."
|
27
27
|
spec.summary = spec.description
|
28
28
|
spec.homepage = 'https://github.com/poise/poise'
|
29
|
-
spec.license = 'Apache
|
29
|
+
spec.license = 'Apache-2.0'
|
30
|
+
spec.metadata['platforms'] = 'any'
|
30
31
|
|
31
32
|
spec.files = `git ls-files`.split($/)
|
32
33
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
33
34
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
34
35
|
spec.require_paths = %w{lib}
|
35
36
|
|
37
|
+
spec.add_dependency 'chef', '>= 12', '< 14'
|
36
38
|
spec.add_dependency 'halite', '~> 1.0'
|
37
39
|
|
38
40
|
spec.add_development_dependency 'fauxhai', '>= 3.3.0' # For now.
|
@@ -14,31 +14,38 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
|
17
|
+
require 'chef/provider'
|
18
|
+
require 'chef/resource'
|
19
|
+
|
17
20
|
require 'poise'
|
18
21
|
|
19
22
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
23
|
+
module PoiseTest
|
24
|
+
module App
|
25
|
+
class Resource < Chef::Resource
|
26
|
+
include Poise(container: true)
|
27
|
+
provides(:app)
|
28
|
+
actions(:install)
|
25
29
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
+
attribute(:path, kind_of: String, name_attribute: true)
|
31
|
+
attribute(:user, kind_of: String, default: 'root')
|
32
|
+
attribute(:group, kind_of: String, default: 'root')
|
33
|
+
end
|
30
34
|
|
31
|
-
|
32
|
-
|
35
|
+
class Provider < Chef::Provider
|
36
|
+
include Poise
|
37
|
+
provides(:app)
|
33
38
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
39
|
+
def action_install
|
40
|
+
notifying_block do
|
41
|
+
directory new_resource.path do
|
42
|
+
owner new_resource.user
|
43
|
+
group new_resource.group
|
44
|
+
mode '755'
|
45
|
+
end
|
40
46
|
end
|
41
47
|
end
|
42
48
|
end
|
49
|
+
|
43
50
|
end
|
44
51
|
end
|
@@ -14,34 +14,42 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
|
17
|
-
|
17
|
+
require 'chef/provider'
|
18
|
+
require 'chef/resource'
|
18
19
|
|
19
|
-
|
20
|
-
class Resource::AppConfig < Resource
|
21
|
-
include Poise(App)
|
22
|
-
provides(:app_config)
|
23
|
-
actions(:create)
|
20
|
+
require 'poise'
|
24
21
|
|
25
|
-
attribute('', template: true, required: true)
|
26
|
-
attribute(:config_name, kind_of: String, default: lazy { name.split('::').last })
|
27
22
|
|
28
|
-
|
29
|
-
|
23
|
+
module PoiseTest
|
24
|
+
module AppConfig
|
25
|
+
class Resource < Chef::Resource
|
26
|
+
include Poise(:app)
|
27
|
+
provides(:app_config)
|
28
|
+
actions(:create)
|
29
|
+
|
30
|
+
attribute('', template: true, required: true)
|
31
|
+
attribute(:config_name, kind_of: String, default: lazy { name.split('::').last })
|
32
|
+
|
33
|
+
def path
|
34
|
+
::File.join(parent.path, config_name+'.conf')
|
35
|
+
end
|
30
36
|
end
|
31
|
-
end
|
32
37
|
|
33
|
-
|
34
|
-
|
38
|
+
class Provider < Chef::Provider
|
39
|
+
include Poise
|
40
|
+
provides(:app_config)
|
35
41
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
42
|
+
def action_create
|
43
|
+
notifying_block do
|
44
|
+
file new_resource.path do
|
45
|
+
owner new_resource.parent.user
|
46
|
+
group new_resource.parent.group
|
47
|
+
mode '644'
|
48
|
+
content new_resource.content
|
49
|
+
end
|
43
50
|
end
|
44
51
|
end
|
45
52
|
end
|
53
|
+
|
46
54
|
end
|
47
55
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2017, 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
|
+
eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
|
18
|
+
|
19
|
+
gem 'chef', '~> 12.12.15'
|
20
|
+
gem 'chefspec', '< 6'
|
21
|
+
gem 'fauxhai', '<= 3.9.0'
|
22
|
+
gem 'foodcritic', '< 8'
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2017, 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
|
+
eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
|
18
|
+
|
19
|
+
gem 'chef', '~> 12.13.37'
|
20
|
+
gem 'chefspec', '< 6'
|
21
|
+
gem 'fauxhai', '<= 3.9.0'
|
22
|
+
gem 'foodcritic', '< 8'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2017, 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
|
+
eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
|
18
|
+
|
19
|
+
gem 'chef', '~> 12.14.89'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2017, 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
|
+
eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
|
18
|
+
|
19
|
+
gem 'chef', '~> 12.15.19'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2017, 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
|
+
eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
|
18
|
+
|
19
|
+
gem 'chef', '~> 12.16.42'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2017, 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
|
+
eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
|
18
|
+
|
19
|
+
gem 'chef', '~> 12.17.44'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2017, 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
|
+
eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
|
18
|
+
|
19
|
+
gem 'chef', '~> 12.18.31'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2017, 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
|
+
eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
|
18
|
+
|
19
|
+
gem 'chef', '~> 12.19.36'
|
@@ -17,5 +17,8 @@
|
|
17
17
|
eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
|
18
18
|
|
19
19
|
gem 'chef', '~> 12.4.3'
|
20
|
-
|
21
|
-
gem '
|
20
|
+
gem 'chefspec', '< 6'
|
21
|
+
gem 'fauxhai', '<= 3.9.0'
|
22
|
+
gem 'foodcritic', '< 8'
|
23
|
+
gem 'gh', '0.14.0'
|
24
|
+
gem 'rack', '< 2'
|