Last Updated: January 03, 2018
·
2.33K
· tmartin314

Capistrano 3 invoke rake task remotely

Added to the deploy namespace:

# @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

1 Response
Add your response

There may be a plugin for this, but I wasn't able to find one. Maybe someone can make one? (I don't know how)

over 1 year ago ·