Skip to content

Instantly share code, notes, and snippets.

@monkseal
Created May 8, 2015 00:43
Show Gist options
  • Save monkseal/d50779f698856eefe3a4 to your computer and use it in GitHub Desktop.
Save monkseal/d50779f698856eefe3a4 to your computer and use it in GitHub Desktop.
Invoke a rake task from capistrano 3
namespace :deploy do
# ....
# @example
# bundle exec cap uat deploy:invoke task=users:update_defaults
desc 'Invoke rake task on the server'
task :invoke do
fail 'no task provided' unless ENV['task']
on roles(:app) do
within release_path do
with rails_env: fetch(:rails_env) do
execute :rake, ENV['task']
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment