-
Notifications
You must be signed in to change notification settings - Fork 25
/
Rakefile
44 lines (37 loc) · 1019 Bytes
/
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
#!/usr/bin/env rake
require 'foodcritic'
require 'rubocop/rake_task'
require 'rspec/core/rake_task'
desc 'Run all lints'
task :lint => %w(foodcritic rubocop spec)
task :default => :lint
desc 'Run Rubocop Lint Task'
task :rubocop do
puts "Running Rubocop Lint.."
RuboCop::RakeTask.new
end
desc 'Run Food Critic Lint Task'
task :foodcritic do
puts "Running Food Critic Lint.."
FoodCritic::Rake::LintTask.new do |fc|
fc.options = {:fail_tags => ['any']}
end
end
desc 'Run Knife Cookbook Test Task'
task :knife do
puts "Running Knife Check.."
current_dir = File.expand_path(File.dirname(__FILE__))
cookbook_dir = File.dirname(current_dir)
cookbook_name = File.basename(current_dir)
sh "bundle exec knife cookbook test -o #{cookbook_dir} #{cookbook_name}"
end
desc 'Run Chef Spec Test'
task :spec do
RSpec::Core::RakeTask.new(:spec)
end
begin
require "kitchen/rake_tasks"
Kitchen::RakeTasks.new
rescue LoadError
puts ">>>>> Kitchen gem not loaded, omitting tasks" unless ENV["CI"]
end