Skip to content

Instantly share code, notes, and snippets.

@priyank-gupta
Created June 27, 2015 11:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save priyank-gupta/e15b5dab570e54cde2ee to your computer and use it in GitHub Desktop.
Save priyank-gupta/e15b5dab570e54cde2ee to your computer and use it in GitHub Desktop.
Mina whenever with roles
# # Modules: Whenever
# Adds settings and tasks for managing projects with [whenever].
#
# [whenever]: http://rubygems.org/gems/whenever
#
#
# ## Common usage
# require 'mina/whenever'
#
# task :deploy => :environment do
# deploy do
# ...
# invoke :'whenever:update'
# end
namespace :whenever do
desc "Clear crontab"
task :clear do
queue %{
echo "-----> Clear crontab for #{domain}_#{rails_env} and roles #{roles}"
#{echo_cmd %[cd #{deploy_to!}/#{current_path!} ; #{bundle_bin} exec whenever --clear-crontab #{domain}_#{rails_env} --set 'environment=#{rails_env}&path=#{deploy_to!}/#{current_path!}' --roles=#{roles.join(',')}]}
}
end
desc "Update crontab"
task :update do
queue %{
echo "-----> Update crontab for #{domain}_#{rails_env} and roles #{roles}"
#{echo_cmd %[cd #{deploy_to!}/#{current_path!} ; #{bundle_bin} exec whenever --update-crontab #{domain}_#{rails_env} --set 'environment=#{rails_env}&path=#{deploy_to!}/#{current_path!}' --roles=#{roles.join(',')}]}
}
end
desc "Write crontab"
task :write do
queue %{
echo "-----> Update crontab for #{domain}_#{rails_env} and roles #{roles}"
#{echo_cmd %[cd #{deploy_to!}/#{current_path!} ; #{bundle_bin} exec whenever --write-crontab #{domain}_#{rails_env} --set 'environment=#{rails_env}&path=#{deploy_to!}/#{current_path!}' --roles=#{roles.join(',')}]}
}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment