Capistrano 3 invocar tarefa rake remotamente

Adicionado ao namespace de implantação:

# @example
# bundle exec cap staging deploy:invoke task=salesforce:sync_accounts
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