Skip to content
This repository has been archived by the owner on Apr 7, 2018. It is now read-only.

Commit

Permalink
Use the improved rakefile
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Smith <[email protected]>
  • Loading branch information
tas50 committed Aug 18, 2016
1 parent 684fc57 commit fad9707
Showing 1 changed file with 50 additions and 24 deletions.
74 changes: 50 additions & 24 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,39 +1,65 @@
require 'rspec/core/rake_task'
require 'cookstyle'
require 'rubocop/rake_task'
require 'foodcritic'
require 'kitchen'

require_relative 'tasks/maintainers'
#!/usr/bin/env rake

# Style tests. cookstyle (rubocop) and Foodcritic
namespace :style do
desc 'Run Ruby style checks'
RuboCop::RakeTask.new(:ruby)

desc 'Run Chef style checks'
FoodCritic::Rake::LintTask.new(:chef) do |t|
t.options = {
fail_tags: ['any']
}
begin
require 'cookstyle'
require 'rubocop/rake_task'

desc 'Run Ruby style checks'
RuboCop::RakeTask.new(:ruby)
rescue LoadError => e
puts ">>> Gem load error: #{e}, omitting style:ruby" unless ENV['CI']
end

begin
require 'foodcritic'

desc 'Run Chef style checks'
FoodCritic::Rake::LintTask.new(:chef) do |t|
t.options = {
fail_tags: ['any'],
progress: true
}
end
rescue LoadError
puts ">>> Gem load error: #{e}, omitting style:chef" unless ENV['CI']
end
end

desc 'Run all style checks'
task style: ['style:chef', 'style:ruby']

# Rspec and ChefSpec
desc 'Run ChefSpec examples'
RSpec::Core::RakeTask.new(:spec)
# ChefSpec
begin
require 'rspec/core/rake_task'

desc 'Run ChefSpec examples'
RSpec::Core::RakeTask.new(:spec)
rescue LoadError => e
puts ">>> Gem load error: #{e}, omitting spec" unless ENV['CI']
end

# 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
begin
require 'kitchen/rake_tasks'

desc 'Run kitchen integration tests'
Kitchen::RakeTasks.new
rescue StandardError => e
puts ">>> Kitchen error: #{e}, omitting #{task.name}" unless ENV['CI']
end
end

namespace :supermarket do
begin
require 'stove/rake_task'

desc 'Publish cookbook to Supermarket with Stove'
Stove::RakeTask.new
rescue LoadError => e
puts ">>> Gem load error: #{e}, omitting #{task.name}" unless ENV['CI']
end
end

Expand Down

0 comments on commit fad9707

Please sign in to comment.