On 3/6/06, Jim Weirich <jim / weirichhouse.org> wrote: > Mark Volkmann wrote: > > On 3/6/06, Austin Ziegler <halostatue / gmail.com> wrote: > > > >> > spec.autorequire = 'init.rb' > >> > >> The #autorequire is deprecated at this point and is not recommended in > >> any way. RubyGems still supports it, but I believe that the next version > >> will be spouting some warnings at people who use autorequire in building > >> their gems. Since you're using a secondary call to do the load, you can > >> mandate that lib/init.rb is the file to load and have your loader do the > >> require yourself. > > > > Maybe I misunderstood this, but I thought "require_gem {gem-name}" > > used the autorequire attribute to know which file from the gem to > > load. Is that correct? If so, what will happen to require_gem when > > autorequire goes away? > > The preferred way of requiring files is to use a plain require. Unless > something tricky is going on, this will work with both gem and non-gem > installed software (assuming you load rubygems beforehand if you are > using gem installs). > > The require_gem is really only needed if you want a particular version > of gem installed, in which case you just *add* the require_gem statement > in a nice, centrally controlled location in your code (because you don't > want to spread version dependencies throughout your code base), and do > the normal requires. > > This is probably with an example: > > If you want you use the foo file in the foobar gem, just do whereever > needed in your code base: > > require 'foo' The problem I have with this is that maybe all I know is that I want to use the foobar gem in my code. How am I supposed to know that the main file I should require is foo.rb? Maybe the main file of each gem should always have the same name as the gem. -- R. Mark Volkmann Partner, Object Computing, Inc.