forked from rubyisbeautiful/serverspec_examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
35 lines (28 loc) · 772 Bytes
/
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
require 'rspec/core/rake_task'
task :serverspec => 'serverspec:all'
task :default => :serverspec
desc 'a debug task to show what targets are found'
task :targets do
targets = []
Dir.glob('spec/**/*_spec.rb').each do |file|
host = /(.*)_spec.rb/.match(File.basename(file))[1]
targets << host
end
puts targets
end
namespace :serverspec do
targets = []
Dir.glob('spec/**/*_spec.rb').each do |file|
host = /(.*)_spec.rb/.match(File.basename(file))[1]
targets << host
end
task :all => targets
task :default => :all
targets.each do |target|
desc "Run serverspec tests to #{target}"
RSpec::Core::RakeTask.new(target.to_sym) do |t|
ENV['TARGET_HOST'] = target
t.pattern = "#{target}_spec.rb"
end
end
end