I'm trying to follow this exact workflow from within Ruby code:
rvm use 2.0.0@some-name --create
gem install some-gem
I didn't find much documentation about using RVM in Ruby.
Edit: I know these steps are correct from the shell but I would like to run them from within a Ruby script. e.g ruby myscript.rb
that would run these two steps.
When placing these two directives within backticks, it doesn't work and the some-gem
from the sample above gets installed inside whatever gemset is currently in use.
Edit 2: I want a Ruby script that creates a new RVM gemset and installs a gem inside it (Devise, for example).
As answered by Michal Papis on Github in this question, it can be done only with hacking a little and using the rvm-with gem:
require "rvm/with"
RVM.with "2.1.0@gemset --create" do |r|
puts r.execute "gem install ..."
puts r.execute "bundle exec ruby ./continuation_script.rb"
end