-
Notifications
You must be signed in to change notification settings - Fork 17
/
Rakefile
64 lines (54 loc) · 1.35 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
require 'bundler'
require 'rubocop/rake_task'
require 'foodcritic'
require 'rspec/core/rake_task'
require 'stove/rake_task'
require 'chef/knife'
desc 'Run all tests except Kitchen (default task)'
task integration: [:rubocop, :foodcritic, :spec]
task default: :integration
desc 'Run linters'
task lint: [:rubocop, :foodcritic]
desc 'Run all tests'
task test: [:integration, :acceptance]
# ChefSpec
desc 'Run ChefSpec tests'
task :spec do
puts 'Running chefspec tests...'
RSpec::Core::RakeTask.new(:spec) do |t|
# t.rspec_opts = %w[-f JUnit -o results.xml]
t.rspec_opts = %w[--color]
end
end
# Foodcritic
desc 'Run foodcritic lint checks'
task :foodcritic do
puts 'Running foodcritic...'
FoodCritic::Rake::LintTask.new do |t|
t.options = { :fail_tags => ["correctness"] }
puts 'done.'
end
end
# Rubocop
desc 'Run Rubocop lint checks'
task :rubocop do
RuboCop::RakeTask.new
end
# Test Kitchen
begin
require 'kitchen/rake_tasks'
Kitchen::RakeTasks.new
desc 'Alias for kitchen:all'
task acceptance: 'kitchen:all'
rescue LoadError
puts '>>>>> Kitchen gem not loaded, omitting tasks' # unless ENV['CI']
end
desc 'Release and Publish'
task :release do
if File.exist?("#{ENV['HOME']}/.stove")
require 'stove/rake_task'
Stove::RakeTask.new(:release)
else
puts "Please use 'stove login' before attempting to release."
end
end