> > > Will this support all manner of 'require'd files,
> > > including those loaded by the gems require-hack?
> > 
> > [......]
> 
> Try:
> 
> require 'rubygems'
> 
> require 'progressbar'

 $ grep * -wie def | grep -wie require
 loadpath_manager.rb:  def require(file)
 
Looks like RubyGems does an overwrite of Kernel.require:

 module Kernel
   alias require__ require
   def require(file)
     Gem::LoadPathManager.search_loadpath(file) || Gem::LoadPathManager.search_gempath(file)
     require__(file)
   end
 end

That will do the trick in our application. But what happens
when a library does a require_gem? Time for the next test. I
don't know Rails, but I think it has some dependencies. Just
giving it a shot...

Test 1:
 
 $ cat test1.rb 
 require "rubygems"
 require_gem "rails"

 $ ruby test1.rb 

Looks good. It's useless, but the dependencies are fullfilled.

Test 2:
 
 $ cat test2.rb 
 require "rubygems"
 require "rails" 
 
 $ ruby test2.rb 
 /usr/local/lib/ruby/site_ruby/1.8/rubygems/loadpath_manager.rb:5:in `require__': No such file to load -- rails (LoadError)
         from /usr/local/lib/ruby/site_ruby/1.8/rubygems/loadpath_manager.rb:5:in `require'
         from test2.rb:2

Oops! I think it hasn't anything to do with dependencies. The
trick doesn't work.

Any RubyGem hacker, out there?

gegroet,
Erik V.