RubyGems bug bit me.
by Gregory Brown
UPDATE2: The bug in one of Ruport's example programs (Ruport itself never actually requires active_record), was that
Transaction::Simpleis included in a vendor dir of ActiveRecord and is required via gems in PDF::Writer, so they clash, dumping a few warnings. I'm not sure if this will have any side effects or not.
"If there were any more hurdles on this track, the thing would be made out of hurdles"
For those who have been following Ruport development, you know that I've gone through 4 computers in the last 5 weeks. That's insane. But now, as I finally have had a chance to spend a few hours on a machine without it's hardware breaking on me, I've run into software issues.
The current stable version of RubyGems (0.8.11) does not correctly load gems which use the auto_require feature.
So in the course of Ruport development, i found
require 'redcloth'returning big fat falses on me! (Which was causing unsavory results elsewhere in the system)
Searching RubyTalk, Jim Weirich mentioned that it had been fixed in the CVS head.
Sure enough, it was.
I deleted all of the rubygems stuff from my ruby and site_ruby dirs, and then ran:
cvs -d :pserver:email@example.com:/var/cvs/rubygems login
cvs -d :pserver:firstname.lastname@example.org:/var/cvs/rubygems checkout rubygems
sudo ruby setup.rb
I had to reinstall my gems, but once I did, I was back to getting trues instead of falses ;)
Now I have no clue how stable the CVS head is, so this is not a recommendation, but rather just a little experience I wanted to share :)
The good news is, I am back to coding... so those of you out there on the Ruport mailing list, be on the lookout for a beta preview of Ruport in the next day or two.
Thanks to the RubyGems team for quickly fixing this bug so that people who want to be on the bleeding edge rather than downgrading can do so :)
While a bug, it always struck me as a rather innocuous one. Depending on whether require returns true or false seems a bit fragile, as any change in the dependency structure of the libraries could cause a require that formally returned true to be false (i.e. a library gets loaded earlier than expected). MOst people discover the bug during an interactive irb session where the return value of require is shown explicitly.
> I'm curious to know what kind logic you are using that depends on a true
> result from require. Thanks. I'm just trying to understand how people use the > rubygems libraries