Gemspec option to prevent auto-require?

On 6/13/06, Gregory B. [email protected] wrote:

Do you have the RUBYOPT shell variable set? Do you have
a .gemrc? .irbrc?

[sandal@harmonix ~]$ echo $RUBY_OPT

whoops

[sandal@harmonix ~]$ echo $RUBYOPT

still returns nothin.

But the problems solved, so I guess it’s thread death time :slight_smile:

On Jun 13, 2006, at 7:37 PM, Jim W. wrote:

Gregory B. wrote:

On 6/13/06, Eric H. [email protected] wrote:

I don’t see fastercsv being required when rubygems is involved.

I think the difference here is that Eric is probably running with a
very
recent development version of RubyGems and Gregory is running the last
stable release.

[…]

Dang, yes, this is correct.

Sorry for the confusion.


Eric H. - [email protected] - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com

On Jun 13, 2006, at 6:02 PM, Eric H. wrote:

Yes, there is. ruport required it.
Neo:~/Desktop$ ruby -rubygems mini_ruport.rb
Ruport loaded.
Doing non-CSV stuff…
FasterCSV not loaded.
Now doing CSV stuff…
FasterCSV loaded.
Neo:~/Desktop$ cat mini_ruport.rb
#!/usr/local/bin/ruby -w

$check = lambda do
if defined? FasterCSV
“FasterCSV loaded.”
else
“FasterCSV not loaded.”
end
end

def to_csv
require “faster_csv”
puts “Now doing CSV stuff…”
puts $check.call

end

def to_xml
require “james_doesnt_have_this”

end

puts “Ruport loaded.”
puts “Doing non-CSV stuff…”
puts $check.call
to_csv

It does not when I am not using gems.

If you’re using ruport you’re using gems. ruport contains “require
‘rubygems’” somewhere inside.

Hmm, can’t think of any good reason for it to do that.

James Edward G. II

Just noticed this:

Gregory B. wrote:

This patch seems to resolve the problem, also:

— rubygems.rb 2006-06-13 22:48:48.000000000 -0400
+++ rubygems-fix.rb 2006-06-13 22:49:22.000000000 -0400
@@ -164,7 +164,7 @@

   # Load dependent gems first
   spec.dependencies.each do |dep_gem|
  •   activate(dep_gem, autorequire)
    
  •   activate(dep_gem, spec.autorequire)
     end
    

Oh, don’t do this. The autorequire field in the gem spec is not a
boolean flag, but the name of the file to automatically require when
activating a gem. Setting autorequire in the gem spec only controls
what file you want to autorequire, not whether dependent gems should
autorequire or not.

And we are deprecating autorequire anyways.

– Jim W.

On 6/14/06, Jim W. [email protected] wrote:

Gregory B. wrote:

autorequire or not.
Ah, I suspected I was breaking something :wink:

And we are deprecating autorequire anyways.

Good!

On Jun 13, 2006, at 9:44 PM, Jim W. wrote:

Loading A
=> true
irb(main):002:0>

Note that you only get this behavior when the b package specifies an
autorequire file (which b does in this case, and which the fastercsv
package does as well).

Thank you for pointing this out. I’ve released FasterCSV 0.2.1 which
removes the autorequire.

James Edward G. II