[Rubygems-developers] Deprecation of autorequire

Nic Williams drnicwilliams at gmail.com
Wed Oct 18 09:08:10 EDT 2006

I'm developing an extension for rails to allow gems all the rights and
priveleges that plugins get, so rails can get rid of plugins and have all
the benefits of gems (versioning, dependencies, etc).

My current implementation uses the autorequire attribute of a Gem object to
determine which is the root library that needs to be require'd by rails on
start up.

Then I was reminded that autorequire is being/has been deprecated -

So now I'm unsure of how rubygems + require work together.

If I have a gem called "project_one", and a file "lib/project_one.rb", and
my external code does "require 'project_one'" I expect that the gem's
project_one.rb file will be loaded, which probably then loads other files in
the lib/ folder structure. But I don't know why, and I don't know what
happens if the gem is called "project_one" and there isn't a
"lib/project_one.rb" file, instead a "lib/code.rb" file that needs to be
required instead.

Is there docco around to explain this?

Also, in the gems-instead-of-plugins case, if I shouldn't use autorequire
(or if there are lots of gems that haven't set it) is it a safe bet to
assume that there will be a "lib/<gem_name>.rb" file that should be


Dr Nic Williams
http://www.drnicwilliams.com - Ruby/Rails blog
skype: nicwilliams
(m) +31 62 494 8552
(p) +61 7 3102 3237 (finds me anywhere in the world)
(f) +61 7 3305 7572 (sends fax to my email)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rubygems-developers/attachments/20061018/a8ec9a32/attachment.html 

More information about the Rubygems-developers mailing list