Getting Vlad, Bundler and RVM to Play Nice

To follow up my last post, I left out an important detail. When running the bundler recipe via SSH, the bundle command was returning a 'command not found' message. This is because ssh doesn't load my zshrc (bashrc for normal people, of which I am not).

The best way I found to accomplish this was in a post at LosTechies (particularly the comment section). My approach is as follows.

Basically, I took a standard variable used by the bundler recipe used to set the command used. I prepended a few lines to force feed the RVM scripts. Since I don't use RVM gemsets on the server and prefer to use bundle to manage deployed gems and it is installed in the @global gemset, I don't need to load the rvmrc gemset. If you need an example of that usage, just follow the source link above. I've included the snippet I used below.

set :bundle_cmd, [ "source ~/.rvm/scripts/rvm",
                    "bundle"
                  ].join(" && ")

Published on