Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Tim Smith <tsmith@chef.io>
- Loading branch information
Showing
1 changed file
with
32 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,39 @@ | ||
#!/usr/bin/env rake | ||
require 'rspec/core/rake_task' | ||
require 'cookstyle' | ||
require 'rubocop/rake_task' | ||
require 'foodcritic' | ||
require 'kitchen' | ||
|
||
begin | ||
require 'emeril/rake' | ||
rescue LoadError | ||
puts '>>>>> Emeril gem not loaded, omitting tasks' unless ENV['CI'] | ||
end | ||
# # Style tests. cookstyle (rubocop) and Foodcritic | ||
namespace :style do | ||
desc 'Run Ruby style checks' | ||
RuboCop::RakeTask.new(:ruby) | ||
|
||
require 'rspec/core/rake_task' | ||
RSpec::Core::RakeTask.new(:unit) do |t| | ||
t.pattern = ['test/unit/**/*_spec.rb'] | ||
desc 'Run Chef style checks' | ||
FoodCritic::Rake::LintTask.new(:chef) do |t| | ||
t.options = { | ||
fail_tags: ['any'] | ||
} | ||
end | ||
end | ||
|
||
require 'foodcritic' | ||
FoodCritic::Rake::LintTask.new do |t| | ||
t.options = { fail_tags: ['any', '~FC017'] } | ||
end | ||
desc 'Run all style checks' | ||
task style: ['style:chef', 'style:ruby'] | ||
|
||
# Rspec and ChefSpec | ||
desc 'Run ChefSpec examples' | ||
RSpec::Core::RakeTask.new(:spec) | ||
|
||
begin | ||
require 'kitchen/rake_tasks' | ||
Kitchen::RakeTasks.new | ||
rescue LoadError | ||
puts '>>>>> Kitchen gem not loaded, omitting tasks' unless ENV['CI'] | ||
# Integration tests. Kitchen.ci | ||
namespace :integration do | ||
desc 'Run Test Kitchen with Vagrant' | ||
task :vagrant do | ||
Kitchen.logger = Kitchen.default_file_logger | ||
Kitchen::Config.new.instances.each do |instance| | ||
instance.test(:always) | ||
end | ||
end | ||
end | ||
|
||
task default: [:foodcritic, :unit] | ||
# Default | ||
task default: %w(style spec) |