Rakefile 1.71 KB
Newer Older
Christopher Huhn's avatar
Christopher Huhn committed
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
58
59
60
61
62
63
64
65
66
67
68
begin
  require 'rubocop/rake_task'
  RuboCop::RakeTask.new do |task|
    task.options = %w[--display-cop-names --display-style-guide] # --lint
  end
rescue LoadError
  desc 'rubocop rake task not available'
  task :rubocop do
    abort 'Rubocop rake task is not available. Be sure to install rubocop'
  end
end

begin
  require 'foodcritic'
  FoodCritic::Rake::LintTask.new do |task|
    task.options = {
      exclude_paths: ['example_config/**/*']
    }
  end
rescue LoadError
  desc 'foodcritic rake task not available'
  task :foodcritic do
    abort 'Foodcritic rake task is not available. Be sure to install foodcritic'
  end
end

begin
  require 'rspec/core/rake_task'
  RSpec::Core::RakeTask.new(:chefspec) do |task|
    task.pattern = 'test/unit/**/*_spec.rb'
    task.rspec_opts = '--backtrace --color --format documentation '\
                      '--require spec_helper --default-path test/unit'
  end
rescue LoadError
  desc 'chefspec rake task not available'
  task :chefspec do
    abort 'Chefspec rake task is not available. Be sure to install chefspec'
  end
end

begin
  require 'kitchen/rake_tasks'
  Kitchen::RakeTasks.new do
    Kitchen.logger = Kitchen.default_logger
  end
rescue LoadError
  desc 'kitchen rake task not available'
  task :kitchen do
    abort 'kitchen rake task is not available. Be sure to install test-kitchen'
  end
end

begin
  require 'yard'
  YARD::Config.load_plugin 'chef'
  YARD::Rake::YardocTask.new do |t|
    t.files = ['**/*.rb']
    t.options = ['--debug']
  end
rescue LoadError
  desc 'yard rake task not available'
  task :yard do
    abort 'yard rake task is not available. '\
          'Be sure to install yard and yard-chef'
  end
end

task default: %w[rubocop foodcritic chefspec kitchen:all]