From: Austin Ziegler Date: 2005-09-26T20:37:33+09:00 Subject: Re: Finally an answer to my RubyGems question and some small suggestions On 9/25/05, TRANS wrote: > I appreciate those that attempted to offer me some info on this issue. > I found an answer to much of my query: > # We replace Ruby's require with our own, which is capable of > # loading gems on demand. > # > # When you call require 'x', this is what happens: > # * If the file can be loaded from the existing Ruby loadpath, it > # is. > # * Otherwise, installed gems are searched for a file that matches. > # If it's found in gem 'y', that gem is activated (added to the > # loadpath). > # > # The normal require functionality of returning false if > # that file has already been loaded is preserved. > # > > So the order of the search is: > > site_ruby > ruby > gems Unfortunately, the answer isn't *quite* that simple. It's site_ruby, ruby, gems. When the gem is activated (with require_gem or automatically), the gem's path is then added *before* site_ruby. > module Kernel > alias require__ require > > The __ looks terrible, especailly in error output. Something like > > alias require_without_gems require This, of course, will no longer be necessary when RubyGems is integrated into the core. -austin -- Austin Ziegler * halostatue@gmail.com * Alternate: austin@halostatue.ca