mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* instruby.rb: Install batch files on Windows. [Submitted by usa]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0c71790377
commit
0b2c50f3a7
2 changed files with 25 additions and 4 deletions
|
@ -1,3 +1,7 @@
|
|||
Fri Nov 22 19:20:36 2002 Akinori MUSHA <knu@iDaemons.org>
|
||||
|
||||
* instruby.rb: Install batch files on Windows. [Submitted by usa]
|
||||
|
||||
Fri Nov 22 18:31:46 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* eval.c (rb_add_method): node may be NULL.
|
||||
|
|
25
instruby.rb
25
instruby.rb
|
@ -108,13 +108,30 @@ for src in Dir["bin/*"]
|
|||
Installer.install src, dest, 0755, true
|
||||
|
||||
open(dest, "r+") { |f|
|
||||
shebang = f.gets
|
||||
body = f.readlines
|
||||
shebang = f.gets.sub(/ruby/, ruby_install_name)
|
||||
body = f.read
|
||||
|
||||
f.rewind
|
||||
|
||||
f.print shebang.sub(/ruby/, ruby_install_name), *body
|
||||
f.print shebang, body
|
||||
f.truncate(f.pos)
|
||||
f.close
|
||||
|
||||
if RUBY_PLATFORM =~ /mswin32|mingw|bccwin32/
|
||||
open(dest + ".bat", "w") { |b|
|
||||
b.print <<EOH, shebang, body, <<EOF
|
||||
@echo off
|
||||
if "%OS%" == "Windows_NT" goto WinNT
|
||||
ruby -Sx "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
goto endofruby
|
||||
:WinNT
|
||||
ruby -Sx "%~nx0" %*
|
||||
goto endofruby
|
||||
EOH
|
||||
__END__
|
||||
:endofruby
|
||||
EOF
|
||||
}
|
||||
end
|
||||
} unless $dryrun
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue