[前][次][番号順一覧][スレッド一覧]

ruby-changes:45260

From: nobu <ko1@a...>
Date: Sun, 15 Jan 2017 14:50:46 +0900 (JST)
Subject: [ruby-changes:45260] nobu:r57333 (trunk): rbinstall.rb: mimic rubygems wrapper script

nobu	2017-01-15 14:50:41 +0900 (Sun, 15 Jan 2017)

  New Revision: 57333

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57333

  Log:
    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.

  Modified files:
    trunk/tool/rbinstall.rb
Index: tool/rbinstall.rb
===================================================================
--- tool/rbinstall.rb	(revision 57332)
+++ tool/rbinstall.rb	(revision 57333)
@@ -693,7 +693,16 @@ module RbInstall https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L693
     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)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]