[Rubygems-developers] Change that introduces a (slight) backward incompatibility

Richard Kilmer rich at infoether.com
Thu Jun 10 14:16:38 EDT 2004

I am working the the 'require' dependencies in rubygems.

Right now, when you do:

require 'rubygems' 

it loads all the gem files whether you need them or not.

What is interesting is what you _NEED_ for the runtime of RubyGems to work
(to use gems, rather than manage them) is...

require 'rubygems' 

... which would just do ...

  require 'rubygems/cache'
  require 'rubygems/specification'
  require 'rubygems/version'

But right now there are these files that are used when managing the gem
repository that are loaded as well...

require 'rubygems/builder'
require 'rubygems/format'
require 'rubygems/remote_installer'
require 'rubygems/installer'
require 'rubygems/validator'
require 'rubygems/doc_manager'

What I did was place all of these require statements in a module singleton


Which you call when you want to manage the gems rather than just use them.
This is great, except that the gemspec ruby scripts now need to do:

require "rubygems"

As do generated gem header files.

With this change, though, we cut the default loading of files down from:

["rubygems.rb", "rubygems/cache.rb", "rubygems/specification.rb",
"rubygems/version.rb", "rubygems/builder.rb", "stringio.bundle",
"rubygems/format.rb", "rubygems/remote_installer.rb",
"rubygems/installer.rb", "rubygems/validator.rb", "rubygems/doc_manager.rb"]

To this...

["rubygems.rb", "rubygems/cache.rb", "rubygems/specification.rb",

Again...very cool from a runtime perspective, but it does introduce the
changes in the gemspec and gem header (although gem headers are rarely used
unless installed without the gem -i command (ie. Running the .gem

So, gemspecs are the main issue.  To use what I am about to check into CVS
you need to update the gemspec accordingly.

I updated all our example gemspecs, and tests and functional code


More information about the Rubygems-developers mailing list