On Tuesday 11 October 2005 09:07 am, Berger, Daniel wrote:
> > -----Original Message-----
> > From: Jim Weirich [mailto:jim / weirichhouse.org]
> > Sent: Tuesday, October 11, 2005 6:36 AM
> > To: ruby-core / ruby-lang.org
> > Subject: Re: gems is a language change, not a pkging system
> >
> > Berger, Daniel said:
> > > I guess I'll wait to ask at RubyConf why it couldn't just scan down
> > > the sitelibdir. :)
> >
> > How can you tell from sitedir whether a particular version of
> > a library has been installed?
>
> My preference would be that gems abort if the package is found *at all*
> in the sitelibdir, unless a "force" option is used.

I think you are confusing the difference between library files and gem names.  
For example there is a gem named "activerecord" and there is a ruby file 
named "active_record.rb".  Not only can I not reliably determine if a 
particular version of a gem is in sitelib, I can not reliably tell, in 
general, if a gem is in sitelib *at all*.

(Note:  Actually I could if I compared the list of files included with the gem 
with the stuff in sitelib.  However, the complete file list is not available 
when during the dependency analysis phase for installation.  It only becomes 
available later when the entire gem is downloaded).

Now, pardon me while I rant a bit ...

> However, you could also make a best guess:
>
> # Or something along these lines
> if File.exists?("sitelibdir/some/package")
>    require "some/package"

NO, NO, NO, NO, NO!

NEVER load a file during the installation process!  All kinds of evil things 
can happen by doing this.  Older versions of RubyGems did this (sometimes by 
accident triggered by an autorequire ... that is the reason for my current 
stance that "autorequire is evil").  I've spent a good deal of time sorting 
out problems caused by casual loading during the install process.  

OK, rant over.  Thanks for bearing with me.  I feel much bettern now :)

But the basic suggestion is sound (minus the require part).  Perhaps there 
should be a general way of registering what version of something is installed 
in sitelib.  I would have no problem hooking gems into some sort of general 
mechanism.  Perhaps this is part of what Sean means when he suggests 
decoupling versioning from gems (which I agree with in principle, but lack a 
vision of what that would be at a practical level).

-- 
-- Jim Weirich    jim / weirichhouse.org     http://onestepback.org
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct, 
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)