meez 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/Dockerfile +13 -0
- data/Gemfile +11 -0
- data/README.md +137 -0
- data/lib/meez/meez.rb +43 -180
- data/meez.gemspec +23 -0
- data/templates/.kitchen.yml.erb +14 -0
- data/templates/Rakefile.erb +33 -0
- data/templates/Vagrantfile.erb +19 -0
- data/templates/chefspec/default_spec.rb.erb +15 -0
- data/templates/chefspec/spec_helper.rb.erb +19 -0
- data/templates/serverspec/default_spec.rb.erb +7 -0
- data/templates/serverspec/spec_helper.rb.erb +11 -0
- metadata +27 -5
- checksums.yaml +0 -15
data/.gitignore
ADDED
data/Dockerfile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
FROM racker/precise-with-updates
|
2
|
+
|
3
|
+
RUN apt-get -yqq update && apt-get -yqq install ruby1.9.1-dev build-essential libxml2-dev libxslt-dev git curl wget
|
4
|
+
|
5
|
+
RUN gem install bundler
|
6
|
+
|
7
|
+
RUN wget -q -O /tmp/vagrant.deb http://files.vagrantup.com/packages/a40522f5fabccb9ddabad03d836e120ff5d14093/vagrant_1.3.5_x86_64.deb \
|
8
|
+
&& dpkg -i /tmp/vagrant.deb \
|
9
|
+
&& rm /tmp/vagrant.deb
|
10
|
+
|
11
|
+
ADD Gemfile /source/Gemfile
|
12
|
+
|
13
|
+
RUN cd /source && bundle install
|
data/Gemfile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gem 'chefspec', '~> 3.2'
|
4
|
+
gem 'foodcritic', '~> 3.0'
|
5
|
+
gem 'rubocop', '~> 0.18'
|
6
|
+
gem 'chef', '~> 11.8'
|
7
|
+
gem 'berkshelf', '~> 2.0'
|
8
|
+
gem 'test-kitchen', '~> 1.1'
|
9
|
+
gem 'serverspec', '~> 0.14'
|
10
|
+
gem 'strainer', '~> 3.3'
|
11
|
+
gem 'rake'
|
data/README.md
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
Meez
|
2
|
+
----
|
3
|
+
|
4
|
+
About
|
5
|
+
=====
|
6
|
+
|
7
|
+
`Meez` is slang for `mise en place`
|
8
|
+
|
9
|
+
`Mise en place` is a French phrase which means "putting in place", as in set up. It is used in professional kitchens to refer to organizing and arranging the ingredients (e.g., cuts of meat, relishes, sauces, par-cooked items, spices, freshly chopped vegetables, and other components) that a cook will require for the menu items that he or she expects to prepare during his/her shift.[1] The practice is also effective in home kitchens.
|
10
|
+
|
11
|
+
`Meez` will create an opinionated chef cookbook skeleton complete with testing suite.
|
12
|
+
|
13
|
+
Install
|
14
|
+
=======
|
15
|
+
|
16
|
+
`gem install meez`
|
17
|
+
|
18
|
+
Usage
|
19
|
+
=====
|
20
|
+
|
21
|
+
```
|
22
|
+
Usage: meez [options] <cookbook name>
|
23
|
+
|
24
|
+
Options
|
25
|
+
-o, --cookbook-path USERNAME The directory where the cookbook will be created
|
26
|
+
-C, --copyright COPYRIGHT_HOLDER The name of the copyright holder.
|
27
|
+
-I, --license LICENSE The type of license under which a cookbook is distributed: apachev2, gplv2, gplv3, mit, or none (default).
|
28
|
+
-m, --email EMAIL The email address for the individual who maintains the cookbook.
|
29
|
+
-h, --help help
|
30
|
+
```
|
31
|
+
|
32
|
+
### Example
|
33
|
+
|
34
|
+
```
|
35
|
+
$ meez --cookbook-path /tmp --copyright Foo -I apachev2 -m foo@bah.com test
|
36
|
+
* Initializing Cookbook
|
37
|
+
** Creating cookbook test
|
38
|
+
** Creating README for cookbook: test
|
39
|
+
** Creating CHANGELOG for cookbook: test
|
40
|
+
** Creating metadata for cookbook: test
|
41
|
+
Rewriting metadata.rb
|
42
|
+
Rewriting recipes/default.rb
|
43
|
+
* Initializing Berkshelf
|
44
|
+
create /tmp/test/Berksfile
|
45
|
+
create /tmp/test/Thorfile
|
46
|
+
create /tmp/test/.gitignore
|
47
|
+
run git init from "/tmp/test"
|
48
|
+
create /tmp/test/Gemfile
|
49
|
+
* Initializing Vagranfile
|
50
|
+
* Initializing Knife
|
51
|
+
Append Gemfile
|
52
|
+
* Initializing Rakefile
|
53
|
+
Creating /tmp/test/Rakefile
|
54
|
+
* Initializing Rubocop
|
55
|
+
Append Gemfile
|
56
|
+
* Initializing Food Critic
|
57
|
+
Append Gemfile
|
58
|
+
* Initializing Chef Spec
|
59
|
+
Creating /tmp/test/test/unit/spec/spec_helper.rb
|
60
|
+
Creating /tmp/test/test/unit/spec/default_spec.rb
|
61
|
+
Append Gemfile
|
62
|
+
* Initializing Server Spec
|
63
|
+
Creating /tmp/test/test/integration/default/serverspec/spec_helper.rb
|
64
|
+
Creating /tmp/test/test/integration/default/serverspec/default_spec.rb
|
65
|
+
Append Gemfile
|
66
|
+
* Initializing Test Kitchen
|
67
|
+
create .kitchen.yml
|
68
|
+
append Rakefile
|
69
|
+
append Thorfile
|
70
|
+
exist test/integration/default
|
71
|
+
append .gitignore
|
72
|
+
append .gitignore
|
73
|
+
append Gemfile
|
74
|
+
append Gemfile
|
75
|
+
You must run `bundle install' to fetch any new gems.
|
76
|
+
Cookbook test created successfully
|
77
|
+
Next steps...
|
78
|
+
$ cd /tmp/test
|
79
|
+
$ bundle install
|
80
|
+
$ bundle exec berks install
|
81
|
+
|
82
|
+
$ cd /tmp/test
|
83
|
+
$ bundle install
|
84
|
+
Fetching gem metadata from https://rubygems.org/
|
85
|
+
Fetching additional metadata from https://rubygems.org/
|
86
|
+
Resolving dependencies...
|
87
|
+
...
|
88
|
+
...
|
89
|
+
Your bundle is complete!
|
90
|
+
$ bundle exec berks install
|
91
|
+
Using test (0.1.0) from metadata
|
92
|
+
$ bundle exec rake -T
|
93
|
+
rake integration # Run Test Kitchen integration tests
|
94
|
+
rake kitchen:all # Run all test instances
|
95
|
+
rake kitchen:default-ubuntu-1204 # Run default-ubuntu-1204 test instance
|
96
|
+
rake spec # Run ChefSpec unit tests
|
97
|
+
rake style # Run all style checks
|
98
|
+
rake style:chef # Lint Chef cookbooks
|
99
|
+
rake style:ruby # Run Ruby style checks
|
100
|
+
```
|
101
|
+
|
102
|
+
Contributing
|
103
|
+
------------
|
104
|
+
|
105
|
+
e.g.
|
106
|
+
|
107
|
+
1. Fork the repository on Github
|
108
|
+
2. Create a named feature branch (like `add_component_x`)
|
109
|
+
3. Write your change
|
110
|
+
4. Write tests for your change (if applicable)
|
111
|
+
5. Run the tests, ensuring they all pass
|
112
|
+
6. Submit a Pull Request using Github
|
113
|
+
|
114
|
+
License and Authors
|
115
|
+
-------------------
|
116
|
+
|
117
|
+
Authors:
|
118
|
+
========
|
119
|
+
|
120
|
+
Paul Czarkowski - paul.czarkowski@rackspace.com
|
121
|
+
|
122
|
+
License:
|
123
|
+
========
|
124
|
+
|
125
|
+
Copyright 2014 Paul Czarkowski, Rackspace Inc.
|
126
|
+
|
127
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
128
|
+
you may not use this file except in compliance with the License.
|
129
|
+
You may obtain a copy of the License at
|
130
|
+
|
131
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
132
|
+
|
133
|
+
Unless required by applicable law or agreed to in writing, software
|
134
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
135
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
136
|
+
See the License for the specific language governing permissions and
|
137
|
+
limitations under the License.
|
data/lib/meez/meez.rb
CHANGED
@@ -14,7 +14,33 @@ class Meez
|
|
14
14
|
init_chefspec(cookbook_name, options)
|
15
15
|
init_serverspec(cookbook_name, options)
|
16
16
|
init_kitchenci(cookbook_name, options)
|
17
|
-
|
17
|
+
##bundle_install(cookbook_name, options)
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.write_template(name, path, cookbook_name, options)
|
21
|
+
require 'erb'
|
22
|
+
template = File.join(File.dirname(__FILE__), "../../templates", name)
|
23
|
+
target = File.join(path, File.basename(name, '.erb'))
|
24
|
+
puts "\tCreating #{target} from template"
|
25
|
+
content = ERB.new File.new(template).read
|
26
|
+
File.open(target, 'w') { |f| f.write(content.result(binding)) }
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.append_file(file, content)
|
30
|
+
File.open(file, 'a') { |f| f.write("#{content}\n") }
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.add_gem(cookbook_path, name, version=nil)
|
34
|
+
puts "adding #{name} gem to Gemfile"
|
35
|
+
if version
|
36
|
+
append_file(File.join(cookbook_path, 'Gemfile'), "gem '#{name}', '#{version}'" )
|
37
|
+
else
|
38
|
+
append_file(File.join(cookbook_path, 'Gemfile'), "gem '#{name}'" )
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.gitignore(cookbook_path, file)
|
43
|
+
append_file(File.join(cookbook_path, '.gitignore'), file)
|
18
44
|
end
|
19
45
|
|
20
46
|
def self.init_cookbook(cookbook_name, options)
|
@@ -63,7 +89,7 @@ class Meez
|
|
63
89
|
skip_vagrant: true
|
64
90
|
}
|
65
91
|
).invoke_all
|
66
|
-
|
92
|
+
append_file(File.join(path, 'Berksfile'), "metadata")
|
67
93
|
end
|
68
94
|
|
69
95
|
def self.init_kitchenci(cookbook_name, options)
|
@@ -72,54 +98,13 @@ class Meez
|
|
72
98
|
require 'kitchen'
|
73
99
|
require 'kitchen/generator/init'
|
74
100
|
Kitchen::Generator::Init.new([], {}, destination_root: path).invoke_all
|
75
|
-
|
76
|
-
contents = <<-EOF
|
77
|
-
---
|
78
|
-
driver:
|
79
|
-
name: vagrant
|
80
|
-
|
81
|
-
provisioner:
|
82
|
-
name: chef_solo
|
83
|
-
|
84
|
-
platforms:
|
85
|
-
- name: ubuntu-12.04
|
86
|
-
|
87
|
-
suites:
|
88
|
-
- name: default
|
89
|
-
run_list: recipe[#{cookbook_name}::default]
|
90
|
-
attributes:
|
91
|
-
EOF
|
92
|
-
file.write(contents)
|
93
|
-
end
|
101
|
+
write_template('.kitchen.yml.erb', path, cookbook_name, options)
|
94
102
|
end
|
95
103
|
|
96
104
|
def self.init_vagrant(cookbook_name, options)
|
97
105
|
puts '* Initializing Vagranfile'
|
98
106
|
path = File.join(options[:path], cookbook_name)
|
99
|
-
|
100
|
-
contents = <<-EOF
|
101
|
-
# -*- mode: ruby -*-
|
102
|
-
# vi: set ft=ruby :
|
103
|
-
|
104
|
-
Vagrant.configure('2') do |config|
|
105
|
-
config.vm.hostname = '#{cookbook_name}'
|
106
|
-
config.vm.box = 'ubuntu-12.04'
|
107
|
-
config.vm.box_url = "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_\#{config.vm.box}_chef-provisionerless.box"
|
108
|
-
config.omnibus.chef_version = 'latest'
|
109
|
-
config.berkshelf.enabled = true
|
110
|
-
|
111
|
-
config.vm.provision :chef_solo do |chef|
|
112
|
-
chef.json = {
|
113
|
-
}
|
114
|
-
|
115
|
-
chef.run_list = [
|
116
|
-
'recipe[#{cookbook_name}::default]'
|
117
|
-
]
|
118
|
-
end
|
119
|
-
end
|
120
|
-
EOF
|
121
|
-
file.write(contents)
|
122
|
-
end
|
107
|
+
write_template('Vagrantfile.erb', path, cookbook_name, options)
|
123
108
|
end
|
124
109
|
|
125
110
|
def self.init_chefspec(cookbook_name, options)
|
@@ -127,126 +112,35 @@ end
|
|
127
112
|
path = File.join(options[:path], cookbook_name)
|
128
113
|
spec_path = File.join(path, 'test', 'unit', 'spec')
|
129
114
|
FileUtils.mkdir_p(spec_path)
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
# Encoding: utf-8
|
135
|
-
require 'chefspec'
|
136
|
-
require 'chefspec/berkshelf'
|
137
|
-
require 'chef/application'
|
138
|
-
|
139
|
-
::LOG_LEVEL = :fatal
|
140
|
-
::UBUNTU_OPTS = {
|
141
|
-
platform: 'ubuntu',
|
142
|
-
version: '12.04',
|
143
|
-
log_level: ::LOG_LEVEL
|
144
|
-
}
|
145
|
-
::CHEFSPEC_OPTS = {
|
146
|
-
log_level: ::LOG_LEVEL
|
147
|
-
}
|
148
|
-
|
149
|
-
def stub_resources
|
150
|
-
end
|
151
|
-
|
152
|
-
at_exit { ChefSpec::Coverage.report! }
|
153
|
-
EOF
|
154
|
-
file.write(contents)
|
155
|
-
end
|
156
|
-
|
157
|
-
puts "\tCreating #{File.join(spec_path, 'default_spec.rb')}"
|
158
|
-
File.open(File.join(spec_path, 'default_spec.rb'), 'w') do |file|
|
159
|
-
contents = <<-EOF
|
160
|
-
# Encoding: utf-8
|
161
|
-
|
162
|
-
require_relative 'spec_helper'
|
163
|
-
|
164
|
-
describe '#{cookbook_name}::default' do
|
165
|
-
before { stub_resources }
|
166
|
-
describe 'ubuntu' do
|
167
|
-
let(:chef_run) { ChefSpec::Runner.new.converge(described_recipe) }
|
168
|
-
|
169
|
-
it 'writes some chefspec code' do
|
170
|
-
pending 'todo'
|
171
|
-
end
|
172
|
-
|
173
|
-
end
|
174
|
-
end
|
175
|
-
EOF
|
176
|
-
file.write(contents)
|
177
|
-
end
|
178
|
-
|
179
|
-
puts "\tAppend .gitignore"
|
180
|
-
File.open(File.join(path, '.gitignore'), 'a') { |f| f.write(".coverage/*\n") }
|
181
|
-
puts "\tAppend Gemfile"
|
182
|
-
File.open(File.join(path, 'Gemfile'), 'a') { |f| f.write("gem 'chefspec', '~> 3.2'\n") }
|
115
|
+
write_template('chefspec/spec_helper.rb.erb', spec_path, cookbook_name, options)
|
116
|
+
write_template('chefspec/default_spec.rb.erb', spec_path, cookbook_name, options)
|
117
|
+
gitignore(path, '.coverage/*')
|
118
|
+
add_gem(path, 'chefspec', '~> 3.2')
|
183
119
|
end
|
184
120
|
|
185
121
|
def self.init_rakefile(cookbook_name, options)
|
186
122
|
puts '* Initializing Rakefile'
|
187
123
|
path = File.join(options[:path], cookbook_name)
|
188
|
-
|
189
|
-
|
190
|
-
contents = <<-EOF
|
191
|
-
# Encoding: utf-8
|
192
|
-
require 'bundler/setup'
|
193
|
-
|
194
|
-
namespace :style do
|
195
|
-
require 'rubocop/rake_task'
|
196
|
-
desc 'Run Ruby style checks'
|
197
|
-
Rubocop::RakeTask.new(:ruby)
|
198
|
-
|
199
|
-
require 'foodcritic'
|
200
|
-
desc 'Run Chef style checks'
|
201
|
-
FoodCritic::Rake::LintTask.new(:chef)
|
202
|
-
end
|
203
|
-
|
204
|
-
desc 'Run all style checks'
|
205
|
-
task style: ['style:chef', 'style:ruby']
|
206
|
-
|
207
|
-
require 'kitchen'
|
208
|
-
desc 'Run Test Kitchen integration tests'
|
209
|
-
task :integration do
|
210
|
-
Kitchen.logger = Kitchen.default_file_logger
|
211
|
-
Kitchen::Config.new.instances.each do |instance|
|
212
|
-
instance.test(:always)
|
213
|
-
end
|
214
|
-
end
|
215
|
-
|
216
|
-
require 'rspec/core/rake_task'
|
217
|
-
desc 'Run ChefSpec unit tests'
|
218
|
-
RSpec::Core::RakeTask.new(:spec) do |t, args|
|
219
|
-
t.rspec_opts = 'test/unit/spec'
|
220
|
-
end
|
221
|
-
|
222
|
-
# The default rake task should just run it all
|
223
|
-
task default: ['style', 'spec', 'integration']
|
224
|
-
EOF
|
225
|
-
file.write(contents)
|
226
|
-
end
|
227
|
-
puts "\tAppend Gemfile"
|
228
|
-
File.open(File.join(path, 'Gemfile'), 'a') { |f| f.write("gem 'rake'\n") }
|
124
|
+
write_template('Rakefile.erb', path, cookbook_name, options)
|
125
|
+
add_gem(path, 'rake')
|
229
126
|
end
|
230
127
|
|
231
128
|
def self.init_rubocop(cookbook_name, options)
|
232
129
|
puts '* Initializing Rubocop'
|
233
130
|
path = File.join(options[:path], cookbook_name)
|
234
|
-
|
235
|
-
File.open(File.join(path, 'Gemfile'), 'a') { |f| f.write("gem 'rubocop', '~> 0.18'\n") }
|
131
|
+
add_gem(path, 'rubocop', '~> 0.18')
|
236
132
|
end
|
237
133
|
|
238
134
|
def self.init_knife(cookbook_name, options)
|
239
135
|
puts '* Initializing Knife'
|
240
136
|
path = File.join(options[:path], cookbook_name)
|
241
|
-
|
242
|
-
File.open(File.join(path, 'Gemfile'), 'a') { |f| f.write("gem 'chef', '~> 11.8'\n") }
|
137
|
+
add_gem(path, 'chef', '~> 11.8')
|
243
138
|
end
|
244
139
|
|
245
140
|
def self.init_foodcritic(cookbook_name, options)
|
246
141
|
puts '* Initializing Food Critic'
|
247
142
|
path = File.join(options[:path], cookbook_name)
|
248
|
-
|
249
|
-
File.open(File.join(path, 'Gemfile'), 'a') { |f| f.write("gem 'foodcritic', '~> 3.0.0'\n") }
|
143
|
+
add_gem(path, 'foodcritic', '~> 3.0')
|
250
144
|
end
|
251
145
|
|
252
146
|
def self.init_serverspec(cookbook_name, options)
|
@@ -254,41 +148,9 @@ task default: ['style', 'spec', 'integration']
|
|
254
148
|
path = File.join(options[:path], cookbook_name)
|
255
149
|
spec_path = File.join(path, 'test', 'integration', 'default', 'serverspec')
|
256
150
|
FileUtils.mkdir_p(spec_path)
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
contents = <<-EOF
|
261
|
-
# Encoding: utf-8
|
262
|
-
require 'serverspec'
|
263
|
-
|
264
|
-
include Serverspec::Helper::Exec
|
265
|
-
include Serverspec::Helper::DetectOS
|
266
|
-
|
267
|
-
RSpec.configure do |c|
|
268
|
-
c.before :all do
|
269
|
-
c.path = '/sbin:/usr/bin'
|
270
|
-
end
|
271
|
-
end
|
272
|
-
EOF
|
273
|
-
file.write(contents)
|
274
|
-
end
|
275
|
-
|
276
|
-
puts "\tCreating #{File.join(spec_path, 'default_spec.rb')}"
|
277
|
-
File.open(File.join(spec_path, 'default_spec.rb'), 'w') do |file|
|
278
|
-
contents = <<-EOF
|
279
|
-
# Encoding: utf-8
|
280
|
-
|
281
|
-
require_relative 'spec_helper'
|
282
|
-
|
283
|
-
describe 'default' do
|
284
|
-
it { pending 'write some tests' }
|
285
|
-
end
|
286
|
-
EOF
|
287
|
-
file.write(contents)
|
288
|
-
end
|
289
|
-
|
290
|
-
puts "\tAppend Gemfile"
|
291
|
-
File.open(File.join(path, 'Gemfile'), 'a') { |f| f.write("gem 'serverspec', '~> 0.14.2'\n") }
|
151
|
+
write_template('serverspec/spec_helper.rb.erb', spec_path, cookbook_name, options)
|
152
|
+
write_template('serverspec/default_spec.rb.erb', spec_path, cookbook_name, options)
|
153
|
+
add_gem(path, 'serverspec', '~> 0.14')
|
292
154
|
end
|
293
155
|
|
294
156
|
def self.bundle_install(cookbook_name, options)
|
@@ -298,4 +160,5 @@ end
|
|
298
160
|
puts "\t append .gitignore"
|
299
161
|
Bundler.with_clean_env { exec({ 'BUNDLE_GEMFILE' => '/tmp/test/Gemfile' }, 'bundle install') }
|
300
162
|
end
|
163
|
+
|
301
164
|
end
|
data/meez.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = %q{meez}
|
3
|
+
s.version = '0.1.2'
|
4
|
+
s.date = %q{2014-01-08}
|
5
|
+
s.summary = 'Initializes a chef cookbook with TDD framework'
|
6
|
+
s.description = <<EOF
|
7
|
+
`Meez` (slang for `mise en place`) will create an opinionated chef cookbook skeleton complete with testing suite including:
|
8
|
+
berkshelf, chefspec, test kitchen, foodcritic, server spec
|
9
|
+
|
10
|
+
EOF
|
11
|
+
s.files = %x{git ls-files}.split("\n")
|
12
|
+
|
13
|
+
s.executables = ['meez']
|
14
|
+
s.authors = ['Paul Czarkowski']
|
15
|
+
s.email = 'paul.czarkowski@rackspace.com'
|
16
|
+
s.homepage = 'http://github.com/paulczar/meez'
|
17
|
+
s.license = 'apache2'
|
18
|
+
s.require_paths = ['lib']
|
19
|
+
s.add_dependency 'chef', '~> 11.8.0'
|
20
|
+
s.add_dependency 'test-kitchen', '~> 1.1.1'
|
21
|
+
s.add_dependency 'bundler', '~> 1.5.1'
|
22
|
+
s.add_dependency 'berkshelf', '~> 2.0.12'
|
23
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Encoding: utf-8
|
2
|
+
require 'bundler/setup'
|
3
|
+
|
4
|
+
namespace :style do
|
5
|
+
require 'rubocop/rake_task'
|
6
|
+
desc 'Run Ruby style checks'
|
7
|
+
Rubocop::RakeTask.new(:ruby)
|
8
|
+
|
9
|
+
require 'foodcritic'
|
10
|
+
desc 'Run Chef style checks'
|
11
|
+
FoodCritic::Rake::LintTask.new(:chef)
|
12
|
+
end
|
13
|
+
|
14
|
+
desc 'Run all style checks'
|
15
|
+
task style: ['style:chef', 'style:ruby']
|
16
|
+
|
17
|
+
require 'kitchen'
|
18
|
+
desc 'Run Test Kitchen integration tests'
|
19
|
+
task :integration do
|
20
|
+
Kitchen.logger = Kitchen.default_file_logger
|
21
|
+
Kitchen::Config.new.instances.each do |instance|
|
22
|
+
instance.test(:always)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require 'rspec/core/rake_task'
|
27
|
+
desc 'Run ChefSpec unit tests'
|
28
|
+
RSpec::Core::RakeTask.new(:spec) do |t, args|
|
29
|
+
t.rspec_opts = 'test/unit/spec'
|
30
|
+
end
|
31
|
+
|
32
|
+
# The default rake task should just run it all
|
33
|
+
task default: ['style', 'spec', 'integration']
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
Vagrant.configure('2') do |config|
|
5
|
+
config.vm.hostname = '<%= cookbook_name %>'
|
6
|
+
config.vm.box = 'ubuntu-12.04'
|
7
|
+
config.vm.box_url = "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_#{config.vm.box}_chef-provisionerless.box"
|
8
|
+
config.omnibus.chef_version = 'latest'
|
9
|
+
config.berkshelf.enabled = true
|
10
|
+
|
11
|
+
config.vm.provision :chef_solo do |chef|
|
12
|
+
chef.json = {
|
13
|
+
}
|
14
|
+
|
15
|
+
chef.run_list = [
|
16
|
+
'recipe[<%= cookbook_name %>::default]'
|
17
|
+
]
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Encoding: utf-8
|
2
|
+
|
3
|
+
require_relative 'spec_helper'
|
4
|
+
|
5
|
+
describe '<%= cookbook_name %>::default' do
|
6
|
+
before { stub_resources }
|
7
|
+
describe 'ubuntu' do
|
8
|
+
let(:chef_run) { ChefSpec::Runner.new.converge(described_recipe) }
|
9
|
+
|
10
|
+
it 'writes some chefspec code' do
|
11
|
+
pending 'todo'
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Encoding: utf-8
|
2
|
+
require 'chefspec'
|
3
|
+
require 'chefspec/berkshelf'
|
4
|
+
require 'chef/application'
|
5
|
+
|
6
|
+
::LOG_LEVEL = :fatal
|
7
|
+
::UBUNTU_OPTS = {
|
8
|
+
platform: 'ubuntu',
|
9
|
+
version: '12.04',
|
10
|
+
log_level: ::LOG_LEVEL
|
11
|
+
}
|
12
|
+
::CHEFSPEC_OPTS = {
|
13
|
+
log_level: ::LOG_LEVEL
|
14
|
+
}
|
15
|
+
|
16
|
+
def stub_resources
|
17
|
+
end
|
18
|
+
|
19
|
+
at_exit { ChefSpec::Coverage.report! }
|
metadata
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: meez
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Paul Czarkowski
|
@@ -13,6 +14,7 @@ dependencies:
|
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: chef
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
19
|
- - ~>
|
18
20
|
- !ruby/object:Gem::Version
|
@@ -20,6 +22,7 @@ dependencies:
|
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
27
|
- - ~>
|
25
28
|
- !ruby/object:Gem::Version
|
@@ -27,6 +30,7 @@ dependencies:
|
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: test-kitchen
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
35
|
- - ~>
|
32
36
|
- !ruby/object:Gem::Version
|
@@ -34,6 +38,7 @@ dependencies:
|
|
34
38
|
type: :runtime
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
43
|
- - ~>
|
39
44
|
- !ruby/object:Gem::Version
|
@@ -41,6 +46,7 @@ dependencies:
|
|
41
46
|
- !ruby/object:Gem::Dependency
|
42
47
|
name: bundler
|
43
48
|
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
44
50
|
requirements:
|
45
51
|
- - ~>
|
46
52
|
- !ruby/object:Gem::Version
|
@@ -48,6 +54,7 @@ dependencies:
|
|
48
54
|
type: :runtime
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
51
58
|
requirements:
|
52
59
|
- - ~>
|
53
60
|
- !ruby/object:Gem::Version
|
@@ -55,6 +62,7 @@ dependencies:
|
|
55
62
|
- !ruby/object:Gem::Dependency
|
56
63
|
name: berkshelf
|
57
64
|
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
58
66
|
requirements:
|
59
67
|
- - ~>
|
60
68
|
- !ruby/object:Gem::Version
|
@@ -62,6 +70,7 @@ dependencies:
|
|
62
70
|
type: :runtime
|
63
71
|
prerelease: false
|
64
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
65
74
|
requirements:
|
66
75
|
- - ~>
|
67
76
|
- !ruby/object:Gem::Version
|
@@ -75,30 +84,43 @@ executables:
|
|
75
84
|
extensions: []
|
76
85
|
extra_rdoc_files: []
|
77
86
|
files:
|
78
|
-
-
|
87
|
+
- .gitignore
|
88
|
+
- Dockerfile
|
89
|
+
- Gemfile
|
90
|
+
- README.md
|
79
91
|
- bin/meez
|
92
|
+
- lib/meez/meez.rb
|
93
|
+
- meez.gemspec
|
94
|
+
- templates/.kitchen.yml.erb
|
95
|
+
- templates/Rakefile.erb
|
96
|
+
- templates/Vagrantfile.erb
|
97
|
+
- templates/chefspec/default_spec.rb.erb
|
98
|
+
- templates/chefspec/spec_helper.rb.erb
|
99
|
+
- templates/serverspec/default_spec.rb.erb
|
100
|
+
- templates/serverspec/spec_helper.rb.erb
|
80
101
|
homepage: http://github.com/paulczar/meez
|
81
102
|
licenses:
|
82
103
|
- apache2
|
83
|
-
metadata: {}
|
84
104
|
post_install_message:
|
85
105
|
rdoc_options: []
|
86
106
|
require_paths:
|
87
107
|
- lib
|
88
108
|
required_ruby_version: !ruby/object:Gem::Requirement
|
109
|
+
none: false
|
89
110
|
requirements:
|
90
111
|
- - ! '>='
|
91
112
|
- !ruby/object:Gem::Version
|
92
113
|
version: '0'
|
93
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
|
+
none: false
|
94
116
|
requirements:
|
95
117
|
- - ! '>='
|
96
118
|
- !ruby/object:Gem::Version
|
97
119
|
version: '0'
|
98
120
|
requirements: []
|
99
121
|
rubyforge_project:
|
100
|
-
rubygems_version:
|
122
|
+
rubygems_version: 1.8.23
|
101
123
|
signing_key:
|
102
|
-
specification_version:
|
124
|
+
specification_version: 3
|
103
125
|
summary: Initializes a chef cookbook with TDD framework
|
104
126
|
test_files: []
|
checksums.yaml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
---
|
2
|
-
!binary "U0hBMQ==":
|
3
|
-
metadata.gz: !binary |-
|
4
|
-
YWYzZmY2OWMzZTU5NmMyN2Q1ODMxZmMwNTcyODhjOTgxOTgwNmI1OQ==
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
OTViZTM5YmJjMDI0Yzk2MGQ1NTAwZDkyMzEwYmYxN2Y3MWJhNzcyZA==
|
7
|
-
SHA512:
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
ZWMyNGE5YWJlMzJmZWYzNGQxNGJkNDFiY2U4MmFkNzY5YzE5NzJkODg5OGY3
|
10
|
-
MGVkYjlkZmY5MGExMDFiMWE4NDZkYTkzZDE0ZmI3NDJjNjBjZWRlNGJiZDg5
|
11
|
-
ZWZhOTYxZDIwODYwOThiNGJmNDNmZTYyNWRjYzZiOTE2ZGEwMzg=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MDQ1MmJlODkwMTU4MDdhZTU3ZTc0NTc3Zjc3YzVhMzJjNjY4NmRlOWMxMzc4
|
14
|
-
ZGFmYWFjNjc2MDk2MzE3NzYxMTY5NTZhMDFmOGJmMmNmNTI0YzA4ZjdmZTVl
|
15
|
-
ZTFjNzBhYmM2NWYxNTFhN2FiNGI4YjU5ZmFjM2MzYTU2ZDEwZGU=
|