Rakefile 887 Bytes
Newer Older
Sean OMeara's avatar
Sean OMeara committed
1
require 'rspec/core/rake_task'
Tim Smith's avatar
Tim Smith committed
2
require 'cookstyle'
Sean OMeara's avatar
Sean OMeara committed
3
4
5
6
require 'rubocop/rake_task'
require 'foodcritic'
require 'kitchen'

Tim Smith's avatar
Tim Smith committed
7
8
require_relative 'tasks/maintainers'

Tim Smith's avatar
Tim Smith committed
9
# Style tests. cookstyle (rubocop) and Foodcritic
Sean OMeara's avatar
Sean OMeara committed
10
11
namespace :style do
  desc 'Run Ruby style checks'
12
  RuboCop::RakeTask.new(:ruby)
Sean OMeara's avatar
Sean OMeara committed
13
14
15
16

  desc 'Run Chef style checks'
  FoodCritic::Rake::LintTask.new(:chef) do |t|
    t.options = {
Tim Smith's avatar
Tim Smith committed
17
      fail_tags: ['any']
Sean OMeara's avatar
Sean OMeara committed
18
19
20
21
22
23
24
    }
  end
end

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

Jose Luis Salas's avatar
Jose Luis Salas committed
25
26
27
# Rspec and ChefSpec
desc 'Run ChefSpec examples'
RSpec::Core::RakeTask.new(:spec)
Sean OMeara's avatar
Sean OMeara committed
28
29
30
31
32
33
34
35
36
37
38
39
40

# 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

# Default
Tim Smith's avatar
Tim Smith committed
41
task default: %w(style spec)