[Groonga-commit] droonga/drntest at 1f96a62 [master] Allow to specify path to config files from outside

Back to archive index

YUKI Hiroshi null+****@clear*****
Mon Nov 25 16:58:52 JST 2013


YUKI Hiroshi	2013-11-25 16:58:52 +0900 (Mon, 25 Nov 2013)

  New Revision: 1f96a62a602e785796a8c4dc782a2155ca35058a
  https://github.com/droonga/drntest/commit/1f96a62a602e785796a8c4dc782a2155ca35058a

  Message:
    Allow to specify path to config files from outside

  Modified files:
    lib/drntest/test-runner.rb

  Modified: lib/drntest/test-runner.rb (+23 -6)
===================================================================
--- lib/drntest/test-runner.rb    2013-11-25 16:52:16 +0900 (9818683)
+++ lib/drntest/test-runner.rb    2013-11-25 16:58:52 +0900 (90c005f)
@@ -23,29 +23,46 @@ require "fileutils"
 
 module Drntest
   class TestRunner
-    attr_reader :tester, :target_path
+    attr_reader :tester, :target_path, :config_dir, :config_file, :catalog_file
 
     def initialize(tester, target)
       @tester = tester
       @target_path = Pathname(target)
-      prepare
     end
 
     def run
       print "#{target_path}: "
+      prepare
       setup
       results = process_requests
       teardown
       results
     end
 
+    def config_dir
+      return @config_dir if @config_dir
+      return @config_file.parent if @config_file
+      target_path.parent
+    end
+
+    def config_dir=(path)
+      @config_dir = Pathname(path)
+    end
+
+    def config_file=(path)
+      @config_file = Pathname(path)
+    end
+
+    def catalog_file=(path)
+      @catalog_file = Pathname(path)
+    end
+
     private
     def prepare
       options = load_options
 
-      @config_dir = target_path.parent
-      @config_file = config_dir + "fluentd.conf"
-      @catalog_file = config_dir + "catalog.json"
+      @config_file ||= config_dir + "fluentd.conf"
+      @catalog_file ||= config_dir + "catalog.json"
 
       if options[:CONFIG]
         @config_file = Pathname(options[:CONFIG])
@@ -70,7 +87,7 @@ module Drntest
     end
 
     def temporary_dir
-      @config_dir + "tmp"
+      config_dir + "tmp"
     end
 
     def process_requests
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index