Hydra - good, Hydra on Heroku - not so good
Hydra is a great tool for Rails development as it can distribute your tests to remote machines. In my current project, we’re running Ruby 1.9.1 on Rails edge with RSpec 2.0 beta so not everything works right all the time.
The biggest culprit is having Heroku attempt to install our development and test gems. In particular, if you list gem ‘hydra’ within your Gemfile for Heroku - rake no longer works. You get a helpful message like this:
% heroku rake routes --app your-app
(in /disk1/home/slugs/192557_b2246d5_db92/mnt)
/disk1/home/slugs/192557_b2246d5_db92/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:32: warning: already initialized constant RAKEVERSION
/disk1/home/slugs/192557_b2246d5_db92/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake/alt_system.rb:32: warning: already initialized constant WINDOWS
WARNING: Possible conflict with Rake extension: String#ext already exists
WARNING: Possible conflict with Rake extension: String#pathmap already exists
/disk1/home/slugs/192557_b2246d5_db92/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:404: warning: already initialized constant EMPTY_TASK_ARGS
/disk1/home/slugs/192557_b2246d5_db92/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:452: warning: already initialized constant EMPTY
/disk1/home/slugs/192557_b2246d5_db92/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:960: warning: already initialized constant RUBY_EXT
/disk1/home/slugs/192557_b2246d5_db92/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:964: warning: already initialized constant RUBY
/disk1/home/slugs/192557_b2246d5_db92/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:1033: warning: already initialized constant LN_SUPPORTED
/disk1/home/slugs/192557_b2246d5_db92/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:1242: warning: already initialized constant ARRAY_METHODS
/disk1/home/slugs/192557_b2246d5_db92/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:1245: warning: already initialized constant MUST_DEFINE
/disk1/home/slugs/192557_b2246d5_db92/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:1249: warning: already initialized constant MUST_NOT_DEFINE
/disk1/home/slugs/192557_b2246d5_db92/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:1253: warning: already initialized constant SPECIAL_RETURN
/disk1/home/slugs/192557_b2246d5_db92/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:1259: warning: already initialized constant DELEGATING_METHODS
/disk1/home/slugs/192557_b2246d5_db92/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:1569: warning: already initialized constant DEFAULT_IGNORE_PATTERNS
/disk1/home/slugs/192557_b2246d5_db92/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:1575: warning: already initialized constant DEFAULT_IGNORE_PROCS
/disk1/home/slugs/192557_b2246d5_db92/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:1612: warning: already initialized constant FileList
/disk1/home/slugs/192557_b2246d5_db92/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:1638: warning: already initialized constant EARLY
/disk1/home/slugs/192557_b2246d5_db92/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:1968: warning: already initialized constant DEFAULT_RAKEFILES
rake aborted!
stack level too deep
/disk1/home/slugs/192557_b2246d5_db92/mnt/Rakefile:10:in `<top (required)>'
(See full trace by running task with --trace)
So the fix is to exclude execution of the entire block by Heroku:
source 'http://rubygems.org'
gem 'rails', '3.0.0.beta3'
## snip ##
if RUBY_PLATFORM =~ /darwin/
group :test do
gem 'rspec', '2.0.0.beta.11'
gem 'rspec-rails', '2.0.0.beta.11'
## snip ##
gem 'hydra', :git => 'git://github.com/ngauthier/hydra.git'
end
group :development, :test do
gem 'wirble'
gem 'hirb'
gem 'awesome_print'
gem 'ruby-debug19' # does not support 1.9.2
gem 'ruby-debug-ide19'
end
end
If you run linux (as I do half the time), then check for this environment variable:
if ENV[“SHELL”] != “/usr/bin/git-shell”