Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reload .ruby-version/.ruby-gemset/.rvmrc without leaving current directory?

Tags:

rvm

rvmrc

We are using RVM to manage rubies and gemsets for dozens of projects.

Sometimes I'll either edit the .ruby-version or .ruby-gemset file, or pull a newer version of those file(s) from our VCS, but of course RVM is unaware of these changes unless I tell it. And if the changes come from the VCS, even I may not be aware of them. So what's the best way to do this?

It would be nice to be able to automate the process, so that it is done automatically any time I fetch changes from the repository.

The only way I know of to get RVM to re-read these files is to cd to another directory, then return to the project directory. This is obviously simple, and easy, but it seems more than a little inelegant, and isn't self-documenting.

I'd expect there to be some command like rvm reload (which exists, but does something else) to re-read the project files, but I can't find anything of the sort.

like image 221
Lambart Avatar asked Jan 15 '14 20:01

Lambart


1 Answers

I think I've found an answer, but as it is undocumented I don't know if it's really legit.

It seems that if you do:

$ rvm use .

It'll apparently (re)read the .ruby-version and .ruby-gemset files (not sure of .rvmrc files, since we don't use them). I discovered this by trying rvm use .ruby-version and rvm use .ruby-gemset, both of which seemed to cause RVM to read both 'dot' files.

This functionality is not currently (as of RVM 1.23.13) mentioned in the documentation (i.e. rvm help use).

Maybe it should be?

like image 78
Lambart Avatar answered Nov 16 '22 00:11

Lambart