Using RVM with Fabric
It might seem strange to deploy or manage Ruby applications with a Python based tool, but with Fabric you can easily setup a Ruby enviroment. To install RVM (assuming you have curl and the build tools installed for your distro) you can install RVM with the following command:
def install_rvm():
# Install the Ruby Version Manager, along with the current stable version of Ruby
# Install the bundler gem
run('gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3')
run('curl -sSL https://get.rvm.io | bash -s stable')
run('rvm install 2.3.1')
run('rvm use 2.3.1 && gem install bundler')
After that, you can use Fabric’s context managers to start using that version of Ruby:
def install_some_gem():
with run('rvm use 2.3.1'):
run('gem install sinatra')