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
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?
Charles Comstock
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
···
On 4/5/2004, at 12:23 AM, Charles Comstock wrote:
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?
Personally I’d like this, but it raises the complexity a bit
(permissions are my first concern) - would be fairly easy to
implement, though.
···
–
Good news. Ten weeks from Friday will be a pretty good day.
Rasputin :: Jack of All Trades - Master of Nuns
Chad Fowler wrote:
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.
Oh because it executes another program as opposed to making a system
call or something like that? Sorry wasn’t trying to be picky I wasn’t
familiar with FileUtils and was thinking about using it my own projects.
I hadn’t thought of that performance issue with making a system call.
Hmm maybe that should be in the standard library info about FileUtils.
Thank you for the info,
Charles Comstock
Assuming you’re talking about automatic downloading and installation
of uninstalled gems as needed by running programs, I dislike it. I
want to be in control of what’s going onto the machine.
Furthermore, I see no need for it, in theory or in practice. In
theory, because you download dependencies as you go about installing
things. In practice, because it’s so damn easy to install gems as it
is that I see no need for “improvement”.
Cheers,
Gavin
···
On Tuesday, May 4, 2004, 10:47:51 PM, Dick wrote:
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?
Personally I’d like this, but it raises the complexity a bit
(permissions are my first concern) - would be fairly easy to
implement, though.
So, what about submitting a patch to FileUtils to do this for us
and speed itself up?
···
On Tuesday, 4 May 2004 at 20:18:22 +0900, Chad Fowler wrote:
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.
–
Jim Freeze
Chad Fowler wrote:
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.
Oh because it executes another program as opposed to making a system
call or something like that? Sorry wasn’t trying to be picky I wasn’t
familiar with FileUtils and was thinking about using it my own
projects. I hadn’t thought of that performance issue with making a
system call.
Pickiness is exactly what’s needed right now. Thanks.
Chad
···
On 4/5/2004, at 7:34 AM, Charles Comstock wrote:
Maybe not a bad idea. Go for it. 
Chad
···
On Sat, 8 May 2004 22:00:08 +0900, Jim Freeze jim@freeze.org wrote:
On Tuesday, 4 May 2004 at 20:18:22 +0900, Chad Fowler wrote:
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.
So, what about submitting a patch to FileUtils to do this for us
and speed itself up?