[ANN] require_all 1.1.0: the final nail on the coffin of require File.dirname(__FILE__)

require File.dirname(__FILE__) seems like an incredibly common idiom. But
boy is it ugly! Ruby is a beautiful language so why should we litter it
with ugly statements like that?

Now you don't have to! At the suggestion of Roger Pack I've added a new
feature to the require_all gem. Introducing require_rel. Here's how it
works... let's start with an ugly require statement:

  require File.dirname(__FILE__) + 'foobar'

Yeech. Can we do better? Yes we can:

  require_rel 'foobar'

Done! The require_rel statement works relative to the directory the caller
is located in. Bye bye File.dirname(__FILE__)!

Even better, require_rel has the same code loading powers as require_all.
If 'foobar' is a directory, it will look for all the .rb files under the
foobar directory and use require_all's automagic dependency resolution to
load them in the proper order. (In case anyone is wondering, if you have a
'foobar' directory and a 'foobar.rb' require_all will prefer the directory
over the .rb file). Or you can give require_rel a custom glob which works
relative to the current file.

If you'd like to learn more, check it out on github:



Tony Arcieri