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
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
Sweet! Thanks :)