Make rvm gemset mirror/reference Capistrano's bundle install

265 views Asked by At

I'm currently deploying from my local machine to a development server using Capistrano. The dev server has a gemset for my project called 'vcc', but as is clear across the internet, Capistrano does its bundle install into shared/bundle rather than the rvm gemset.

It's easy enough to make a .rvmrc file and have that selecting the 'vcc' gemset when I cd into the project. However, this gemset doesn't get updated as part of a deploy. So I still generally run all my commands with 'bundle exec', which selects the 'shared/bundle' rather than the rvm gemset.

What I want to do is have the rvm gemset remain updated so that when I cd into the project I don't have to run bundle exec before everything. I'm not sure what the best way to do this is. My only idea was to create a symlink in the 'vcc' gemset directory that points to the 'shared/bundle' directory. I read somehwere that rvm should be self contained though and will not follow symlinks out of the /rvm directory?

I've seen that it's possible to make Capistrano deploy to your gemset, but it's not recommended. I'm fine with letting Capistrano handle gems and rvm handle ruby, I just want to get rid of "bundle exec." Maybe there's an easier way that doesn't have anything to do with configuring Capistrano or rvm?

1

There are 1 answers

0
mpapis On

Actually it is not recommended to use vendored gems, there are few issues with it and you will be safer using a gemset instead.

rvm-capistrano already suggests you disable the vendored gems here https://github.com/wayneeseguin/rvm-capistrano#disabling-bundle---deployment-when-using-gemsets :

set :bundle_dir, ''
set :bundle_flags, '--system --quiet'

This way gems will be installed in gemset and everything will work fine.