I've upgraded to rails 3.0.9 which has introduced the rake issues. I've gotten it all resolved except for a problem with a cron job.
This used to work:
#!/bin/sh
source /usr/local/rvm/scripts/rvm
cd /home/p1r65759/apps/abbc/
/usr/local/bin/rake refresh_events RAILS_ENV=production
But now I get this error: You have already activated rake 0.8.7, but your Gemfile requires rake 0.9.2. Consider using bundle exec. /home/p1r65759/apps/abbc/Rakefile:4:in `' (See full trace by running task with --trace)
How do I modify my script to use bundle exec so it will use the proper version of rake and run successfully? Thanks.
If you are using bundler for your application then you don't need to use "/usr/local/bin/rake" as a path for rake.
you can just use
bundle exec rake
so your new script will be
#!/bin/sh source /usr/local/rvm/scripts/rvm cd /home/p1r65759/apps/abbc/ bundle exec rake refresh_events RAILS_ENV=production
bundle exec will work because you are already in your project directory.
And don't forgot to include rake in your Gemfile.
instead of
/usr/local/bin/rake refresh_events RAILS_ENV=production
you should use
bundle exec rake refresh_events RAILS_ENV=production
or better yet install your bundle with --binstubs:
bundle install --binstubs --without development test
then you will have bin/rake:
./bin/rake refresh_events RAILS_ENV=production
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With