Run Rake tasks on the server with Capistrano 3 and rbenv

Run Rake tasks on the server with Capistrano 3 and rbenv

I have been all over Capistrano 3 lately and found that it is sometimes easier to do things than I expect. Here is an example of a task I had to write, based on some other people’s StackOverflow comments.

This can be run on the command line:

bundle exec cap uat deploy:invoke task=users:update_defaults

The great thing about this is that if you are using capistrano/rbenv and capistrano/bundler, the execute command will automatically take care over everything for you under the hood.