On 4/5/2004, at 12:23 AM, Charles Comstock wrote:

> I was curious why the code in installer.rb in ruby gems was setup like 
> this?
>
> I thought mkdir_p checks to make sure of the existance of a dir before 
> creating it, and quietly fails if it already exists, making the 
> additional check seem odd.  Is there a particular reason for this?
>
>        unless File.exist? File.join(install_dir, "specifications")
>          FileUtils.mkdir_p File.join(install_dir, "specifications")
>        end
>        unless File.exist? File.join(install_dir, "cache")
>          FileUtils.mkdir_p File.join(install_dir, "cache")
>        end
>

>
You're right, but if we replaced this with:

FileUtils.mkdir_p File.join(install_dir, "specifications")
FileUtils.mkdir_p File.join(install_dir, "cache")

...it would run between 300 and 400 times slower (literally).  That's 
not a big deal for a single require_gem, but in a system that loads a 
*lot* of gems, it might be a problem.

> Also, I wasn't quite sure on this, is require_gem supposed to 
> automatically get a package if it's not local the first time it runs 
> or no?
>
>

Not in it current incarnation, no.

Thanks,
Chad