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

StackOverflow https://stackoverflow.com/questions/21147283

  •  28-09-2022
  •  | 
  •  

문제

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.

도움이 되었습니까?

해결책

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?

다른 팁

I use .rvmrc and I used to do

cd;cd -

but now I do

cd .

If I do

rvm use .

I get

Could not determine which Ruby to use; . should contain .rvmrc or .versions.conf or .ruby-version or .rbfu-version or .rbenv-version, or an appropriate line in Gemfile. ( see: 'rvm usage' )

which I don't really think is true (because I do have a .rvmrc file in .), or perhaps I just don't understand.

Edit:

I am using rvm 1.25.33

I didn't mean to come across as critical, just trying to add more info!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top