Skip to content

Commit

Permalink
Use the standard Chef rakefile
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Smith <tsmith@chef.io>
  • Loading branch information
tas50 committed Jul 18, 2016
1 parent e69ea43 commit 1abfeba
Showing 1 changed file with 32 additions and 19 deletions.
51 changes: 32 additions & 19 deletions Rakefile
@@ -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)

0 comments on commit 1abfeba

Please sign in to comment.