-
Notifications
You must be signed in to change notification settings - Fork 112
/
Rakefile
48 lines (42 loc) · 1.52 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
require 'bundler/setup'
require 'bundler/gem_tasks'
require 'rake'
require 'rake/testtask'
require 'yard'
Rake::Task.define_task(:environment)
desc 'Run Test Kitchen integration tests'
namespace :integration do
desc 'Run integration tests with kitchen-docker'
task :verify, [:taskname] => [:environment] do |task, args|
args.with_defaults(taskname: 'all')
require 'kitchen'
Kitchen.logger = Kitchen.default_file_logger
@loader = Kitchen::Loader::YAML.new(local_config: '.kitchen.docker.yml')
Kitchen::Config.new(loader: @loader).instances.each do |instance|
if args.taskname == 'all' or instance.name.include?(args.taskname)
instance.verify()
end
end
end
desc 'destroy instances with kitchen-docker'
task :destroy, [:taskname] => [:environment] do |task, args|
args.with_defaults(taskname: 'all')
require 'kitchen'
Kitchen.logger = Kitchen.default_file_logger
@loader = Kitchen::Loader::YAML.new(local_config: '.kitchen.docker.yml')
Kitchen::Config.new(loader: @loader).instances.each do |instance|
if args.taskname == 'all' or instance.name.include?(args.taskname)
instance.destroy()
end
end
end
desc 'default task'
task :test, [:taskname] => [:environment] do |task, args|
args.with_defaults(taskname: 'all')
Rake::Task['integration:verify'].invoke(args.taskname)
Rake::Task['integration:destroy'].invoke(args.taskname)
end
end
desc 'Run yarddoc for the source'
YARD::Rake::YardocTask.new
task :default => ['integration:test']