Skip to content

Instantly share code, notes, and snippets.

@nbibler
Last active October 7, 2021 09:38
Show Gist options
  • Star 54 You must be signed in to star a gist
  • Fork 14 You must be signed in to fork a gist
  • Save nbibler/5307941 to your computer and use it in GitHub Desktop.
Save nbibler/5307941 to your computer and use it in GitHub Desktop.
A .powrc file which works with RVM's .rvmrc or .ruby-version (+ .ruby-gemset) configuration files.
if [ -f "$rvm_path/scripts/rvm" ]; then
source "$rvm_path/scripts/rvm"
if [ -f ".rvmrc" ]; then
source ".rvmrc"
fi
if [ -f ".ruby-version" ]; then
rvm use `cat .ruby-version`
fi
if [ -f ".ruby-gemset" ]; then
rvm gemset use --create `cat .ruby-gemset`
fi
fi
@nbibler
Copy link
Author

nbibler commented Apr 4, 2013

Create a .powrc file in your application directory and paste the above contents into it.

@cforcey
Copy link

cforcey commented Apr 11, 2013

Thanks for this elaboration of the original post. Much appreciated.

@mpapis
Copy link

mpapis commented Apr 11, 2013

try this version https://gist.github.com/mpapis/5364653 - should work more reliable

@kevinelliott
Copy link

@mpapis You completely removed the .ruby-version and .ruby-gemset support. Was that intentional? That relies on rvm's current. I'm missing how it's changing to the appropriate version using rvm, based on the most compatible way to set these (using .ruby-version and .ruby-gemset).

@Nerian
Copy link

Nerian commented May 4, 2013

I tried this, but the variable $rvm_path is empty inside .powrc. The variable does contain the right info when I execute it on my normal shell. Any ideas on what could be wrong?

@flarik
Copy link

flarik commented Jun 12, 2013

Faster: don't do "rvm use" twice: https://gist.github.com/flarik/5764244

@patrickreiner
Copy link

I believe this has an error in it. The line:

rvm gemset use --create cat .ruby-gemset

should be:

rvm gemset use cat .ruby-gemset --create

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment