[Groonga-commit] groonga/groonga-test [master] Use cut-diff if available

Back to archive index

null+****@clear***** null+****@clear*****
2012年 3月 2日 (金) 17:46:20 JST


Kouhei Sutou	2012-03-02 17:46:20 +0900 (Fri, 02 Mar 2012)

  New Revision: 590de31eba7167f4959e040ce7a6bdb6f8d70ef6

  Log:
    Use cut-diff if available

  Modified files:
    bin/groonga-test

  Modified: bin/groonga-test (+18 -0)
===================================================================
--- bin/groonga-test    2012-03-02 17:40:40 +0900 (0ce5f7d)
+++ bin/groonga-test    2012-03-02 17:46:20 +0900 (dfd0cf3)
@@ -121,6 +121,24 @@ class GroongaTester
     output
   end
 
+  def detect_suitable_diff
+    if command_exist?("cut-diff")
+      @diff = "cut-diff"
+      @diff_options = []
+    else
+      @diff = "diff"
+      @diff_options = ["-u"]
+    end
+  end
+
+  def command_exist?(name)
+    ENV["PATH"].split(File::PATH_SEPARATOR).each do |path|
+      absolute_path = File.join(path, name)
+      return true if File.executable?(absolute_path)
+    end
+    false
+  end
+
   class Reporter
     def initialize(tester)
       @tester = tester




Groonga-commit メーリングリストの案内
Back to archive index