-
Notifications
You must be signed in to change notification settings - Fork 84
/
Rakefile
executable file
·95 lines (76 loc) · 2.91 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/usr/bin/env rake
# frozen_string_literal: true
require 'pronto'
namespace :style do
begin
Pronto::GemNames.new.to_a.each { |gem_name| require "pronto/#{gem_name}" }
desc 'Run shell style checks'
task :shell do
Pronto.run(`git log --pretty=format:%H | tail -1`)
end
rescue LoadError => e
puts ">>> Gem load error: #{e}, omitting style:shell"
end
begin
require 'rubocop/rake_task'
desc 'Run Ruby style checks'
RuboCop::RakeTask.new(:ruby) do |task|
task.options << '--display-cop-names'
end
rescue LoadError => e
puts ">>> Gem load error: #{e}, omitting style:ruby" unless ENV['CI']
end
end
desc 'Run all style checks'
task style: ['style:shell', 'style:ruby']
# Integration tests. Kitchen.ci
begin
require 'kitchen/cli'
concurrency = 3
namespace :integration do
task :set_vagrant, [:regex] do |_t, _args|
ENV['KITCHEN_LOCAL_YAML'] = './.kitchen.yml'
end
desc 'Run Test Kitchen with Vagrant'
task :vagrant, [:regex] => :set_vagrant do |_t, args|
Kitchen::CLI.new([], concurrency: concurrency, destroy: 'always').test args[:regex]
end
namespace :vagrant do
desc 'Lists one or more vagrant instances'
task :list, [:regex] => :set_vagrant do |_t, args|
Kitchen::CLI.new([], concurrency: concurrency).list args[:regex]
end
desc 'Log in to one vagrant instance'
task :login, [:regex] => :set_vagrant do |_t, args|
Kitchen::CLI.new([]).login args[:regex]
end
desc 'Start one or more vagrant instances'
task :create, [:regex] => :set_vagrant do |_t, args|
Kitchen::CLI.new([], concurrency: concurrency).create args[:regex]
end
desc 'Use a provisioner to configure one or more vagrant instances'
task :converge, [:regex] => :set_vagrant do |_t, args|
Kitchen::CLI.new([], concurrency: concurrency).converge args[:regex]
end
desc 'Install busser and related gems on one or more vagrant instances'
task :setup, [:regex] => :set_vagrant do |_t, args|
Kitchen::CLI.new([], concurrency: concurrency).setup args[:regex]
end
desc 'Run automated tests on one or more vagrant instances'
task :verify, [:regex] => :set_vagrant do |_t, args|
Kitchen::CLI.new([], concurrency: concurrency).verify args[:regex]
end
desc 'Delete all information for one or more vagrant instances'
task :destroy, [:regex] => :set_vagrant do |_t, args|
Kitchen::CLI.new([]).destroy args[:regex]
end
desc 'Test (destroy, create, converge, setup, verify and destroy) one or more vagrant instances'
task :test, [:regex] => :set_vagrant do |_t, args|
Kitchen::CLI.new([], concurrency: concurrency, destroy: 'always').test args[:regex]
end
end
end
rescue LoadError => e
puts ">>> Gem load error: #{e}, omitting spec" unless ENV['CI']
end
task default: %w[style integration:vagrant]