-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
executable file
·56 lines (46 loc) · 1.2 KB
/
Rakefile
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
require 'foodcritic'
require 'kitchen'
require 'rspec/core/rake_task'
require 'cookstyle'
require 'rubocop/rake_task'
require 'stove/rake_task'
# Style tests
namespace :style do
desc 'Run Ruby style checks'
RuboCop::RakeTask.new do |task|
task.options << '--display-cop-names'
end
desc 'Run Chef style checks'
FoodCritic::Rake::LintTask.new(:foodcritic)
end
desc 'Run all style checks'
task style: ['style:rubocop', 'style:foodcritic']
# Unit tests
namespace :unit do
desc 'Run ChefSpec examples'
RSpec::Core::RakeTask.new(:spec)
end
desc 'Run all unit tests'
task unit: ['unit:spec']
# Integration tests
namespace :integration do
desc 'Run Test Kitchen with Docker'
task :docker do
Kitchen.logger = Kitchen.default_file_logger
@loader = Kitchen::Loader::YAML.new(project_config: './.kitchen.docker.yml')
config = Kitchen::Config.new(loader: @loader)
config.instances.each do |instance|
instance.test(:always)
end
end
end
desc 'Run all integration tests'
task integration: ['integration:docker']
# Publish
Stove::RakeTask.new do |t|
t.stove_opts = ['--extended-metadata']
end
# Default
task default: %w(style unit)
# All tasks
task all: %w(style unit integration)