Is it possible to have rvm know which gemset it should be using while navigating under a certain directory, much in the same way you can have git the current branch's information just by navigating under that directory?
I understand how git works that way since each directory has its own .git directory in the root, but didn't know if it was possible since .rvm is more of a user-wide configuration. Or perhaps the answer is to make a .rvm file within each directory?
Step 1: rvm gemset create [name of gemset] Step 2: rvm --rvmrc [ruby version here]@[name of gemset] # Note: You can check your current ruby version by running "ruby -v" from your console. Step 3: Refresh your directory. # You can simply do this by checking out of your directory and going back to that directory again.
A gemset is just a container you can use to keep gems separate from each other. Creating a gemset per project allows you to change gems (and gem versions) for one project without breaking all your other projects. Each project need only worry about its own gems. RVM provides (>= 0.1.
You need to "rvm gemset empty [gemset_name]". I suppose if you have many gems, it could take a while to uninstall them all. Incidentally right now I am able to run rvm gemset empty and it clears the current gemset.
For others visiting this, there is a new way to do this, without having to allow arbitrary shell script to be executed in a .rvmrc file.
Create a file named .ruby-gemset
containing only the gemset name in.
gemset
Need an up to date version of rvm for this to work.
You can also specify the ruby version by creating a file named .ruby-version
containing only the ruby version:
1.9.3
This format also has the advantage of being compatible with rbenv
and rbfu
.
If you have existing projects using the deprecated .rvmrc
, you can convert them to the new format using the command:
rvm rvmrc to .ruby-version
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With