205 Capistrano: Install capistrano-opscomplete

Updated . Posted . Visible to the public.

As it's possible that you manage the Ruby version by yourself we created the capistrano-opscomplete Gem Show archive.org snapshot to support you with this task.

As before, add the Gem to your Gemfile:

gem 'capistrano-opscomplete', require: false

And again, actually install it by calling bundle:

$ bundle

Now make the tasks the Gem provides available to you during deploy by adding the following to your Capfile:

# Include opscomplete tasks
require 'capistrano/opscomplete'

Finally in your config/deploy.rb add the following hook which checks if the Ruby version in your .ruby-version file is already available and install it, if that's not the case:

# Install new Ruby version if not already installed
after 'deploy:updating', 'opscomplete:ruby:ensure'

If you want to handle the ruby version for rollbacks too, you should add:

after 'deploy:reverting', 'opscomplete:ruby:ensure'
Marius Schuller
Last edit
Henning Koch
License
Source code in this card is licensed under the MIT License.
Posted by Marius Schuller to opscomplete (2018-12-13 15:10)