On 5/26/06, Wilson Bilkovich <wilsonb / gmail.com> wrote: > On 5/26/06, Garance A Drosehn <drosihn / gmail.com> wrote: >> On 5/23/06, Austin Ziegler <halostatue / gmail.com> wrote: >>> On 5/23/06, John Gabriele <jmg3000 / gmail.com> wrote: >>>> 3. With the current RubyGems 0.8.11, should we do >>>> >>>> require 'rubygems' >>>> require_gem 'foo' >>>> >>>> or >>>> >>>> require 'rubygems' >>>> require 'foo' >>> >>> Never use require_gem unless you need to fix a gem version. >>> Avoid using it anyway, if you can. >> Hmm. I seem to remember needing to use require_gem in some >> situation. I started with require rubygems + require >> the_gem_I_needed, because I was copying those lines from some other >> example. But that didn't work until I changed the second "require" >> to "require_gem"... > I've had to use it when I didn't have time to figure out what the > actual rb file name was for a gem. This uses behaviour that is being deprecated. I would suspect that by time RubyGems 1.0 is released, require_gem (if it even exists for backward compatibility) will ignore autorequire because all gems at that point should no longer be using the autorequire functionality. #require_gem should be used sparingly, and then only to fix a specific version until the next release of Rubygems when #gem will be introduced to do the same. > An example of this is: > require_gem "rubyzip" # Works. > require "rubyzip" # Blows up > require "zip/zip" # Works, once you know it exists. Your first line will not work with any of the recent gems that I have released, nor any of the ones that I expect to release in the future. Even if you do "require_gem 'mime-types'", you will still need to do "require 'mime/types'" afterwards. This would be something that should encourage better documentation of gems. -austin -- Austin Ziegler * halostatue / gmail.com * Alternate: austin / halostatue.ca