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
This commit is contained in:
nobu 2017-01-15 05:50:41 +00:00
parent 710d9384e7
commit 1d36a09d81
1 changed files with 10 additions and 1 deletions

View File

@ -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)