From: Jordi Massaguer Pla Date: 2012-08-30T01:55:46+09:00 Subject: Re: How to add a non standard Gem path? Quoting Iñaki Baz Castillo : > 2012/8/29 Jordi Massaguer Pla : >> You can try something like this: >> >> $:.unshift yourdirectory > > Hi, that is not what I'm looking for. $: is the same as $LOAD_PATH and > contains directories in which Ruby searchs for libraries which > "require" command. This is not the same as adding a new directory for > Gem search. > > In fact, if I show the content of $: (or $LOAD_PATH) I get this (with > Ruby 1.9 so rubygem is loaded): > > ["/usr/local/lib/site_ruby/1.9.1", > "/usr/local/lib/site_ruby/1.9.1/x86_64-linux", > "/usr/local/lib/site_ruby", "/usr/lib/ruby/vendor_ruby/1.9.1", > "/usr/lib/ruby/vendor_ruby/1.9.1/x86_64-linux", > "/usr/lib/ruby/vendor_ruby", "/usr/lib/ruby/1.9.1", > "/usr/lib/ruby/1.9.1/x86_64-linux"] > > There is NOT the Gems directory (and it shouldn't since it's not the > same concept). > > > > This is: I need to install several gems into /usr/local/gems/ > directory and make "require" to look there as now it looks in > /var/lib/gems/1.9.1/ directory. > > > >> or use rvm (https://rvm.io/) <- you can use different ruby versions and >> different gemsets. > > I cannot do that. It is not for something I need in my computer but > for a library to be published. > > > >> or use GEM_HOME http://docs.rubygems.org/read/chapter/3 > > Yes, I can do this (assuming that I've installed the gem "abcd" in > /usr/local/gems/"): > > export GEM_PATH=/usr/local/gems > irb -r abcd > > It works, but could I load any other Gem installed in the default > /var/lib/gems/1.9.1/ directory? I've tested it right now and got a > failure and a success, not sure yet... XD > > > Thanks a lot. > what you are describing sound a lot like using bundler. With bundler you can install gems inside a "vendor" directory and when you start your application with "bundler exec aaa" it loads those. Actually rails uses bundler for managing the gems. http://gembundler.com/ regards jordi > > -- > Iñaki Baz Castillo > >