Skip to content

Instantly share code, notes, and snippets.

@masudak
Created July 1, 2015 05:42
Show Gist options
  • Save masudak/a0480b333c4b239028d2 to your computer and use it in GitHub Desktop.
Save masudak/a0480b333c4b239028d2 to your computer and use it in GitHub Desktop.
require 'rake'
require 'rspec/core/rake_task'
task :spec => 'spec:all'
task :default => :spec
namespace :spec do
targets = []
# get indivisual role from spec dir
Dir.glob('./spec/*').each do |dir|
next unless File.directory?(dir)
target = File.basename(dir)
target = "_#{target}" if target == "default"
targets << target
end
ENV['TARGET_HOSTS'].split(',').each do |host|
targets.each do |target|
RSpec::Core::RakeTask.new(target.to_sym) do |t|
ENV['TARGET_HOST'] = host
t.pattern = "spec/#{target}/*_spec.rb"
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment