Finally accepting the fact that autoload will never be fixed (i.e. there it 
no way to override require to effect autoload's behavior) I decided to 
try re-implementing autoload in Ruby itself.

So here's what I arrived at:

    https://github.com/rubyworks/autoload/blob/master/lib/autoload.rb

I thought that was it, but then I tried a `bundle exec` call with this 
autoload.rb loaded (via RUBYOPT), and it bombs.

    autoload.rb:104:in `const_missing': uninitialized constant 
Module::Settings (NameError)
from /home/trans/.gem/ruby/1.9.3/gems/bundler-1.2.3/lib/bundler.rb:191:in 
`settings'
from /home/trans/.gem/ruby/1.9.3/gems/bundler-1.2.3/lib/bundler.rb:330:in 
`configure_gem_home_and_path'
from /home/trans/.gem/ruby/1.9.3/gems/bundler-1.2.3/lib/bundler.rb:86:in 
`configure'
from /home/trans/.gem/ruby/1.9.3/gems/bundler-1.2.3/lib/bundler.rb:142:in 
`definition'
from 
/home/trans/.gem/ruby/1.9.3/gems/bundler-1.2.3/lib/bundler/cli.rb:423:in 
`exec'
from 
/home/trans/.gem/ruby/1.9.3/gems/bundler-1.2.3/lib/bundler/vendor/thor/task.rb:27:in
 
`run'
from 
/home/trans/.gem/ruby/1.9.3/gems/bundler-1.2.3/lib/bundler/vendor/thor/invocation.rb:120:in
 
`invoke_task'
from 
/home/trans/.gem/ruby/1.9.3/gems/bundler-1.2.3/lib/bundler/vendor/thor.rb:275:in
 
`dispatch'
from 
/home/trans/.gem/ruby/1.9.3/gems/bundler-1.2.3/lib/bundler/vendor/thor/base.rb:408:in
 
`start'
from /home/trans/.gem/ruby/1.9.3/gems/bundler-1.2.3/bin/bundle:14:in `block 
in <top (required)>'
from 
/home/trans/.gem/ruby/1.9.3/gems/bundler-1.2.3/lib/bundler/friendly_errors.rb:4:in
 
`with_friendly_errors'
from /home/trans/.gem/ruby/1.9.3/gems/bundler-1.2.3/bin/bundle:14:in `<top 
(required)>'
from /home/trans/.gem/ruby/1.9.3/bin/bundle:23:in `<main>'

Turns out that the `self` in const_missing that causes this is 
`#<Class:Bundler>`. How can I workout the `Bundler` namespace given that?

All other advice on improving this is also appreciated.



-- You received this message because you are subscribed to the Google Groups 
ruby-talk-google group. To post to this group, send email to 
[email protected]. To unsubscribe from this group, send email 
to [email protected]. For more options, visit this 
group at https://groups.google.com/d/forum/ruby-talk-google?hl=en

Reply via email to