Using Pow with RVM's .ruby-version
There may very well be a better way to do this, but here is how I've set up my .powrc to read .ruby-version, a safer, more terse version of .rvmrc.
An example .ruby-version:
1.9.3-p327@my-gemset
In the project's .powrc:
if [ -f "$rvm_path/scripts/rvm" ] && [ -f ".ruby-version" ]; then
source "$rvm_path/scripts/rvm"
rvm use `cat .ruby-version`
fi
Written by Aaron Jensen
Related protips
3 Responses
Recent versions of RVM will split out @my-gemset from .ruby-version into .ruby-gemset. Here's a modified version to account for it -
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
@calebwright is correct. And with distributed teams and non-standard development environments, it's not a great idea to fully commit one way or the other (fully ignoring .rvmrc files or assuming a .ruby-gemset, for example).
I put together a quick Gist at https://gist.github.com/nbibler/5307941 which describes a .powrc file you can put in your application directory that accounts for having a .rvmrc, .ruby-version, and optionally a .ruby-gemset files.
if [ -f "$rvm_path/scripts/rvm" ] && [ -f ".ruby-version" ]; then
source "$rvm_path/scripts/rvm"
if [ -f ".ruby-gemset" ]; then
rvm use `cat .ruby-version`@`cat .ruby-gemset`
else
rvm use `cat .ruby-version`
fi
fi