rails/rails — pull request #4735 by arton (2012-01-28 20:20:07+00:00)
Title: Re-launch assets:precompile task using original $0 if $0 is batch file so it works on Windows

With MSWin32 version of ruby provides Windows batch file that converted from original script files.
The batch file is not plain ruby script, so the patch provided by https://github.com/rails/rails/pull/3121#issuecomment-3702853 causes error on Windows.

ex)
C:\tmp\webtest>rake assets:precompile
c:/Users/arton/bin/ruby.exe c:/Users/arton/rake.bat assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
c:/Users/arton/bin/rake.bat:1: syntax error, unexpected tIDENTIFIER, expecting $end
rake aborted!
Command failed with status (1): [c:/Users/arton/bin/ruby.exe c:/U... (omitted by the poster)

Tasks: TOP => assets:precompile
(See full trace by running task with --trace)

So, this patch checks $0 is batch file or not. And if $0 is batch file, then run it with Kernel.exec (means Win32 API) instead of ruby.

Thanks.