forked from dev-sec/chef-mysql-hardening
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
57 lines (47 loc) · 1.26 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
#!/usr/bin/env rake
require 'foodcritic'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
# General tasks
# Rubocop before rspec so we don't lint vendored cookbooks
desc "Run all tests except Kitchen (default task)"
task :integration => %w{rubocop foodcritic spec}
task :default => :unit
# Lint the cookbook
desc "Run linters"
task :lint => [ :rubocop, :foodcritic ]
# Run the whole shebang
desc "Run all tests"
task :test => [ :lint, :integration ]
# RSpec
desc 'Run chefspec tests'
task :spec do
puts "Running Chefspec tests"
RSpec::Core::RakeTask.new(:spec)
end
# Foodcritic
desc 'Run foodcritic lint checks'
task :foodcritic do
if Gem::Version.new('1.9.2') <= Gem::Version.new(RUBY_VERSION.dup)
puts "Running Foodcritic tests..."
FoodCritic::Rake::LintTask.new do |t|
t.options = { :fail_tags => ['correctness'] }
puts "done."
end
else
puts "WARN: foodcritic run is skipped as Ruby #{RUBY_VERSION} is < 1.9.2."
end
end
# Rubocop
desc 'Run Rubocop lint checks'
task :rubocop do
Rubocop::RakeTask.new
end
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