[rspec-devel] require 'rubygems'

Luis Lavena luislavena at gmail.com
Thu Mar 26 09:07:50 EDT 2009

2009/3/26 Peter Fitzgibbons <peter.fitzgibbons at gmail.com>:
> On Thu, Mar 26, 2009 at 6:12 AM, David Chelimsky <dchelimsky at gmail.com>
> wrote:
>> 2009/3/26 Peter Fitzgibbons <peter.fitzgibbons at gmail.com>:
>> >
>> >>
>> >> Seems to me that any libraries don't need this.  By the time the
>> >> libraries
>> >> are loading, rubygems should already be loaded (otherwise the libraries
>> >> wouldn't have been found).
>> >>
>> >> I only put this in the top level application code.  One place.
>> >>
>> >> At least this is true for rake.  Is rspec different?
>> >
>> > I'm with you.  Also this seems to also be taken care of through RUBYOPT,
>> > no?
>> Setting RUBYOPT means that all of your programs always load the
>> rubygems machinery even if you're not using rubygems. While I realize
>> that most of us use gems in nearly all (if not 100%) of our projects,
>> I think there is a case for saying "don't make me load rubygems unless
>> I need it" that is equally as strong as "don't force me to use
>> rubygems as my gem-loading strategy."
> Yes, I agree.  My arrow missed the target.  I was trying to say, those who
> need rubygems, as Ryan points out, should be using RUBYOPT or calling
> require 'rubygems' somewhere above "any" library.  I'm with Ryan that as a
> maintainer, you should be "above" the use of rubygems (as a rails user, I
> also understand the pain that entails).

RUBYOPT is not the solution. I've faced and replied to lot (more than
20) emails and support requests about RUBYOPT being set or not in
One-Click Installer.

Also, the change of no rubygems all across rspec broke color output
when called form autospec, that is because it calls directly to ruby
with the direct binary script, not using RubyGems load machinery.

So, while I can agree with Ryan point on having rubygems in your
library or specs is wrong, sometimes is needed.

Extreme purism is not a solution. If someone is complaining on
something I'm doing wrong, please provide me a patch that doesn't
break my normal usage (or other hundred users).

Is hard to split between rspec and the libraries it depends on, even
harder for the user to trace what happened between the version of your
library that supposed to be working on previous releases.

Sorry for being so stubborn.

Luis Lavena
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry

More information about the rspec-devel mailing list