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

ruby-changes:45258

From: nobu <ko1@a...>
Date: Sun, 15 Jan 2017 09:45:17 +0900 (JST)
Subject: [ruby-changes:45258] nobu:r57331 (trunk): rbinstall.rb: do nothing if bin script is same

nobu	2017-01-15 09:45:10 +0900 (Sun, 15 Jan 2017)

  New Revision: 57331

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

  Log:
    rbinstall.rb: do nothing if bin script is same
    
    * tool/rbinstall.rb (check_executable_overwrite): do nothing if
      the existing file equals to the wrapper script to be generated.
    
    * tool/rbinstall.rb (generate_bin_script): ditto.

  Modified files:
    trunk/tool/rbinstall.rb
Index: tool/rbinstall.rb
===================================================================
--- tool/rbinstall.rb	(revision 57330)
+++ tool/rbinstall.rb	(revision 57331)
@@ -695,6 +695,25 @@ module RbInstall https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L695
       first_line = File.open(path, "rb") {|file| file.gets}
       $script_installer.prolog(first_line)
     end
+
+    def check_executable_overwrite(filename)
+      return if @wrappers and same_bin_script?(filename, @bin_dir)
+      super
+    end
+
+    def generate_bin_script(filename, bindir)
+      return if same_bin_script?(filename, bindir)
+      super
+    end
+
+    def same_bin_script?(filename, bindir)
+      path = File.join(bindir, formatted_program_filename(filename))
+      begin
+        return true if File.binread(path) == app_script_text(filename)
+      rescue
+      end
+      false
+    end
   end
 end
 

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

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