This post originated from an RSS feed registered with Ruby Buzz
by Eric Hodel.
Original Post: RubyGems 1.4 vs Ruby 1.9
Feed Title: Segment7
Feed URL: http://blog.segment7.net/articles.rss
Feed Description: Posts about and around Ruby, MetaRuby, ruby2c, ZenTest and work at The Robot Co-op.
Ruby 1.9.2's gem_prelude is interfering with RubyGems' loading causing errors when during the loading of RubyGems 1.4. In Ruby 1.9.1 this wasn't a problem because gem_prelude loaded all the latest gems into $LOAD_PATH at startup time. This caused problems where a gem depended on a non-latest version.
In Ruby 1.9.2 gem_prelude uses a custom require which loads RubyGems after the first LoadError.
At startup time RubyGems attempts to load three files that may not exist. One for operating-system defaults, one for ruby engine defaults and Win32API to determine where to look for .gemrc.
In Ruby 1.9.2 this causes massive confusion because RubyGems is asked to look up these missing files while only partially loaded.
My solution was to remove loading of .gemrc from RubyGems startup and to avoid attempting to require the OS and ruby engine defaults files at startup time. gem_prelude attempts to load the defaults files when ruby starts so skipping the load is not a problem. Skipping loading .gemrc prevents the gem home and gem path from being set via gemrc.
I also removed support for legacy repositories (those that use YAML and bulk updating) from RubyGems because supporting them requires too many files. I don't think this is an issue.
So far nobody has claimed that setting gem home or gem path via gemrc as a critical feature. Setting the GEM_HOME and GEM_PATH environment variables will work just as well. Removing the feature also allows RubyGems to avoid loading YAML for default operations as the gemrc file is in YAML format.
If you wish to chime in on these features please use IRC or the mailing list. My blog isn't the best place to keep these kinds of decisions in the public eye.