[rspec-devel] require 'rubygems'

David Chelimsky dchelimsky at gmail.com
Wed Mar 25 23:07:20 EDT 2009

On Wed, Mar 25, 2009 at 9:56 PM, Scott Taylor <scott at railsnewbie.com> wrote:
> David Chelimsky wrote:
>> Hey all,
>> I'd like your feedback on something before I merge it into master.
>> Before the 1.2 release I read http://gist.github.com/54177, in which
>> Ryan Tomayko explains why "require 'rubygems'" should not appear in
>> your library code. This made some sense to me. So much so, that I
>> yanked it from rspec for the 1.2 release.
>> Then the bug reports started coming in and some conversation led me to
>> believe that this had been a mistake because it caused pain for the
>> lion's share of rspec users because most libraries go ahead and
>> require 'rubygems', so that has become the defacto standard situation,
>> for better or worse.
>> The solution that I added to 1.2.1 was to reinstate "require
>> 'rubygems'" but with a catch:
>>  require 'rubygems' unless ENV['NO_RUBYGEMS']
> How are others normally loading libraries without rubygems?  Are most
> writing wrapper scripts or setting the RUBYOPT environment variable as Ryan
> points out in his post?

The problem w/ RUBYOPT is that it means that rubygems is always loaded
even if you don't need it. At least that's the problem that's been
expressed to me. I don't have a problem with that myself because
pretty much everything I do depends on other gems.


> Scott
>> This seemed like a fair tradeoff, since it allowed those who didn't
>> want to have to think about it to just use rspec as/is, and those who
>> do care and don't use rubygems in any given environment had an out.
>> I've just received another report about that decision, with a patch,
>> that offers what I think is a better solution:
>> https://rspec.lighthouseapp.com/projects/5645/tickets/763-rubygems-handling-once-more
>> I've pushed Tobias' patch to a require-rubygems branch for the moment.
>> I'm inclined to merge it into master, but this would the third release
>> in a row that makes changes to how rspec handles rubygems, and I want
>> it to be the last. So please let me know your thoughts, for or
>> against.
>> Thanks,
>> David
>> _______________________________________________
>> rspec-devel mailing list
>> rspec-devel at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/rspec-devel
> _______________________________________________
> rspec-devel mailing list
> rspec-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-devel

More information about the rspec-devel mailing list