diff options
author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-11-22 10:22:29 +0000 |
---|---|---|
committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-11-22 10:22:29 +0000 |
commit | 0b2c50f3a7c952a518330ac22c16a72089e613a8 (patch) | |
tree | 125a08a02ee4a0baf99d1a12d4bb6c39cc798e6d /instruby.rb | |
parent | 0c717903770a1e9c99e18f25e2b9abad15534400 (diff) |
* 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
Diffstat (limited to 'instruby.rb')
-rw-r--r-- | instruby.rb | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/instruby.rb b/instruby.rb index a8cab9a7e1..d6bfa20c72 100644 --- a/instruby.rb +++ b/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 |