require 'rake' require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) do |t| t.pattern = 'spec/*/*_spec.rb' end task :default => :spec desc "Run serverspec to all hosts" task :spec => 'serverspec:all' class ServerspecTask < RSpec::Core::RakeTask attr_accessor :target def spec_command cmd = super "env TARGET_HOST=#{target} #{cmd}" end end namespace :serverspec do %w(<%=@name=>).each do |profile| ServerspecTask.new(profile.to_sym) do |t| t.target = profile t.pattern = "spec/#{profile}/*_spec.rb" end end end task :default => 'serverspec:minimal'