Created
August 4, 2011 13:38
-
-
Save johnbintz/1125165 to your computer and use it in GitHub Desktop.
Make Hydra Rake task safer and more useful
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% require 'facter' %> | |
<% Facter.loadfacts %> | |
workers: | |
- type: local | |
runners: <%= Facter.sp_number_processors %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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