-
Notifications
You must be signed in to change notification settings - Fork 4
/
Rakefile
67 lines (50 loc) · 1.35 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
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'open-uri'
require 'coveralls/rake/task'
require 'rubocop/rake_task'
task :default => ['spec:unit', :quality]
def yellow(str)
"\e[33m#{str}\e[m"
end
ENV['VAGRANT_CWD'] = File.expand_path('spec/integration/vm')
desc 'Run unit and integration tests'
task :spec => ['spec:unit', 'spec:integration']
namespace :spec do
RSpec::Core::RakeTask.new('unit') do |task|
task.pattern = './spec/unit{,/*/**}/*_spec.rb'
end
RSpec::Core::RakeTask.new('integration') do |task|
task.pattern = './spec/integration{,/*/**}/*_spec.rb'
end
namespace :integration do
integration_dir = 'spec/integration'
desc 'Clean'
task :clean => ['destroy_vm'] do
end
desc 'Stop'
task :stop => ['stop_vm'] do
end
desc 'Prepare'
task :prepare => ['start_vm'] do
end
task :start_vm do
puts yellow('Starting VM...')
system 'vagrant reload --provision | grep "not created" && vagrant up'
end
task :stop_vm do
puts yellow('Stopping VM...')
system 'vagrant halt'
end
task :destroy_vm do
puts yellow('Destroying VM...')
system 'vagrant', 'destroy', '-f'
end
end
end
RuboCop::RakeTask.new(:rubocop) do |task|
task.patterns = %w(lib/**/*.rb spec/unit/**/*.rb)
end
task :quality => :rubocop do
Coveralls::RakeTask.new
end