aboutsummaryrefslogtreecommitdiffstats
path: root/tool/rbinstall.rb
diff options
context:
space:
mode:
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)