forked from bloomberg/chef-bach
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
48 lines (41 loc) · 1.12 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env rake
require 'mixlib/shellout'
chef_version = '12.19.36'
namespace :style do
desc 'Style check with rubocop'
task :rubocop do
ENV['RUBOCOP_OPTS'] = '--out rubocop.log' if ENV['CI']
# Force a zero exit code until we fix all the cops (someday)
sh '/opt/chefdk/embedded/bin/rubocop || true'
end
desc 'Style check with foodcritic'
task :foodcritic do
foodcritic_output = '> foodcritic.log' if ENV['CI']
sh '/opt/chefdk/embedded/bin/foodcritic '\
'--role-path ./stub-environment/roles/ '\
'--environment-path ./stub-environment/environments/Test-Laptop.json '\
' --epic-fail none cookbooks/ ' \
"#{foodcritic_output}"
end
desc 'Check style violation difference'
task('diff'.to_sym) do
sh './compare_style.sh'
end
end
desc 'Run style checks'
task style: %w(style:rubocop style:foodcritic)
desc 'Clean some generated files'
task :clean do
%w(
**/Berksfile.lock
.bundle
.cache
**/Gemfile.lock
.kitchen
vendor
../cluster
vbox
).each { |f| FileUtils.rm_rf(Dir.glob(f)) }
# XXX should remove VBox VM's
end
task :default => 'style'