meez 0.0.10 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/bin/meez +0 -1
- data/lib/meez/meez.rb +78 -14
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NzZmNmI0NTFjNTE0YmJiZmQ3OGQ3ZDk5YTZiODAyMzY5MzQwNjk3Mg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZGFlZWI2MDBlODRkNWNiZmY3NDZlYjIxN2Q0ODFkNWM3MzJjNjgxYg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NTZlNjlhMGVhZGFlNzVkMjgwNTIzNDRkZDQ3MTU1NzBiZDg4ZTI2MWQzMDA4
|
10
|
+
OTBhZTYyYjY5ZWU2OTFmYjQ4ZDVjM2UxZjUxYzQ2Y2YyMmY5MDg3NThmNDlm
|
11
|
+
YjE3MDI1NTc5MjZhZTIxODk0N2RiMzU5OGJhYWNjNzFlMzU0OTg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTMyYWFiMWZlMzY5M2ZjZWEzMjcxMjAyNzg2YTgwNjFhNjM3NDA1Zjc0ZDM4
|
14
|
+
MDAzZTQxODRlZmNiMDRkOTY3MTNhYTgwZTFjMTFlZjRkYjIwYzFkY2ZjMzMz
|
15
|
+
Y2E4NmMyODNmNjc5NmIzNTJhNDBkZDAyNDBjZGNhMzA2NTU5YjM=
|
data/bin/meez
CHANGED
data/lib/meez/meez.rb
CHANGED
@@ -7,8 +7,8 @@ class Meez
|
|
7
7
|
init_cookbook(cookbook_name, options)
|
8
8
|
init_berkshelf(cookbook_name, options)
|
9
9
|
init_vagrant(cookbook_name, options)
|
10
|
-
init_strainer(cookbook_name, options)
|
11
10
|
init_knife(cookbook_name, options)
|
11
|
+
init_rakefile(cookbook_name, options)
|
12
12
|
init_rubocop(cookbook_name, options)
|
13
13
|
init_foodcritic(cookbook_name, options)
|
14
14
|
init_chefspec(cookbook_name, options)
|
@@ -72,7 +72,6 @@ class Meez
|
|
72
72
|
require 'kitchen'
|
73
73
|
require 'kitchen/generator/init'
|
74
74
|
Kitchen::Generator::Init.new([], {}, destination_root: path).invoke_all
|
75
|
-
File.open(File.join(path, 'Strainerfile'), 'a') { |f| f.write("kitchen: bundle exec kitchen test --destroy=always\n") }
|
76
75
|
File.open(File.join(path, '.kitchen.yml'), 'w') do |file|
|
77
76
|
contents = <<-EOF
|
78
77
|
---
|
@@ -177,18 +176,80 @@ end
|
|
177
176
|
file.write(contents)
|
178
177
|
end
|
179
178
|
|
179
|
+
puts "\tAppend .gitignore"
|
180
|
+
File.open(File.join(path, '.gitignore'), 'a') { |f| f.write(".coverage/*\n") }
|
180
181
|
puts "\tAppend Gemfile"
|
181
182
|
File.open(File.join(path, 'Gemfile'), 'a') { |f| f.write("gem 'chefspec', '~> 3.2'\n") }
|
182
|
-
File.open(File.join(path, 'Strainerfile'), 'a') { |f| f.write("chefspec: bundle exec rspec $SANDBOX/$COOKBOOK/test/unit/spec\n") }
|
183
183
|
end
|
184
184
|
|
185
|
-
def self.
|
186
|
-
puts '* Initializing
|
185
|
+
def self.init_rakefile(cookbook_name, options)
|
186
|
+
puts '* Initializing Rakefile'
|
187
187
|
path = File.join(options[:path], cookbook_name)
|
188
|
-
puts "\
|
189
|
-
File.open(File.join(path, '
|
188
|
+
puts "\t Creating #{File.join(path, 'Rakefile')}"
|
189
|
+
File.open(File.join(path, 'Rakefile'), 'w') do |file|
|
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
|
+
desc "Runs knife cookbook test"
|
223
|
+
task :knife do
|
224
|
+
Rake::Task[:prepare_sandbox].execute
|
225
|
+
sh "bundle exec knife cookbook test #{cookbook_name} -c test/.chef/knife.rb -o \#{sandbox_path}/../"
|
226
|
+
Rake::Task[:nuke_sandbox].execute
|
227
|
+
end
|
228
|
+
|
229
|
+
task :prepare_sandbox do
|
230
|
+
files = %w{*.md *.rb attributes definitions files libraries providers recipes resources templates}
|
231
|
+
|
232
|
+
rm_rf sandbox_path
|
233
|
+
mkdir_p sandbox_path
|
234
|
+
cp_r Dir.glob("{\#{files.join(',')}}"), sandbox_path
|
235
|
+
end
|
236
|
+
|
237
|
+
task :nuke_sandbox do
|
238
|
+
rm_rf sandbox_path
|
239
|
+
end
|
240
|
+
|
241
|
+
private
|
242
|
+
def sandbox_path
|
243
|
+
File.join(%w( / tmp cookbooks #{cookbook_name} ))
|
244
|
+
end
|
245
|
+
|
246
|
+
# The default rake task should just run it all
|
247
|
+
task default: ['style', 'knife', 'spec', 'integration']
|
248
|
+
EOF
|
249
|
+
file.write(contents)
|
250
|
+
end
|
190
251
|
puts "\tAppend Gemfile"
|
191
|
-
File.open(File.join(path, 'Gemfile'), 'a') { |f| f.write("gem '
|
252
|
+
File.open(File.join(path, 'Gemfile'), 'a') { |f| f.write("gem 'rake'\n") }
|
192
253
|
end
|
193
254
|
|
194
255
|
def self.init_rubocop(cookbook_name, options)
|
@@ -196,8 +257,6 @@ end
|
|
196
257
|
path = File.join(options[:path], cookbook_name)
|
197
258
|
puts "\tAppend Gemfile"
|
198
259
|
File.open(File.join(path, 'Gemfile'), 'a') { |f| f.write("gem 'rubocop', '~> 0.18'\n") }
|
199
|
-
puts "\tAppend Strainerfile"
|
200
|
-
File.open(File.join(path, 'Strainerfile'), 'a') { |f| f.write("rubocop: bundle exec rubocop $COOKBOOK\n") }
|
201
260
|
end
|
202
261
|
|
203
262
|
def self.init_knife(cookbook_name, options)
|
@@ -205,8 +264,15 @@ end
|
|
205
264
|
path = File.join(options[:path], cookbook_name)
|
206
265
|
puts "\tAppend Gemfile"
|
207
266
|
File.open(File.join(path, 'Gemfile'), 'a') { |f| f.write("gem 'chef', '~> 11.8'\n") }
|
208
|
-
|
209
|
-
|
267
|
+
config_path = File.join(path, 'test', '.chef')
|
268
|
+
FileUtils.mkdir_p(config_path)
|
269
|
+
File.open(File.join(config_path, 'knife.rb'), 'w') do |file|
|
270
|
+
contents = <<-EOF
|
271
|
+
cache_type 'BasicFile'
|
272
|
+
cache_options(:path => "\#{ENV['HOME']}/.chef/checksums")
|
273
|
+
EOF
|
274
|
+
file.write(contents)
|
275
|
+
end
|
210
276
|
end
|
211
277
|
|
212
278
|
def self.init_foodcritic(cookbook_name, options)
|
@@ -214,8 +280,6 @@ end
|
|
214
280
|
path = File.join(options[:path], cookbook_name)
|
215
281
|
puts "\tAppend Gemfile"
|
216
282
|
File.open(File.join(path, 'Gemfile'), 'a') { |f| f.write("gem 'foodcritic', '~> 3.0.0'\n") }
|
217
|
-
puts "\tAppend Strainerfile"
|
218
|
-
File.open(File.join(path, 'Strainerfile'), 'a') { |f| f.write("foodcritic: bundle exec foodcritic -f any $SANDBOX/$COOKBOOK\n") }
|
219
283
|
end
|
220
284
|
|
221
285
|
def self.init_serverspec(cookbook_name, options)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: meez
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Czarkowski
|
@@ -68,7 +68,7 @@ dependencies:
|
|
68
68
|
version: 2.0.12
|
69
69
|
description: ! "`Meez` (slang for `mise en place`) will create an opinionated chef
|
70
70
|
cookbook skeleton complete with testing suite including:\n berkshelf, chefspec,
|
71
|
-
test kitchen,
|
71
|
+
test kitchen, foodcritic, server spec\n\n"
|
72
72
|
email: paul.czarkowski@rackspace.com
|
73
73
|
executables:
|
74
74
|
- meez
|