Using Pow with RVM 1.19’s .ruby-version and .ruby-gemset files

Thoughts from the team
By    | April 10, 2013 | Ruby on Rails,

With the upgrade to RVM 1.19 you are asked to convert your old .rvmrc file into .ruby-version and .ruby-gemset files.

You are using ‘.rvmrc’, it requires trusting, it is slower and it is not compatible with other ruby managers, you can switch to ‘.ruby-version’ using ‘rvm rvmrc to [.]ruby-version’ or ignore this warnings with ‘rvm rvmrc warning ignore /Users/danielkehoe/code/railsapps/rails-prelaunch-signup/.rvmrc’, ‘.rvmrc’ will continue to be the default project file in RVM 1 and RVM 2, to ignore the warning for all files run ‘rvm rvmrc warning ignore all.rvmrcs’.

A typical .ruby-version file would contain

ruby-2.0.0-p0

The .ruby-gemset file would have

MyProject

You can add the gemset name into the .ruby-version file as ruby-2.0.0-p0@MyProject but that breaks compatibility with other Ruby version launchers.

Pow needs RVM to be loaded and for it to select the correct Ruby version to run your app with.  You do this with the .powrc file.  Mine looks like this:

if [ -f "$rvm_path/scripts/rvm" ] && [ -f ".ruby-version" ] && [ -f ".ruby-gemset" ] ; then
  source "$rvm_path/scripts/rvm"
  rvm use `cat .ruby-version`@`cat .ruby-gemset`
fi

That’s all there is to it!

More like this