How can I get RVM to respect my vendor's settings where gems can be put?

I have my package set up to install gems to a directory .bundle/

inside each project.

$ cat ~/.bundle/config
---
BUNDLE_PATH: ".bundle"
BUNDLE_BIN: ".bundle/bin"

      

How can I get RVM to respect this setting and not install $GEM_HOME

to a different directory (inside ~/.rvm/

) when I'm cd

in my project?

So far I had a little script that would install $GEM_HOME

(and $PATH

and $GEM_PATH

) whenever I am cd

inside my project directory, but with recent rvm versions it stops working and now RVM basically disables the Ruby version when I manually change $GEM_HOME

and i dont know how to make it work again.

+3


source to share


1 answer


First of all, you must indicate that you want to use a very separate gemset for your project (assume its name is myproject42):

$ cd myproject42 && rvm --rvmrc --create use 2.1.0@myproject42 --ignore-gemsets

      

Option

rvmrc

will create a config file in your folder. You are already half separated from the universe. Now you want to modify this file a bit, setting whatever you want:

...
unset __hook

# my exports
export GEM_PATH=`pwd`
export GEM_HOME=`pwd`
...

      

cd

and back to that directory. This will generate a warning:



You are using '.rvmrc', it requires trusting, it is slower and ...
[LINES SKIPPED]
************************
y[es], n[o], v[iew], c[ancel]> y
Using: /tmp/myproject42

      

Once you confirm that you know this modification, the gemset is set to what you want ( /tmp/myproject42

in this case.) You can ensure that:

$ rvm gemset dir
Warning! PATH is not properly set up, '/tmp/myproject42/bin' is not available,
[LINES SKIPPED]
/tmp/myproject42

      

You might want to do some cleanup, such as suppressing these warnings. The "howtos" are printed inside these warnings, they are pretty straightforward, so I left the initial process dirty to show it exactly how it would run on your computer.

Hope this helps.

+3


source







All Articles