Friday, October 09, 2009

How to hose a Rubygems in one simple step.

So, I had the unfortunate mispleasure of having to quickly solve The Mystery of the Hosed Rubygems Installation after installing 1 gem.

Apparently, the problem was with that gem's .gemspec file, in which the following line:

s.require_paths = %q{"lib"}

was the culprit. That one little caused the entire rubygems system to fail -- require failed, the `gem` command failed; basically everything related to Rubygems failed in one spectacular burst of flame.

The solution of course was to change it to

s.require_paths = ["lib"]

The problem being, Rubygems expects Gem::Specification#require_paths to always be an array, and, not bothering to check otherwise, tries to call Array#join. Apparently exceptions raised when parsing a gem's specification aren't caught anywhere in the system, so it hoses the whole thing top to bottom.