Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

RubyGems load path

306 views
Skip to first unread message

Rodrigo Kochenburger

unread,
Nov 19, 2008, 7:47:32 PM11/19/08
to
Hi Guys,

How can i change the RubyGem load path, so that requiring a gem from
within my application loads it from a custom path instead of the
system-wide repository?

I've tried setting Gem.path and overriding Gem.default_path but none
worked.

Cheers

Luis Lavena

unread,
Nov 19, 2008, 10:23:15 PM11/19/08
to

You should look into GEM_PATH and GEM_HOME environment variables.

Merb is doing something similar, making their bundled gems first in
the search of GEM_PATH.

You can do something like this:

require 'rubygems'
Gem.clear_paths
ENV['GEM_HOME'] = File.join(Dir.pwd, 'gems')
ENV['GEM_PATH'] = File.join(Dir.pwd, 'gems')
puts Gem.dir
puts Gem.path

Now you can do your show adding or removing gems from there ;-)

HTH,
--
Luis Lavena

Rodrigo Kochenburger

unread,
Nov 20, 2008, 7:15:45 AM11/20/08
to

Sweet! Thanks :)

0 new messages