-
Notifications
You must be signed in to change notification settings - Fork 228
/
Rakefile
51 lines (45 loc) · 1.21 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
require 'foodcritic'
require 'rubocop/rake_task'
require 'rspec/core/rake_task'
desc 'Run all lints'
task lint: %w[foodcritic rubocop]
task unit: %w[foodcritic rubocop spec]
task default: %w[foodcritic rubocop spec integration:vagrant]
task docker: %w[foodcritic rubocop spec integration:docker]
desc 'Run Rubocop Lint Task'
task :rubocop do
RuboCop::RakeTask.new
end
desc 'Run FoodCritic Lint Task'
FoodCritic::Rake::LintTask.new do |fc|
fc.options = {
fail_tags: ['any']
}
end
desc 'Run Chef Spec Test'
task :spec do
RSpec::Core::RakeTask.new(:spec)
end
namespace :integration do
desc 'Run integration tests with kitchen-vagrant'
task :vagrant do
require 'kitchen'
Kitchen.logger = Kitchen.default_file_logger
Kitchen::Config.new.instances.each do |instance|
instance.test(:always)
end
end
begin
desc 'Run integration tests with kitchen-docker'
task :docker do
ENV['KI_DRIVER'] = 'docker'
require 'kitchen'
Kitchen.logger = Kitchen.default_file_logger
Kitchen::Config.new.instances.each do |instance|
instance.test(:always)
end
end
rescue LoadError
puts '>>>>> kitchen gem not loaded, omitting tasks' unless ENV['CI']
end
end