-
Notifications
You must be signed in to change notification settings - Fork 63
/
Rakefile
97 lines (81 loc) · 2.8 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
96
97
require "bundler/setup"
require "bundler/gem_tasks"
require "rspec/core/rake_task"
require "chefstyle"
require "rubocop/rake_task"
require "yard"
# rubocop:disable LineLength
def run_acceptance_tests(provider = "virtualbox")
puts "=================================================================="
puts "Running acceptance tests against '#{provider}' provider..."
puts "=================================================================="
Dir.chdir("test/acceptance/#{provider}") do
system("vagrant destroy -f")
system("vagrant up --provider=#{provider}")
system("vagrant destroy -f")
end
end
YARD::Rake::YardocTask.new
namespace :style do
desc "Run Ruby style checks"
RuboCop::RakeTask.new(:ruby) do |task|
task.patterns = [
"**/*.rb",
"**/Vagrantfile",
"*.gemspec",
"Gemfile",
"Rakefile",
]
end
end
namespace :test do
RSpec::Core::RakeTask.new(:unit) do |t|
t.pattern = "test/unit/**/*_spec.rb"
end
namespace :acceptance do
desc "Run acceptance tests with AWS provider"
task :aws do
unless system("vagrant box list | grep 'dummy\s*(aws)' &>/dev/null")
system("vagrant box add dummy https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box")
end
run_acceptance_tests("aws")
end
desc "Run acceptance tests with Digital Ocean provider"
task "digital_ocean" do
unless system("vagrant box list | grep 'digital_ocean' &>/dev/null")
system("vagrant box add digital_ocean https://github.com/smdahlen/vagrant-digitalocean/raw/master/box/digital_ocean.box")
end
run_acceptance_tests("digital_ocean")
end
desc "Run acceptance tests with Rackspace provider"
task :rackspace do
unless system("vagrant box list | grep 'dummy\s*(rackspace)' &>/dev/null")
system("vagrant box add dummy https://github.com/mitchellh/vagrant-rackspace/raw/master/dummy.box")
end
run_acceptance_tests("rackspace")
end
desc "Run acceptance tests with Linode provider"
task ":linode" do
unless system("vagrant box list | grep 'linode' &>/dev/null")
system("vagrant box add linode https://github.com/displague/vagrant-linode/raw/master/box/linode.box")
end
run_acceptance_tests("linode")
end
desc "Run acceptance tests with VirtualBox provider"
task :virtualbox do
run_acceptance_tests("virtualbox")
end
desc "Run acceptance tests with VMware provider"
task :vmware_fusion do
run_acceptance_tests("vmware_fusion")
end
end
end
# We cannot run Test Kitchen on Travis CI yet...
namespace :travis do
desc "Run tests on Travis"
task ci: ["style:ruby", "test:unit"]
end
require "vagrant-omnibus/version"
# The default rake task should just run it all
task default: ["style:ruby", "test:unit", "test:acceptance:virtualbox"]