[Rubyinstaller-devel] make.cmd?

Luis Lavena luislavena at gmail.com
Mon Apr 21 22:55:09 EDT 2008


On Mon, Apr 21, 2008 at 11:03 PM, Gordon Thiesfeld <gthiesfeld at gmail.com> wrote:
> >  The issue with 'gem' is that rubygems generates to files: gem and
>  >  gem.bat which is a stub to execute the true gem ruby script.
>  >
>  >  If we move from script+stub to scripts similar of what ruby ships
>  >  (take a look at irb.bat) can workaround the issues with
>  >  "cross-compatibility" raised of being using
>  >  system/exec/backticks/whatever
>  >
>
>  Ok, I've stubbed make, gcc, and sh, and rubygems tests pass.  I'm
>  working on a patch for rubygems bin scripts as well, but I can't find
>  a simple way to do it without breaking a lot of tests.  I'll keep at
>  it.  I did discover that the exit /b %errorlevel% doesn't do the right
>  thing when called in Ruby, so I'm just making the cmd files so that
>  the last line is the one we care about..
>
>  This is my rake.cmd.  It seems to be working fine.  Let me know if you
>  see any problems with it.
>
>  @ECHO OFF
>  goto endofruby
>  #!c:/ruby/ruby_mingw/bin/ruby.exe
>  #
>  # This file was generated by RubyGems.
>  #
>  # The application 'rake' is installed as part of a gem, and
>  # this file is here to facilitate running it.
>  #
>
>  require 'rubygems'
>
>  version = ">= 0"
>
>  if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
>   version = $1
>   ARGV.shift
>  end
>
>  gem 'rake', version
>  load 'rake'
>  __END__
>  :endofruby
>  "%~d0%~p0ruby" -x "%~f0" %*
>

I was one of the responsible of change the .cmd files to .bat in
latest rubygems releases.

Why? because .bat take precedence instead of .cmd, also because, even
we don't *support* win9x, at least it will work out of the box.

I'll change to uppercase all the references to windows/batch commands (GOTO).

I'll take a look at rubygems (again) to see if we can get rid of the
separate batch/script files for the next release, or at least, our
implementation, since I'm thinking seriously not ship 1.8.7...
(there is a heated discussion about that).

An alternative will be have a series of patches that can be
rolled/applied to current 1.8.6-p114 and fix particular things in ruby
source or rubygems until an official release ship them.

As a RubyGems contributor I can slip these changes in, but we will
require wait for the next release to make them available.

>  >  Please let me congrats you Gordon, you just hit one of the big issues
>  >  that blocks true cross-platform implementation.
>  >
>  >  Also, these injected stubs/scripts can workaround the pipes issues for
>  >  scripts using .rb and being tried to executed standalone (this is an
>  >  old issue of ruby and how cmd creates the process and pass the
>  >  information to the child process).
>
>  Yeah, I've been bitten by this one too :-).  The only problem with
>  batch files is that it makes ctrl-c cause the extremely annoying
>  "Terminate batch job (Y/N)?".  I did find a way to modify cmd.exe so
>  that it doesn't do this, but it would be nice if there was a cleaner
>  solution.
>

There is no easy solution without binary patching cmd.exe, since
in-memory patches will require us alter ruby.exe and we can get caught
by DEP protection :-P

We need to talk about the the future on this, do you feel comfortable
we set a wiki page and start drawing a picture about the goals for the
release?

Thank you for your time Gordon.

-- 
Luis Lavena
Multimedia systems
-
Human beings, who are almost unique in having the ability to learn from
the experience of others, are also remarkable for their apparent
disinclination to do so.
Douglas Adams


More information about the Rubyinstaller-devel mailing list