[Rubygems-developers] Why is spec.autorequire deprecated?

Austin Ziegler halostatue at gmail.com
Wed Aug 27 08:11:27 EDT 2008

On Wed, Aug 27, 2008 at 7:35 AM, Caspar Florian Ebeling
<florian.ebeling at gmail.com> wrote:
> I'm just writing a gem spec and I got a warning about
> Specification#autorequire being deprecated. Maybe I
> miss an important part, but isn't that the idea, to first
> require "rubygems" (if ruby 1.8), then the gem, and then
> be able to access classes etc? How is it meant to work
> otherwise?

#autorequire is a bit dangerous and was probably a mistake from the beginning.

What it did was required a file when the gem was activated.

It worked like:

  require 'rubygems'
  require_gem 'pdf-writer' # this would be gem 'pdf-writer' these days, mostly

The only difference these days is:

  require 'rubygems'
  require 'pdf/writer' # RubyGems automatically finds and activates the gem

Austin Ziegler * halostatue at gmail.com * http://www.halostatue.ca/
 * austin at halostatue.ca * http://www.halostatue.ca/feed/
 * austin at zieglers.ca

More information about the Rubygems-developers mailing list