Skip to content

Instantly share code, notes, and snippets.

@natedrouin
Created July 19, 2013 03:06
Show Gist options
  • Save natedrouin/6034808 to your computer and use it in GitHub Desktop.
Save natedrouin/6034808 to your computer and use it in GitHub Desktop.
config/deploy.rb
after "deploy:restart", "deploy:restart_workers"
def run_remote_rake(rake_cmd)
rake_args = ENV['RAKE_ARGS'].to_s.split(',')
cmd = "cd #{fetch(:latest_release)} && bundle exec #{fetch(:rake, "rake")} RAILS_ENV=#{fetch(:rails_env, "production")} #{rake_cmd}"
cmd += "['#{rake_args.join("','")}']" unless rake_args.empty?
run cmd
set :rakefile, nil if exists?(:rakefile)
end
namespace :deploy do
desc "Restart Resque Workers"
task :restart_workers, :roles => :worker do
run_remote_rake "resque:restart_workers"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment