poise-boiler 1.5.1 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/Gemfile +5 -2
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/gemfiles/default.gemfile +1 -1
- data/gemfiles/master.gemfile +1 -1
- data/lib/kitchen/provisioner/poise_solo.rb +26 -0
- data/lib/poise-boiler.rb +1 -1
- data/lib/poise_boiler.rb +2 -2
- data/lib/poise_boiler/error.rb +1 -1
- data/lib/poise_boiler/helpers.rb +1 -1
- data/lib/poise_boiler/helpers/rake.rb +3 -1
- data/lib/poise_boiler/helpers/rake/badges.rb +13 -7
- data/lib/poise_boiler/helpers/rake/bump.rb +1 -1
- data/lib/poise_boiler/helpers/rake/check.rb +1 -1
- data/lib/poise_boiler/helpers/rake/core.rb +1 -1
- data/lib/poise_boiler/helpers/rake/debug.rb +1 -1
- data/lib/poise_boiler/helpers/rake/release.rb +1 -1
- data/lib/poise_boiler/helpers/rake/travis.rb +1 -1
- data/lib/poise_boiler/helpers/rake/year.rb +84 -0
- data/lib/poise_boiler/helpers/spec_helper.rb +1 -1
- data/lib/poise_boiler/kitchen.rb +31 -10
- data/lib/poise_boiler/kitchen/core_ext.rb +24 -0
- data/lib/poise_boiler/kitchen/provisioner.rb +102 -0
- data/lib/poise_boiler/rake.rb +1 -1
- data/lib/poise_boiler/rakefile.rb +1 -1
- data/lib/poise_boiler/spec_helper.rb +1 -1
- data/lib/poise_boiler/version.rb +2 -2
- data/poise-boiler.gemspec +4 -4
- data/spec/helpers/rake/badge_spec.rb +1 -1
- data/spec/helpers/rake/bump_spec.rb +1 -1
- data/spec/helpers/rake/check_spec.rb +1 -1
- data/spec/helpers/rake/travis_spec.rb +1 -1
- data/spec/helpers/rake_spec.rb +1 -1
- data/spec/helpers/spec_helper_spec.rb +1 -1
- data/spec/kitchen_spec.rb +8 -8
- data/spec/spec_helper.rb +1 -1
- metadata +16 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd1b2217f90d2b5e97250517db809e44a9922f86
|
4
|
+
data.tar.gz: ef8ddebba565e10342604fde82e2fe5f860e1ddc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0062710d338b8d3773ae3048a361461cae0e3e9344e77da7dc3646c4fce8341f47918631887cda0d7df044d920693209d77a4b8cbdecdbfa54ba1734a92f9e99
|
7
|
+
data.tar.gz: 6e5772aa9071c4a6e27d4007518ff6df3f324535bca64a0936cb4ae5823bd6d55e6db5fad5264ca406fb48d9bd0614b85c8fe554b947e8c638e2f4220b171c95
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v1.6.0
|
4
|
+
|
5
|
+
* New rake task to update copyright years.
|
6
|
+
* New kitchen provisioner to avoid using Berkshelf unless we need non-gem cookbooks.
|
7
|
+
* Provide a default suite config for kitchen.
|
8
|
+
* Berkshelf is no longer a dependency. This is kind of a compat break but oh well.
|
9
|
+
* Automatically run poise-profiler in CI.
|
10
|
+
|
3
11
|
## v1.5.1
|
4
12
|
|
5
13
|
* Fix the bundler gem install to work with busser-serverspec.
|
data/Gemfile
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright 2015, Noah Kantrowitz
|
2
|
+
# Copyright 2015-2016, Noah Kantrowitz
|
3
3
|
#
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
5
|
# you may not use this file except in compliance with the License.
|
@@ -18,11 +18,14 @@ source 'https://rubygems.org/'
|
|
18
18
|
|
19
19
|
gemspec path: File.expand_path('..', __FILE__)
|
20
20
|
|
21
|
-
def dev_gem(name, path: File.join('..', name))
|
21
|
+
def dev_gem(name, path: File.join('..', name), github: nil)
|
22
22
|
path = File.expand_path(File.join('..', path), __FILE__)
|
23
23
|
if File.exist?(path)
|
24
24
|
gem name, path: path
|
25
|
+
elsif github
|
26
|
+
gem name, github: github
|
25
27
|
end
|
26
28
|
end
|
27
29
|
|
28
30
|
dev_gem 'halite'
|
31
|
+
dev_gem 'poise-profiler', github: 'poise/poise-profiler'
|
data/README.md
CHANGED
data/Rakefile
CHANGED
data/gemfiles/default.gemfile
CHANGED
data/gemfiles/master.gemfile
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2016, 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 'poise_boiler/kitchen/provisioner'
|
18
|
+
|
19
|
+
|
20
|
+
# @api private
|
21
|
+
module Kitchen
|
22
|
+
module Provisioner
|
23
|
+
# An alias for Kitchen plugin loading.
|
24
|
+
PoiseSolo = PoiseBoiler::Kitchen::Provisioner
|
25
|
+
end
|
26
|
+
end
|
data/lib/poise-boiler.rb
CHANGED
data/lib/poise_boiler.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright 2015, Noah Kantrowitz
|
2
|
+
# Copyright 2015-2016, Noah Kantrowitz
|
3
3
|
#
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
5
|
# you may not use this file except in compliance with the License.
|
@@ -21,7 +21,7 @@ module PoiseBoiler
|
|
21
21
|
autoload :Helpers, 'poise_boiler/helpers'
|
22
22
|
|
23
23
|
# (see PoiseBoiler::Kitchen#kitchen)
|
24
|
-
def self.kitchen(platforms: '
|
24
|
+
def self.kitchen(platforms: 'linux')
|
25
25
|
# Alias in a top-level namespace to reduce typing.
|
26
26
|
Kitchen.kitchen(platforms: platforms)
|
27
27
|
end
|
data/lib/poise_boiler/error.rb
CHANGED
data/lib/poise_boiler/helpers.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright 2015, Noah Kantrowitz
|
2
|
+
# Copyright 2015-2016, Noah Kantrowitz
|
3
3
|
#
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
5
|
# you may not use this file except in compliance with the License.
|
@@ -33,6 +33,7 @@ module PoiseBoiler
|
|
33
33
|
autoload :Debug, 'poise_boiler/helpers/rake/debug'
|
34
34
|
autoload :Release, 'poise_boiler/helpers/rake/release'
|
35
35
|
autoload :Travis, 'poise_boiler/helpers/rake/travis'
|
36
|
+
autoload :Year, 'poise_boiler/helpers/rake/year'
|
36
37
|
|
37
38
|
# Install all rake tasks.
|
38
39
|
#
|
@@ -45,6 +46,7 @@ module PoiseBoiler
|
|
45
46
|
Debug.install(gem_name: gem_name, base: base, **options)
|
46
47
|
Release.install(gem_name: gem_name, base: base, **options)
|
47
48
|
Travis.install(gem_name: gem_name, base: base, **options)
|
49
|
+
Year.install(gem_name: gem_name, base: base, **options)
|
48
50
|
end
|
49
51
|
end
|
50
52
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright 2015, Noah Kantrowitz
|
2
|
+
# Copyright 2015-2016, Noah Kantrowitz
|
3
3
|
#
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
5
|
# you may not use this file except in compliance with the License.
|
@@ -14,7 +14,8 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
|
17
|
-
require '
|
17
|
+
require 'uri'
|
18
|
+
|
18
19
|
require 'halite/gem'
|
19
20
|
require 'halite/helper_base'
|
20
21
|
require 'mixlib/shellout'
|
@@ -82,7 +83,7 @@ module PoiseBoiler
|
|
82
83
|
# @return [String]
|
83
84
|
def badge(alt, img, href)
|
84
85
|
# Default scheme and hostname because I can.
|
85
|
-
img = "https://img.shields.io/#{img}.svg" unless
|
86
|
+
img = "https://img.shields.io/#{img}.svg" unless URI.parse(img).host
|
86
87
|
"[![#{alt}](#{img})](#{href})\n"
|
87
88
|
end
|
88
89
|
|
@@ -97,11 +98,16 @@ module PoiseBoiler
|
|
97
98
|
git_remote = git_shell_out(%W{config --get branch.#{git_head}.remote})
|
98
99
|
git_remote = 'origin' if !git_remote || git_remote.empty? # Default value
|
99
100
|
git_info = git_shell_out(%w{ls-remote --get-url}+[git_remote])
|
100
|
-
|
101
|
-
|
102
|
-
|
101
|
+
parsed_remote = if git_info =~ /^git@[^:]+:/
|
102
|
+
path = git_info.split(':').last
|
103
|
+
path = "/#{path}" unless path.start_with?('/')
|
104
|
+
path
|
105
|
+
else
|
106
|
+
URI.parse(git_info).path
|
107
|
+
end
|
108
|
+
if parsed_remote =~ %r{/?(.*/.+?)(\.git)?$}
|
109
|
+
$1
|
103
110
|
else
|
104
|
-
# Unable to auto-detect
|
105
111
|
nil
|
106
112
|
end
|
107
113
|
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2016, 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 'halite/helper_base'
|
18
|
+
require 'mixlib/shellout'
|
19
|
+
|
20
|
+
|
21
|
+
module PoiseBoiler
|
22
|
+
module Helpers
|
23
|
+
class Rake
|
24
|
+
# Helper for a Rakefile to install tasks for updating copyright years.
|
25
|
+
#
|
26
|
+
# @since 1.6.0
|
27
|
+
# @example Installing tasks
|
28
|
+
# require 'poise_boiler/helpers/rake/year'
|
29
|
+
# PoiseBoiler::Helpers::Rake::Year.install
|
30
|
+
# @example Updating all copyright years
|
31
|
+
# $ rake year
|
32
|
+
# @example Updating copyright years on a non-boiler project.
|
33
|
+
# $ git ls-files | xargs perl -pi -e "s/Copyright ((?\!$(date +%Y))\\d{4})(-\\d{4})?,/Copyright \\1-$(date +%Y),/g"
|
34
|
+
class Year < Halite::HelperBase
|
35
|
+
# Install the rake tasks.
|
36
|
+
#
|
37
|
+
# @return [void]
|
38
|
+
def install
|
39
|
+
# Delayed so that Rake doesn't need to be loaded to run this file.
|
40
|
+
extend ::Rake::DSL
|
41
|
+
|
42
|
+
task 'year' do
|
43
|
+
current_year = Time.now.year.to_s
|
44
|
+
git_files.each do |path|
|
45
|
+
full_path = File.expand_path(path, base)
|
46
|
+
update_file(full_path, current_year)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def git_files
|
54
|
+
cmd = Mixlib::ShellOut.new(%w{git ls-files}, cwd: base)
|
55
|
+
cmd.run_command
|
56
|
+
cmd.error!
|
57
|
+
cmd.stdout.split(/\n/)
|
58
|
+
end
|
59
|
+
|
60
|
+
def update_file(path, year)
|
61
|
+
st = File.stat(path)
|
62
|
+
# Skip weird files, things over 1MB.
|
63
|
+
return unless st.file? && st.size < 1024 * 1024
|
64
|
+
fd = File.new(path, mode: 'r+b')
|
65
|
+
content = fd.read
|
66
|
+
# Skip any file with null bytes.
|
67
|
+
return if content.include?("\00")
|
68
|
+
new_content = content.gsub(/Copyright (\d\d\d\d)(-\d\d\d\d)?,/) do |match|
|
69
|
+
if $1 == year
|
70
|
+
match
|
71
|
+
else
|
72
|
+
"Copyright #{$1}-#{year},"
|
73
|
+
end
|
74
|
+
end
|
75
|
+
# No change, bailing.
|
76
|
+
return if content == new_content
|
77
|
+
fd.seek(0, 0)
|
78
|
+
fd.write(new_content)
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
data/lib/poise_boiler/kitchen.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright 2015, Noah Kantrowitz
|
2
|
+
# Copyright 2015-2016, Noah Kantrowitz
|
3
3
|
#
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
5
|
# you may not use this file except in compliance with the License.
|
@@ -14,6 +14,8 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
|
17
|
+
require 'bundler'
|
18
|
+
require 'halite'
|
17
19
|
require 'kitchen'
|
18
20
|
|
19
21
|
|
@@ -43,7 +45,7 @@ module PoiseBoiler
|
|
43
45
|
# @example .kitchen.yml
|
44
46
|
# #<% require 'poise_boiler' %>
|
45
47
|
# <%= PoiseBoiler.kitchen %>
|
46
|
-
def kitchen(platforms: '
|
48
|
+
def kitchen(platforms: 'linux', root: nil)
|
47
49
|
# Figure out the directory that contains the kitchen.yml.
|
48
50
|
root ||= if caller.find {|line| !line.start_with?(File.expand_path('../..', __FILE__)) } =~ /^(.*?):\d+:in/
|
49
51
|
File.expand_path('..', $1)
|
@@ -67,11 +69,10 @@ module PoiseBoiler
|
|
67
69
|
else
|
68
70
|
''
|
69
71
|
end
|
70
|
-
docker_enabled = File.exist?(File.expand_path('test/docker/docker.key', root))
|
71
72
|
{
|
72
73
|
'chef_versions' => %w{12},
|
73
74
|
'driver' => {
|
74
|
-
'name' => (docker_enabled ? 'docker' : ENV['TRAVIS'] == 'true' ? 'dummy' : 'vagrant'),
|
75
|
+
'name' => (docker_enabled?(root) ? 'docker' : ENV['TRAVIS'] == 'true' ? 'dummy' : 'vagrant'),
|
75
76
|
'require_chef_omnibus' => chef_version || true,
|
76
77
|
'dockerfile' => File.expand_path('../kitchen/Dockerfile.erb', __FILE__),
|
77
78
|
# No password for securiteeeee.
|
@@ -105,9 +106,10 @@ module PoiseBoiler
|
|
105
106
|
},
|
106
107
|
'transport' => {
|
107
108
|
'name' => 'sftp',
|
108
|
-
'ssh_key' => docker_enabled ? File.expand_path('.kitchen/docker_id_rsa', root) : nil,
|
109
|
+
'ssh_key' => docker_enabled?(root) ? File.expand_path('.kitchen/docker_id_rsa', root) : nil,
|
109
110
|
},
|
110
111
|
'provisioner' => {
|
112
|
+
'name' => 'poise_solo',
|
111
113
|
'attributes' => {
|
112
114
|
'POISE_DEBUG' => !!((ENV['POISE_DEBUG'] && ENV['POISE_DEBUG'] != 'false') ||
|
113
115
|
(ENV['poise_debug'] && ENV['poise_debug'] != 'false') ||
|
@@ -115,7 +117,8 @@ module PoiseBoiler
|
|
115
117
|
),
|
116
118
|
},
|
117
119
|
},
|
118
|
-
'platforms' => expand_kitchen_platforms(platforms).map {|p| platform_definition(p) },
|
120
|
+
'platforms' => expand_kitchen_platforms(platforms).map {|p| platform_definition(p, root) },
|
121
|
+
'suites' => [suite_definition(root)],
|
119
122
|
}.to_yaml.gsub(/---[ \n]/, '')
|
120
123
|
end
|
121
124
|
|
@@ -132,10 +135,10 @@ module PoiseBoiler
|
|
132
135
|
platforms
|
133
136
|
end
|
134
137
|
|
135
|
-
def platform_definition(name)
|
138
|
+
def platform_definition(name, root)
|
136
139
|
{
|
137
140
|
'name' => name,
|
138
|
-
'run_list' => platform_run_list(name),
|
141
|
+
'run_list' => platform_run_list(name, root) + ((ENV['CI'] || ENV['DEBUG'] || ENV['PROFILE']) ? %w{poise-profiler} : []),
|
139
142
|
'driver_config' => platform_driver(name),
|
140
143
|
}
|
141
144
|
end
|
@@ -144,8 +147,8 @@ module PoiseBoiler
|
|
144
147
|
#
|
145
148
|
# @param platform [String] Platform name.
|
146
149
|
# @return [Array<String>]
|
147
|
-
def platform_run_list(platform)
|
148
|
-
if platform.start_with?('debian') || platform.start_with?('ubuntu')
|
150
|
+
def platform_run_list(platform, root)
|
151
|
+
if (platform.start_with?('debian') || platform.start_with?('ubuntu')) && !docker_enabled?(root)
|
149
152
|
%w{apt}
|
150
153
|
else
|
151
154
|
[]
|
@@ -166,5 +169,23 @@ module PoiseBoiler
|
|
166
169
|
}
|
167
170
|
end
|
168
171
|
end
|
172
|
+
|
173
|
+
def suite_definition(root)
|
174
|
+
gemspec_path = Dir[File.join(root, '*.gemspec')].first
|
175
|
+
unless gemspec_path
|
176
|
+
puts "Unable to determine gemspec path for #{root}"
|
177
|
+
return {}
|
178
|
+
end
|
179
|
+
gem_data = Halite::Gem.new(Bundler.load_gemspec(gemspec_path))
|
180
|
+
{
|
181
|
+
'name' => 'default',
|
182
|
+
'run_list' => (File.exist?(File.join(root, 'test', 'cookbook')) || File.exist?(File.join(root, 'test', 'cookbooks'))) ? ["#{gem_data.cookbook_name}_test"] : [gem_data.cookbook_name],
|
183
|
+
}
|
184
|
+
end
|
185
|
+
|
186
|
+
def docker_enabled?(root)
|
187
|
+
File.exist?(File.expand_path('test/docker/docker.key', root))
|
188
|
+
end
|
189
|
+
|
169
190
|
end
|
170
191
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2016, 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 'kitchen/provisioner/chef/common_sandbox'
|
18
|
+
|
19
|
+
|
20
|
+
# Monkey-patch Test Kitchen to not try to create the fake cookbook.
|
21
|
+
class Kitchen::Provisioner::Chef::CommonSandbox
|
22
|
+
def make_fake_cookbook
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2016, 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 'fileutils'
|
18
|
+
|
19
|
+
require 'halite'
|
20
|
+
require 'kitchen/provisioner/chef_solo'
|
21
|
+
|
22
|
+
require 'poise_boiler/kitchen/core_ext'
|
23
|
+
|
24
|
+
|
25
|
+
module PoiseBoiler
|
26
|
+
module Kitchen
|
27
|
+
class Provisioner < ::Kitchen::Provisioner::ChefSolo
|
28
|
+
default_config :gemspec do |provisioner|
|
29
|
+
Dir[File.join(provisioner[:kitchen_root], '*.gemspec')].first
|
30
|
+
end
|
31
|
+
expand_path_for :gemspec
|
32
|
+
|
33
|
+
def self.name
|
34
|
+
'PoiseSolo'
|
35
|
+
end
|
36
|
+
|
37
|
+
def create_sandbox
|
38
|
+
super
|
39
|
+
convert_halite_cookbooks
|
40
|
+
copy_test_cookbook
|
41
|
+
copy_test_cookbooks
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def cookbook_gem
|
47
|
+
@cookbook_gem ||= begin
|
48
|
+
gemspec = Bundler.load_gemspec(config[:gemspec])
|
49
|
+
# Fix the gem path because it defaults to where the gem would be installed.
|
50
|
+
gemspec.full_gem_path = File.dirname(config[:gemspec])
|
51
|
+
Halite::Gem.new(gemspec)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def convert_halite_cookbooks
|
56
|
+
@real_cookbook_deps = {}
|
57
|
+
gems_to_convert = {'poise-profiler' => Halite::Gem.new('poise-profiler')}
|
58
|
+
gems_to_check = [cookbook_gem]
|
59
|
+
until gems_to_check.empty?
|
60
|
+
check = gems_to_check.pop
|
61
|
+
# Already in the list, skip expansion.
|
62
|
+
next if gems_to_convert.include?(check.name)
|
63
|
+
# Not a cookbook, don't expand.
|
64
|
+
next unless check.is_halite_cookbook?
|
65
|
+
gems_to_convert[check.name] = check
|
66
|
+
# Expand dependencies and check each of those.
|
67
|
+
check.cookbook_dependencies.each do |dep|
|
68
|
+
dep_cook = dep.cookbook
|
69
|
+
if dep_cook
|
70
|
+
gems_to_check << dep_cook
|
71
|
+
else
|
72
|
+
@real_cookbook_deps[dep.name] = dep
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
# Convert all the things!
|
77
|
+
tmpbooks_dir = File.join(sandbox_path, 'cookbooks')
|
78
|
+
FileUtils.mkdir_p(tmpbooks_dir)
|
79
|
+
gems_to_convert.each do |name, gem_data|
|
80
|
+
Halite.convert(gem_data, File.join(tmpbooks_dir, gem_data.cookbook_name))
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def copy_test_cookbook
|
85
|
+
fixture_base = File.join(config[:kitchen_root], 'test', 'cookbook')
|
86
|
+
return unless File.exist?(File.join(fixture_base, 'metadata.rb'))
|
87
|
+
tmp_base = File.join(sandbox_path, 'cookbooks', "#{cookbook_gem.cookbook_name}_test")
|
88
|
+
FileUtils.mkdir_p(tmp_base)
|
89
|
+
FileUtils.cp_r(File.join(fixture_base, "."), tmp_base)
|
90
|
+
end
|
91
|
+
|
92
|
+
def copy_test_cookbooks
|
93
|
+
fixtures_base = File.join(config[:kitchen_root], 'test', 'cookbooks')
|
94
|
+
return unless File.exist?(fixtures_base)
|
95
|
+
tmp_base = File.join(sandbox_path, 'cookbooks')
|
96
|
+
FileUtils.mkdir_p(tmp_base)
|
97
|
+
FileUtils.cp_r(File.join(fixtures_base, "."), tmp_base)
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
data/lib/poise_boiler/rake.rb
CHANGED
data/lib/poise_boiler/version.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright 2015, Noah Kantrowitz
|
2
|
+
# Copyright 2015-2016, Noah Kantrowitz
|
3
3
|
#
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
5
|
# you may not use this file except in compliance with the License.
|
@@ -16,5 +16,5 @@
|
|
16
16
|
|
17
17
|
|
18
18
|
module PoiseBoiler
|
19
|
-
VERSION = '1.
|
19
|
+
VERSION = '1.6.0'
|
20
20
|
end
|
data/poise-boiler.gemspec
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright 2015, Noah Kantrowitz
|
2
|
+
# Copyright 2015-2016, Noah Kantrowitz
|
3
3
|
#
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
5
|
# you may not use this file except in compliance with the License.
|
@@ -35,12 +35,12 @@ Gem::Specification.new do |spec|
|
|
35
35
|
spec.require_paths = %w{lib}
|
36
36
|
|
37
37
|
# Development gems
|
38
|
-
spec.add_dependency '
|
38
|
+
spec.add_dependency 'bundler' # Used for Bundler.load_gemspec
|
39
39
|
spec.add_dependency 'rake', '~> 10.4'
|
40
40
|
spec.add_dependency 'travis', '~> 1.8', '>= 1.8.1'
|
41
41
|
spec.add_dependency 'yard', '~> 0.8'
|
42
42
|
spec.add_dependency 'yard-classmethods', '~> 1.0'
|
43
|
-
spec.add_dependency 'halite', '~> 1.
|
43
|
+
spec.add_dependency 'halite', '~> 1.2' # This is a circular dependency
|
44
44
|
spec.add_dependency 'mixlib-shellout', '>= 1.4', '< 3.0' # Chef 11 means shellout 1.4 :-(
|
45
45
|
spec.add_dependency 'pry'
|
46
46
|
spec.add_dependency 'pry-byebug'
|
@@ -61,7 +61,7 @@ Gem::Specification.new do |spec|
|
|
61
61
|
spec.add_dependency 'vagrant-wrapper'
|
62
62
|
spec.add_dependency 'kitchen-docker'
|
63
63
|
spec.add_dependency 'kitchen-sync', '~> 2.1'
|
64
|
-
spec.add_dependency '
|
64
|
+
spec.add_dependency 'poise-profiler', '~> 1.0.pre'
|
65
65
|
|
66
66
|
# Travis gems
|
67
67
|
spec.add_dependency 'codeclimate-test-reporter', '~> 0.4'
|
data/spec/helpers/rake_spec.rb
CHANGED
data/spec/kitchen_spec.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright 2015, Noah Kantrowitz
|
2
|
+
# Copyright 2015-2016, Noah Kantrowitz
|
3
3
|
#
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
5
|
# you may not use this file except in compliance with the License.
|
@@ -31,7 +31,7 @@ EOH
|
|
31
31
|
context 'with defaults' do
|
32
32
|
context 'kitchen list' do
|
33
33
|
command 'kitchen list'
|
34
|
-
its(:stdout) { is_expected.to match(/default-ubuntu-1404\s+(Vagrant|Dummy)\s+
|
34
|
+
its(:stdout) { is_expected.to match(/default-ubuntu-1404\s+(Vagrant|Dummy)\s+PoiseSolo\s+(Busser\s+Sftp\s+)?<Not Created>/) }
|
35
35
|
end # /context kitchen list
|
36
36
|
|
37
37
|
context 'kitchen diagnose' do
|
@@ -52,10 +52,10 @@ suites:
|
|
52
52
|
- name: default
|
53
53
|
EOH
|
54
54
|
command 'kitchen list'
|
55
|
-
its(:stdout) { is_expected.to match(/default-ubuntu-1404\s+(Vagrant|Dummy)\s+
|
56
|
-
its(:stdout) { is_expected.to match(/default-ubuntu-1204\s+(Vagrant|Dummy)\s+
|
57
|
-
its(:stdout) { is_expected.to match(/default-centos-6\s+(Vagrant|Dummy)\s+
|
58
|
-
its(:stdout) { is_expected.to match(/default-centos-7\s+(Vagrant|Dummy)\s+
|
55
|
+
its(:stdout) { is_expected.to match(/default-ubuntu-1404\s+(Vagrant|Dummy)\s+PoiseSolo\s+(Busser\s+Sftp\s+)?<Not Created>/) }
|
56
|
+
its(:stdout) { is_expected.to match(/default-ubuntu-1204\s+(Vagrant|Dummy)\s+PoiseSolo\s+(Busser\s+Sftp\s+)?<Not Created>/) }
|
57
|
+
its(:stdout) { is_expected.to match(/default-centos-6\s+(Vagrant|Dummy)\s+PoiseSolo\s+(Busser\s+Sftp\s+)?<Not Created>/) }
|
58
|
+
its(:stdout) { is_expected.to match(/default-centos-7\s+(Vagrant|Dummy)\s+PoiseSolo\s+(Busser\s+Sftp\s+)?<Not Created>/) }
|
59
59
|
end # /context with a platform alias
|
60
60
|
|
61
61
|
context 'with $CHEF_VERSION set' do
|
@@ -86,7 +86,7 @@ suites:
|
|
86
86
|
- name: default
|
87
87
|
EOH
|
88
88
|
command 'kitchen list'
|
89
|
-
its(:stdout) { is_expected.to match(/default-gentoo\s+(Vagrant|Dummy)\s+
|
90
|
-
its(:stdout) { is_expected.to match(/default-arch\s+(Vagrant|Dummy)\s+
|
89
|
+
its(:stdout) { is_expected.to match(/default-gentoo\s+(Vagrant|Dummy)\s+PoiseSolo\s+(Busser\s+Sftp\s+)?<Not Created>/) }
|
90
|
+
its(:stdout) { is_expected.to match(/default-arch\s+(Vagrant|Dummy)\s+PoiseSolo\s+(Busser\s+Sftp\s+)?<Not Created>/) }
|
91
91
|
end # /context with a platform override
|
92
92
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: poise-boiler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.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-
|
11
|
+
date: 2016-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -92,14 +92,14 @@ dependencies:
|
|
92
92
|
requirements:
|
93
93
|
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: '1.
|
95
|
+
version: '1.2'
|
96
96
|
type: :runtime
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
100
|
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: '1.
|
102
|
+
version: '1.2'
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: mixlib-shellout
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -317,19 +317,19 @@ dependencies:
|
|
317
317
|
- !ruby/object:Gem::Version
|
318
318
|
version: '2.1'
|
319
319
|
- !ruby/object:Gem::Dependency
|
320
|
-
name:
|
320
|
+
name: poise-profiler
|
321
321
|
requirement: !ruby/object:Gem::Requirement
|
322
322
|
requirements:
|
323
323
|
- - "~>"
|
324
324
|
- !ruby/object:Gem::Version
|
325
|
-
version:
|
325
|
+
version: 1.0.pre
|
326
326
|
type: :runtime
|
327
327
|
prerelease: false
|
328
328
|
version_requirements: !ruby/object:Gem::Requirement
|
329
329
|
requirements:
|
330
330
|
- - "~>"
|
331
331
|
- !ruby/object:Gem::Version
|
332
|
-
version:
|
332
|
+
version: 1.0.pre
|
333
333
|
- !ruby/object:Gem::Dependency
|
334
334
|
name: codeclimate-test-reporter
|
335
335
|
requirement: !ruby/object:Gem::Requirement
|
@@ -394,6 +394,7 @@ files:
|
|
394
394
|
- Rakefile
|
395
395
|
- gemfiles/default.gemfile
|
396
396
|
- gemfiles/master.gemfile
|
397
|
+
- lib/kitchen/provisioner/poise_solo.rb
|
397
398
|
- lib/poise-boiler.rb
|
398
399
|
- lib/poise_boiler.rb
|
399
400
|
- lib/poise_boiler/error.rb
|
@@ -406,9 +407,12 @@ files:
|
|
406
407
|
- lib/poise_boiler/helpers/rake/debug.rb
|
407
408
|
- lib/poise_boiler/helpers/rake/release.rb
|
408
409
|
- lib/poise_boiler/helpers/rake/travis.rb
|
410
|
+
- lib/poise_boiler/helpers/rake/year.rb
|
409
411
|
- lib/poise_boiler/helpers/spec_helper.rb
|
410
412
|
- lib/poise_boiler/kitchen.rb
|
411
413
|
- lib/poise_boiler/kitchen/Dockerfile.erb
|
414
|
+
- lib/poise_boiler/kitchen/core_ext.rb
|
415
|
+
- lib/poise_boiler/kitchen/provisioner.rb
|
412
416
|
- lib/poise_boiler/rake.rb
|
413
417
|
- lib/poise_boiler/rakefile.rb
|
414
418
|
- lib/poise_boiler/spec_helper.rb
|