Skip to content

Instantly share code, notes, and snippets.

@johnbintz
Created August 4, 2011 13:38
Show Gist options
  • Save johnbintz/1125165 to your computer and use it in GitHub Desktop.
Save johnbintz/1125165 to your computer and use it in GitHub Desktop.
Make Hydra Rake task safer and more useful
<% require 'facter' %>
<% Facter.loadfacts %>
workers:
- type: local
runners: <%= Facter.sp_number_processors %>
begin
require 'hydra'
require 'hydra/tasks'
if ENV['RAILS_ENV'] == 'test'
Hydra::TestTask.new('hydra:spec') do |t|
t.add_files 'spec/**/*_spec.rb'
end
else
puts "No Hydra task unless you're running with RAILS_ENV=test"
end
Hydra::SyncTask.new('hydra:sync')
Hydra::RemoteTask.new('bundle', 'bundle')
rescue LoadError
warn "$! - hydra not loaded"
end
desc "Actually run Hydra in the test environment"
task "hydra:spec:run" do
system %{rake RAILS_ENV=test hydra:spec}
raise StandardError.new("Hydra failed") if ($?.exitstatus != 0)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment