Created
November 4, 2010 15:53
-
-
Save jherdman/662678 to your computer and use it in GitHub Desktop.
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 'whenever/capistrano' | |
## | |
# Force Whenever to use the Capistrano stage. We use a lambda to delay execution | |
# until absolutely necessary. | |
set :whenever_command, lambda { "whenever --set environment=#{fetch(:stage, 'production')}" } |
Whenever actually comes with a very similar, and configurable, Capistrano task. What I'm doing in my gist is modifying their setting for the "whenever" executable so that it dynamically sets the environment to use based on the current Capistrano environment used (e.g. staging, dev, production).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We added it to our bundler, and the following task can be found in our common.rb
desc "Set up cron jobs for this release"
task :setup_crontab do
run "cd #{current_release} && whenever --update-crontab comments"
end