[Rubyinstaller-devel] question on bat files

Luis Lavena luislavena at gmail.com
Sat Jan 31 07:40:59 EST 2009

On Wed, Jan 28, 2009 at 5:51 PM, Roger Pack <rogerpack2005 at gmail.com> wrote:
> Question:

Hey Roger, sorry took me some time to get back to you.

> I've noticed currently with gem.bat files [1]:
> It doesn't play always nicely with windows and different versions of ruby.

Let's see...

> 1) a contrived example, but if you have a ruby.exe in your path , say
> c:\ruby_path and run c:\other_ruby\gem.bat from the c:\ directory, it
> uses c:\ruby_path\ruby.exe to run it

Previously the batch files contained the location path of the ruby in
usage. That functionality was removed since affected gem installation
and future relocation of your Ruby folder.

It assumes gem.bat will use "ruby.exe" and look for the ruby-script
with the same name of this batch file (dpn0 is used for that).

Since the batch and scripts can reside outside ruby bindir, there is
no way for us to know if ruby.exe is over there (not without creating
lot of batchfile logic).

> 2) you cannot copy gem.bat file anywhere and run it--it must remain
> where it is [I don't think this limitation on Linux].

Is not, since the gem script in linux contains the shebang that tells
you where it should find the ruby interpreter, sometimes is just
/bin/env ruby, sometimes is the direct ruby path.

For you to use other interpreter with that script need to force the
interpreter (ruby19 /path/my/1.8/gem)

> Do you think I should report these or are they too obscure to care about?

Are too obscure and contains lot cruft that I personally will like to
avoid. Being one of those having two interpreters in the path at the
same time (with the exact same name).

> Thanks!
> -=r
> [1] example:
> IF NOT "%~f0" == "~f0" GOTO :WinNT
> @"ruby.exe" "c:/ruby18/bin/gem" %1 %2 %3 %4 %5 %6 %7 %8 %9
> :WinNT
> @"ruby.exe" "%~dpn0" %*
> _______________________________________________
> Rubyinstaller-devel mailing list
> Rubyinstaller-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rubyinstaller-devel

Luis Lavena
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry

More information about the Rubyinstaller-devel mailing list