Skip to content

Instantly share code, notes, and snippets.

@trinhyen trinhyen/Rakefile
Last active Aug 14, 2019

Embed
What would you like to do?
require 'rake'
require 'rspec/core/rake_task'
host = 'ec2-18-179-206-126.ap-northeast-1.compute.amazonaws.com'
# modulelist = %w( java-1.8.0-openjdk )
task :spec => 'spec:all'
task :default => :spec
namespace :spec do
targets = []
Dir.glob('./spec/*').each do |dir|
next unless File.directory?(dir)
target = File.basename(dir)
target = "_#{target}" if target == "default"
targets << target
end
task :all => targets
task :default => :all
targets.each do |target|
original_target = target == "_default" ? target[1..-1] : target
desc "Run serverspec tests to #{original_target}"
RSpec::Core::RakeTask.new(target.to_sym) do |t|
ENV['TARGET_HOST'] = original_target
t.pattern = "spec/#{original_target}/*_spec.rb"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.