-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
69 lines (62 loc) · 1.61 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env rake
require 'rake'
begin
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec) do |task|
task.rspec_opts = '--color'
end
rescue LoadError
warn 'It looks like the Chef DK is not configured. Download the Chef DK'\
" via\nhttps://downloads.getchef.com/chef-dk. On Linux and Mac OS X"\
" add to $PATH with:\n"\
' eval "$(chef shell-init bash)"'
end
begin
require 'rubocop/rake_task'
RuboCop::RakeTask.new do |task|
task.fail_on_error = true
task.options = %w(--display-cop-names)
end
rescue LoadError
warn '>>>>> Rubocop gem not loaded, omitting tasks'
end
begin
require 'foodcritic/rake_task'
require 'foodcritic'
task default: [:foodcritic]
FoodCritic::Rake::LintTask.new do |task|
task.options = {
fail_tags: ['any'],
tags: ['~FC015']
}
end
rescue LoadError
warn '>>>>> foodcritic gem not loaded, omitting tasks'
end
task default: 'test:quick'
namespace :test do
desc 'Run all the quick tests.'
task :quick do
Rake::Task['rubocop'].invoke
Rake::Task['foodcritic'].invoke
end
end
desc 'Bootstrap with chef-solo'
task :bootstrap do
sh 'rm -rf cookbooks && berks vendor cookbooks'
sh 'sudo chef-solo --json-attributes bootstrap/run_list.json'\
' --config bootstrap/solo.rb'
end
unless ENV['CI']
begin
require 'kitchen/rake_tasks'
Kitchen::RakeTasks.new
desc 'Run _all_ the tests. Go get a coffee.'
task :complete do
Rake::Task['test:quick'].invoke
Rake::Task['test:kitchen:all'].invoke
end
rescue LoadError
puts '>>>>> Kitchen gem not loaded, omitting tasks'
end
end