opskeleton 0.7.3 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +5 -0
- data/Gemfile.lock +1 -1
- data/lib/opskeleton/generate_chef.rb +7 -4
- data/lib/opskeleton/generate_puppet.rb +7 -3
- data/lib/opskeleton/version.rb +1 -1
- data/puppet.md +28 -4
- data/templates/chef/Gemfile.erb +21 -0
- data/templates/chef/Rakefile.erb +76 -0
- data/templates/parent/spec/{spec_helper.rb → spec_helper.erb} +26 -0
- data/templates/puppet/Gemfile.erb +22 -0
- data/templates/puppet/Rakefile.erb +101 -0
- metadata +7 -7
- data/templates/chef/Rakefile +0 -34
- data/templates/chef/gemfile +0 -14
- data/templates/puppet/Rakefile +0 -50
- data/templates/puppet/gemfile +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab1eee67ae87cd2cb4c1c0f7cee0c78fb62a89de
|
4
|
+
data.tar.gz: 5a01ca76ebd36a04f962ab72f07cd281a1a62240
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bff1fb18e8e28eb8e47fb117de5226a665d8de7a298e5a685e1901db7fdfffd22328c3249f29fdd4c93c9ed32483a30b5c135b9294eaa6d7522d94fa1dfc0c0e
|
7
|
+
data.tar.gz: ddd589e8df1c1dccbf233eb3edbf2029c18e3fbcc4ddfa4ecc9f055d37d228441a952fa01f5d64def5a5eb06a45b66bb7734841acfa222a3a1a427a01f0e0508
|
data/CHANGES.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -6,6 +6,7 @@ module Opsk
|
|
6
6
|
argument :box, :type => :string, :desc => 'Vagrant box type'
|
7
7
|
class_option :box_url, :type=> :string, :desc => 'vagrant box url'
|
8
8
|
class_option :os_type, :type=> :string, :desc => 'Operating system type (bsd/linux)'
|
9
|
+
class_option :bench_enable, :type=> :boolean, :desc => 'Control if to enable benchmarking support'
|
9
10
|
|
10
11
|
desc 'Generate a Vagrant, Chef librarian and fpm project'
|
11
12
|
|
@@ -19,11 +20,11 @@ module Opsk
|
|
19
20
|
end
|
20
21
|
|
21
22
|
def create_gemfile
|
22
|
-
|
23
|
+
template('templates/chef/Gemfile.erb', "#{path}/Gemfile")
|
23
24
|
end
|
24
25
|
|
25
26
|
def create_rakefile
|
26
|
-
|
27
|
+
template('templates/chef/Rakefile.erb', "#{path}/Rakefile")
|
27
28
|
end
|
28
29
|
|
29
30
|
def create_version
|
@@ -44,7 +45,7 @@ module Opsk
|
|
44
45
|
def create_chef_base
|
45
46
|
empty_directory("#{path}/static-cookbooks/")
|
46
47
|
copy_file('templates/chef/Cheffile', "#{path}/Cheffile")
|
47
|
-
|
48
|
+
empty_directory("#{path}/roles/")
|
48
49
|
template('templates/chef/roles.erb', "#{path}/roles/#{name}.rb")
|
49
50
|
template('templates/chef/dna.json.erb', "#{path}/dna.json")
|
50
51
|
copy_file('templates/chef/run.sh', "#{path}/run.sh")
|
@@ -64,7 +65,9 @@ module Opsk
|
|
64
65
|
end
|
65
66
|
|
66
67
|
def server_spec
|
67
|
-
|
68
|
+
empty_directory("#{path}/spec")
|
69
|
+
template('templates/parent/spec/spec_helper.erb', "#{path}/spec/spec_helper.rb")
|
70
|
+
directory('templates/parent/spec/default', "#{path}/spec/default")
|
68
71
|
end
|
69
72
|
|
70
73
|
def git
|
@@ -6,6 +6,7 @@ module Opsk
|
|
6
6
|
argument :box, :type => :string, :desc => 'Vagrant box type'
|
7
7
|
class_option :box_url, :type=> :string, :desc => 'vagrant box url'
|
8
8
|
class_option :os_type, :type=> :string, :desc => 'Operating system type (bsd/linux)'
|
9
|
+
class_option :bench_enable, :type=> :boolean, :desc => 'Control if to enable benchmarking support'
|
9
10
|
|
10
11
|
desc 'Generate a Vagrant, Puppet librarian and fpm project'
|
11
12
|
|
@@ -24,11 +25,11 @@ module Opsk
|
|
24
25
|
end
|
25
26
|
|
26
27
|
def create_gemfile
|
27
|
-
|
28
|
+
template('templates/puppet/Gemfile.erb', "#{path}/Gemfile")
|
28
29
|
end
|
29
30
|
|
30
31
|
def create_rakefile
|
31
|
-
|
32
|
+
template('templates/puppet/Rakefile.erb', "#{path}/Rakefile")
|
32
33
|
end
|
33
34
|
|
34
35
|
def create_version
|
@@ -73,9 +74,12 @@ module Opsk
|
|
73
74
|
end
|
74
75
|
|
75
76
|
def server_spec
|
76
|
-
|
77
|
+
empty_directory("#{path}/spec")
|
78
|
+
template('templates/parent/spec/spec_helper.erb', "#{path}/spec/spec_helper.rb")
|
79
|
+
directory('templates/parent/spec/default', "#{path}/spec/default")
|
77
80
|
end
|
78
81
|
|
82
|
+
|
79
83
|
def git
|
80
84
|
if(!File.exists?("#{path}/.git"))
|
81
85
|
copy_file('templates/gitignore', "#{path}/.gitignore")
|
data/lib/opskeleton/version.rb
CHANGED
data/puppet.md
CHANGED
@@ -127,9 +127,33 @@ Opskeleton generates a Vagrant file with couple of enhancements:
|
|
127
127
|
The only assumption that Opskelaton makes is that the target host will have Pupppet installed, this enables us to create docker images from our sandboxes quite easily:
|
128
128
|
|
129
129
|
```bash
|
130
|
-
|
131
|
-
# creates the Dockerfile
|
130
|
+
# creates dockerfiles/<host> and fig.yml
|
132
131
|
$ opsk dockerize
|
133
|
-
|
134
|
-
|
132
|
+
$ opsk package
|
133
|
+
# grabs the opsk tar file
|
134
|
+
$ sudo fig build
|
135
|
+
```
|
136
|
+
|
137
|
+
## Benchmarking
|
138
|
+
Tracking the speed of our provisioning code is important for keeping a consistent level of service with the produced sandboxes, enabling benchmarking:
|
139
|
+
|
140
|
+
```bash
|
141
|
+
$ opsk generate_puppet redis ubuntu-14.04 --bench-enable
|
142
|
+
# install imagemagic before bundle install
|
143
|
+
$ sudo apt-get install imagemagick libmagickwand-dev
|
144
|
+
$ rake serverspec:redis
|
145
|
+
# with each run more result lines will be recorded
|
146
|
+
$ cat benchmark.json
|
147
|
+
{"total":656,"host":"redis","revision":"5d03a41ade9fc3dd5296d4119ccb0b0ad8290b9e","time":"2014-12-17 02:57:45 +0200"}
|
148
|
+
# add it to git for tracking
|
149
|
+
$ git add benchmark.json
|
135
150
|
```
|
151
|
+
|
152
|
+
Now after a number of runs we could plot and view the results of a single host or of all the hosts side by side:
|
153
|
+
|
154
|
+
```bash
|
155
|
+
$ rake plot:hosts plot:per_hosts
|
156
|
+
# resulting png files
|
157
|
+
$ google-chrome plots
|
158
|
+
```
|
159
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
# base
|
4
|
+
gem 'chef'
|
5
|
+
|
6
|
+
group :testing do
|
7
|
+
gem 'serverspec', '~> 1.14.0'
|
8
|
+
gem 'test-kitchen'
|
9
|
+
end
|
10
|
+
|
11
|
+
group :build do
|
12
|
+
gem 'rake'
|
13
|
+
gem 'foodcritic'
|
14
|
+
gem 'librarian-chef'
|
15
|
+
gem 'opskeleton'
|
16
|
+
end
|
17
|
+
|
18
|
+
<% if(@options[:bench_enable]) %>
|
19
|
+
gem 'gruff', :group => :benchmark
|
20
|
+
<% end %>
|
21
|
+
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
|
4
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
5
|
+
t.pattern = 'spec/*/*_spec.rb'
|
6
|
+
end
|
7
|
+
|
8
|
+
task :default => :spec
|
9
|
+
|
10
|
+
desc "Run serverspec to all hosts"
|
11
|
+
task :spec => 'serverspec:all'
|
12
|
+
|
13
|
+
class ServerspecTask < RSpec::Core::RakeTask
|
14
|
+
|
15
|
+
attr_accessor :target
|
16
|
+
|
17
|
+
def spec_command
|
18
|
+
cmd = super
|
19
|
+
"env TARGET_HOST=#{target} #{cmd}"
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
namespace :serverspec do
|
25
|
+
|
26
|
+
%w(<%=@name%>).each do |profile|
|
27
|
+
ServerspecTask.new(profile.to_sym) do |t|
|
28
|
+
t.target = profile
|
29
|
+
t.pattern = "spec/#{profile}/*_spec.rb"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
<% if(@options[:bench_enable]) %>
|
35
|
+
require 'gruff'
|
36
|
+
require 'json'
|
37
|
+
|
38
|
+
PLOTS = 'plots'
|
39
|
+
|
40
|
+
namespace :plot do
|
41
|
+
|
42
|
+
directory PLOTS
|
43
|
+
|
44
|
+
task :hosts => [PLOTS] do
|
45
|
+
hosts = IO.readlines('benchmark.json').map {|b|
|
46
|
+
JSON.parse(b,{:symbolize_names => true })
|
47
|
+
}.group_by {|m|
|
48
|
+
m[:host]
|
49
|
+
}
|
50
|
+
|
51
|
+
g = Gruff::Line.new
|
52
|
+
g.title = 'All Hosts side by side'
|
53
|
+
g.labels = Hash[hosts.keys.each_with_index.map {|i,h| [h , i]}]
|
54
|
+
g.labels.each_pair {|i, l|
|
55
|
+
g.data(l, hosts[l].map {|h| h[:total] })
|
56
|
+
}
|
57
|
+
g.write("#{PLOTS}/all_hosts.png")
|
58
|
+
end
|
59
|
+
|
60
|
+
task :per_host => [PLOTS] do
|
61
|
+
hosts = IO.readlines('benchmark.json').map {|b|
|
62
|
+
JSON.parse(b,{:symbolize_names => true })
|
63
|
+
}.group_by {|m|
|
64
|
+
m[:host]
|
65
|
+
}
|
66
|
+
|
67
|
+
hosts.each_pair {|h,data|
|
68
|
+
g = Gruff::Line.new
|
69
|
+
g.title = h
|
70
|
+
g.labels = {0 => h}
|
71
|
+
g.data(h, data.map {|d| d[:total] })
|
72
|
+
g.write("#{PLOTS}/#{h}.png")
|
73
|
+
}
|
74
|
+
end
|
75
|
+
end
|
76
|
+
<% end %>
|
@@ -12,6 +12,21 @@ def run(cmd)
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
+
<% if(options[:bench_enable]) -%>
|
16
|
+
class StopWatch
|
17
|
+
attr_accessor :total
|
18
|
+
def stop
|
19
|
+
@total = Time.now - @start
|
20
|
+
end
|
21
|
+
|
22
|
+
def reset
|
23
|
+
@start = Time.now
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
WATCH = StopWatch.new
|
28
|
+
<% end -%>
|
29
|
+
|
15
30
|
RSpec.configure do |c|
|
16
31
|
c.before :suite do
|
17
32
|
c.host = ENV['TARGET_HOST']
|
@@ -19,6 +34,9 @@ RSpec.configure do |c|
|
|
19
34
|
options = Net::SSH::Config.for(c.host)
|
20
35
|
if(!ENV['LOCAL'])
|
21
36
|
run("vagrant destroy #{c.host} -f")
|
37
|
+
<% if(options[:bench_enable]) %>
|
38
|
+
WATCH.reset
|
39
|
+
<% end %>
|
22
40
|
run("vagrant up #{c.host}")
|
23
41
|
config = `vagrant ssh-config #{c.host}`
|
24
42
|
sshhost = sshuser = ''
|
@@ -44,6 +62,14 @@ RSpec.configure do |c|
|
|
44
62
|
|
45
63
|
c.after :suite do
|
46
64
|
c.host = ENV['TARGET_HOST']
|
65
|
+
<% if(options[:bench_enable]) %>
|
66
|
+
WATCH.stop
|
67
|
+
rev = %x{git rev-parse HEAD}.chomp
|
68
|
+
File.open('benchmark.json', 'a') { |f|
|
69
|
+
json = {:total => WATCH.total.to_i, :host => c.host, :revision => rev, :time => Time.now}.to_json
|
70
|
+
f.write("#{json}\n")
|
71
|
+
}
|
72
|
+
<% end %>
|
47
73
|
run("vagrant destroy #{c.host} -f")
|
48
74
|
end
|
49
75
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
# base
|
4
|
+
gem 'puppet'
|
5
|
+
|
6
|
+
group :testing do
|
7
|
+
gem 'rspec-puppet'
|
8
|
+
gem 'puppetlabs_spec_helper', '>= 0.1.0'
|
9
|
+
gem 'serverspec', '~> 1.14.0'
|
10
|
+
end
|
11
|
+
|
12
|
+
group :build do
|
13
|
+
gem 'puppet-lint', :group => :build
|
14
|
+
gem 'rake', :group => :build
|
15
|
+
gem 'librarian-puppet', :group => :build
|
16
|
+
gem 'opskeleton', :group => :build
|
17
|
+
end
|
18
|
+
|
19
|
+
<% if(@options[:bench_enable]) %>
|
20
|
+
gem 'gruff', :group => :benchmark
|
21
|
+
<% end %>
|
22
|
+
|
@@ -0,0 +1,101 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
|
4
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
5
|
+
t.pattern = 'spec/*/*_spec.rb'
|
6
|
+
end
|
7
|
+
|
8
|
+
task :default => :spec
|
9
|
+
|
10
|
+
task :modspec do
|
11
|
+
FileList["static-modules/**/Rakefile"].each do |project|
|
12
|
+
Rake::Task.clear
|
13
|
+
load project
|
14
|
+
dir = project.pathmap("%d")
|
15
|
+
Dir.chdir(dir) do
|
16
|
+
spec_task = Rake::Task[:spec]
|
17
|
+
spec_task.invoke()
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
require 'puppet-lint/tasks/puppet-lint'
|
23
|
+
|
24
|
+
# see https://github.com/rodjek/puppet-lint/issues/331
|
25
|
+
Rake::Task[:lint].clear
|
26
|
+
|
27
|
+
PuppetLint::RakeTask.new :lint do |config|
|
28
|
+
config.pattern = 'static-modules/**/*.pp'
|
29
|
+
config.ignore_paths = ['modules']
|
30
|
+
config.disable_checks = ['80chars']
|
31
|
+
config.with_context = true
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
desc "Run serverspec to all hosts"
|
36
|
+
task :spec => 'serverspec:all'
|
37
|
+
|
38
|
+
class ServerspecTask < RSpec::Core::RakeTask
|
39
|
+
|
40
|
+
attr_accessor :target
|
41
|
+
|
42
|
+
def spec_command
|
43
|
+
cmd = super
|
44
|
+
"env TARGET_HOST=#{target} #{cmd}"
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
namespace :serverspec do
|
50
|
+
|
51
|
+
%w(<%=@name%>).each do |profile|
|
52
|
+
ServerspecTask.new(profile.to_sym) do |t|
|
53
|
+
t.target = profile
|
54
|
+
t.pattern = "spec/#{profile}/*_spec.rb"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
<% if(@options[:bench_enable]) %>
|
60
|
+
require 'gruff'
|
61
|
+
require 'json'
|
62
|
+
|
63
|
+
PLOTS = 'plots'
|
64
|
+
|
65
|
+
namespace :plot do
|
66
|
+
|
67
|
+
directory PLOTS
|
68
|
+
|
69
|
+
task :hosts => [PLOTS] do
|
70
|
+
hosts = IO.readlines('benchmark.json').map {|b|
|
71
|
+
JSON.parse(b,{:symbolize_names => true })
|
72
|
+
}.group_by {|m|
|
73
|
+
m[:host]
|
74
|
+
}
|
75
|
+
|
76
|
+
g = Gruff::Line.new
|
77
|
+
g.title = 'All Hosts side by side'
|
78
|
+
g.labels = Hash[hosts.keys.each_with_index.map {|i,h| [h , i]}]
|
79
|
+
g.labels.each_pair {|i, l|
|
80
|
+
g.data(l, hosts[l].map {|h| h[:total] })
|
81
|
+
}
|
82
|
+
g.write("#{PLOTS}/all_hosts.png")
|
83
|
+
end
|
84
|
+
|
85
|
+
task :per_host => [PLOTS] do
|
86
|
+
hosts = IO.readlines('benchmark.json').map {|b|
|
87
|
+
JSON.parse(b,{:symbolize_names => true })
|
88
|
+
}.group_by {|m|
|
89
|
+
m[:host]
|
90
|
+
}
|
91
|
+
|
92
|
+
hosts.each_pair {|h,data|
|
93
|
+
g = Gruff::Line.new
|
94
|
+
g.title = h
|
95
|
+
g.labels = {0 => h}
|
96
|
+
g.data(h, data.map {|d| d[:total] })
|
97
|
+
g.write("#{PLOTS}/#{h}.png")
|
98
|
+
}
|
99
|
+
end
|
100
|
+
end
|
101
|
+
<% end %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opskeleton
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- narkisr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -151,11 +151,11 @@ files:
|
|
151
151
|
- templates/LICENSE-2.0.txt
|
152
152
|
- templates/README.erb
|
153
153
|
- templates/chef/Cheffile
|
154
|
-
- templates/chef/
|
154
|
+
- templates/chef/Gemfile.erb
|
155
|
+
- templates/chef/Rakefile.erb
|
155
156
|
- templates/chef/boot.sh
|
156
157
|
- templates/chef/dna.json.erb
|
157
158
|
- templates/chef/environments/dev.rb
|
158
|
-
- templates/chef/gemfile
|
159
159
|
- templates/chef/gitignore
|
160
160
|
- templates/chef/opsk.yaml
|
161
161
|
- templates/chef/roles.erb
|
@@ -171,13 +171,13 @@ files:
|
|
171
171
|
- templates/module/Rakefile.erb
|
172
172
|
- templates/module/spec_helper.rb
|
173
173
|
- templates/parent/spec/default/stub_spec.rb
|
174
|
-
- templates/parent/spec/spec_helper.
|
174
|
+
- templates/parent/spec/spec_helper.erb
|
175
175
|
- templates/parent/travis.erb
|
176
|
-
- templates/puppet/
|
176
|
+
- templates/puppet/Gemfile.erb
|
177
|
+
- templates/puppet/Rakefile.erb
|
177
178
|
- templates/puppet/boot.sh
|
178
179
|
- templates/puppet/default.erb
|
179
180
|
- templates/puppet/docker/ubuntu_docker.erb
|
180
|
-
- templates/puppet/gemfile
|
181
181
|
- templates/puppet/opsk.yaml
|
182
182
|
- templates/puppet/run.sh
|
183
183
|
- templates/puppet/scripts/lookup.rb
|
data/templates/chef/Rakefile
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'rake'
|
2
|
-
require 'rspec/core/rake_task'
|
3
|
-
|
4
|
-
RSpec::Core::RakeTask.new(:spec) do |t|
|
5
|
-
t.pattern = 'spec/*/*_spec.rb'
|
6
|
-
end
|
7
|
-
|
8
|
-
task :default => :spec
|
9
|
-
|
10
|
-
desc "Run serverspec to all hosts"
|
11
|
-
task :spec => 'serverspec:all'
|
12
|
-
|
13
|
-
class ServerspecTask < RSpec::Core::RakeTask
|
14
|
-
|
15
|
-
attr_accessor :target
|
16
|
-
|
17
|
-
def spec_command
|
18
|
-
cmd = super
|
19
|
-
"env TARGET_HOST=#{target} #{cmd}"
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
|
-
namespace :serverspec do
|
25
|
-
|
26
|
-
%w(<%=@name%>).each do |profile|
|
27
|
-
ServerspecTask.new(profile.to_sym) do |t|
|
28
|
-
t.target = profile
|
29
|
-
t.pattern = "spec/#{profile}/*_spec.rb"
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
task :default => 'serverspec:minimal'
|
data/templates/chef/gemfile
DELETED
data/templates/puppet/Rakefile
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
require 'rake'
|
2
|
-
require 'rspec/core/rake_task'
|
3
|
-
|
4
|
-
RSpec::Core::RakeTask.new(:spec) do |t|
|
5
|
-
t.pattern = 'spec/*/*_spec.rb'
|
6
|
-
end
|
7
|
-
|
8
|
-
task :default => :spec
|
9
|
-
|
10
|
-
task :modspec do
|
11
|
-
FileList["static-modules/**/Rakefile"].each do |project|
|
12
|
-
Rake::Task.clear
|
13
|
-
load project
|
14
|
-
dir = project.pathmap("%d")
|
15
|
-
Dir.chdir(dir) do
|
16
|
-
spec_task = Rake::Task[:spec]
|
17
|
-
spec_task.invoke()
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
require 'puppet-lint/tasks/puppet-lint'
|
23
|
-
PuppetLint.configuration.ignore_paths =['modules/**/*', 'vendor/**/*']
|
24
|
-
PuppetLint.configuration.send("disable_80chars")
|
25
|
-
|
26
|
-
desc "Run serverspec to all hosts"
|
27
|
-
task :spec => 'serverspec:all'
|
28
|
-
|
29
|
-
class ServerspecTask < RSpec::Core::RakeTask
|
30
|
-
|
31
|
-
attr_accessor :target
|
32
|
-
|
33
|
-
def spec_command
|
34
|
-
cmd = super
|
35
|
-
"env TARGET_HOST=#{target} #{cmd}"
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
|
40
|
-
namespace :serverspec do
|
41
|
-
|
42
|
-
%w(<%=@name%>).each do |profile|
|
43
|
-
ServerspecTask.new(profile.to_sym) do |t|
|
44
|
-
t.target = profile
|
45
|
-
t.pattern = "spec/#{profile}/*_spec.rb"
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
task :default => 'serverspec:minimal'
|
data/templates/puppet/gemfile
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
|
3
|
-
# base
|
4
|
-
gem 'puppet'
|
5
|
-
|
6
|
-
# testing
|
7
|
-
gem 'rspec-puppet'
|
8
|
-
gem 'puppetlabs_spec_helper', '>= 0.1.0'
|
9
|
-
gem 'serverspec', '~> 1.14.0'
|
10
|
-
|
11
|
-
# build
|
12
|
-
gem 'puppet-lint'
|
13
|
-
gem 'rake'
|
14
|
-
gem 'librarian-puppet'
|
15
|
-
gem 'opskeleton'
|