[Groonga-commit] groonga/groonga-query-log at af5ea53 [master] run-regression-test: add --recreate-database option

アーカイブの一覧に戻る

Kouhei Sutou null+****@clear*****
Thu May 8 14:17:43 JST 2014


Kouhei Sutou	2014-05-08 14:17:43 +0900 (Thu, 08 May 2014)

  New Revision: af5ea53ae1c6eebec0523723b15d08a0466335dc
  https://github.com/groonga/groonga-query-log/commit/af5ea53ae1c6eebec0523723b15d08a0466335dc

  Message:
    run-regression-test: add --recreate-database option

  Modified files:
    lib/groonga/query-log/command/run-regression-test.rb

  Modified: lib/groonga/query-log/command/run-regression-test.rb (+12 -2)
===================================================================
--- lib/groonga/query-log/command/run-regression-test.rb    2014-05-07 17:54:34 +0900 (7ec113e)
+++ lib/groonga/query-log/command/run-regression-test.rb    2014-05-08 14:17:43 +0900 (007c4ee)
@@ -38,6 +38,7 @@ module Groonga
           @new_groonga = "groonga"
           @new_database = "db.new/db"
 
+          @recreate_database = false
           @load_data = true
           @run_queries = true
         end
@@ -95,6 +96,10 @@ module Groonga
 
           parser.separator("")
           parser.separator("Operations:")
+          parser.on("--recreate-database",
+                    "Always recreate Groonga database") do
+            @recreate_database = true
+          end
           parser.on("--no-load-data",
                     "Don't load data. Just loads schema to Groonga database") do
             @load_data = false
@@ -116,8 +121,9 @@ module Groonga
 
         def server_options
           options = {
-            :load_data   => @load_data,
-            :run_queries => @run_queries,
+            :load_data         => @load_data,
+            :run_queries       => @run_queries,
+            :recreate_database => @recreate_database,
           }
           directory_options.merge(options)
         end
@@ -203,6 +209,10 @@ module Groonga
           end
 
           def ensure_database
+            if @options[:recreate_database]
+              FileUtils.rm_rf(@database_path.dirname.to_s)
+            end
+
             return if @database_path.exist?
             FileUtils.mkdir_p(@database_path.dirname.to_s)
             system(@groonga, "-n", @database_path.to_s, "quit")
-------------- next part --------------
HTML����������������������������...
ダウンロード 



More information about the Groonga-commit mailing list
アーカイブの一覧に戻る