summaryrefslogtreecommitdiff
path: root/tool/rbinstall.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-15 05:50:41 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-15 05:50:41 +0000
commit1d36a09d81d3b1b06902942fc912fa9cf8ddd5ad (patch)
tree9803eebbd7aaf6ff4f1513c70697e0914ad3583a /tool/rbinstall.rb
parent710d9384e7c31950de49ebc1bb4fb3599b16ab5c (diff)
rbinstall.rb: mimic rubygems wrapper script
* tool/rbinstall.rb (app_script_text): move shell script part after comments generated by RubyGems. '#'-lines are comments in both of ruby and shell script. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/rbinstall.rb')
-rwxr-xr-xtool/rbinstall.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb
index 490f5f3281..854fa07e14 100755
--- a/tool/rbinstall.rb
+++ b/tool/rbinstall.rb
@@ -693,7 +693,16 @@ module RbInstall
def shebang(bin_file_name)
path = File.join(gem_dir, spec.bindir, bin_file_name)
first_line = File.open(path, "rb") {|file| file.gets}
- $script_installer.prolog(first_line)
+ $script_installer.prolog(first_line).chomp
+ end
+
+ def app_script_text(bin_file_name)
+ # move shell script part after comments generated by RubyGems.
+ super.sub(/\A
+ (\#!\/bin\/sh\n\#.*-\*-\s*ruby\s*-\*-.*\n)
+ ((?:.*\n)*?\#!.*ruby.*\n)
+ \#\n
+ ((?:\#.*\n)+)/x, '\1\3\2')
end
def check_executable_overwrite(filename)