I tracked down the error to a RubyGems version: http://makandra.com/notes/1051-fixing-uninitialized-constant-activesupport-dependencies-mutex-nameerror
But when I ran Whenever manually on the server, it worked fine!
So, why was Capistrano using a different version of RubyGems? Because it was using a different version of Ruby!
I had to add the following to my deploy.rb file:
set :default_environment, {
'PATH' => "/opt/ruby-enterprise-1.8.7-2011.03/bin:$PATH"
}
* executing "cd /var/rails/my_app/releases/20110708073140 && bundle
exec whenever --update-crontab my_app"
servers: ["122.248.242.46"]
[122.248.242.46] executing command
** [out :: 122.248.242.46] /var/rails/my_app/shared/bundle/ruby/1.8/
gems/activesupport-2.3.8/lib/active_support/dependencies.rb:55:
uninitialized constant ActiveSupport::Dependencies::Mutex (NameError)
** [out :: 122.248.242.46] from /var/rails/my_app/shared/bundle/ruby/
1.8/gems/activesupport-2.3.8/lib/active_support.rb:57:in `require'
** [out :: 122.248.242.46] from /var/rails/my_app/shared/bundle/ruby/
1.8/gems/activesupport-2.3.8/lib/active_support.rb:57
** [out :: 122.248.242.46] from /var/rails/my_app/shared/bundle/ruby/
1.8/gems/activesupport-2.3.8/lib/active_support/all.rb:8:in `require'
** [out :: 122.248.242.46] from /var/rails/my_app/shared/bundle/ruby/
1.8/gems/activesupport-2.3.8/lib/active_support/all.rb:8
** [out :: 122.248.242.46] from /var/rails/my_app/shared/bundle/ruby/
1.8/gems/whenever-0.6.8/lib/whenever.rb:2:in `require'
** [out :: 122.248.242.46] from /var/rails/my_app/shared/bundle/ruby/
1.8/gems/whenever-0.6.8/lib/whenever.rb:2
** [out :: 122.248.242.46] from /var/rails/my_app/shared/bundle/ruby/
1.8/gems/whenever-0.6.8/bin/whenever:5:in `require'
** [out :: 122.248.242.46] from /var/rails/my_app/shared/bundle/ruby/
1.8/gems/whenever-0.6.8/bin/whenever:5
** [out :: 122.248.242.46] from /var/rails/my_app/shared/bundle/ruby/
1.8/bin/whenever:19:in `load'
** [out :: 122.248.242.46] from /var/rails/my_app/shared/bundle/ruby/
1.8/bin/whenever:19