[Groonga-commit] droonga/droonga-engine at 767e068 [master] Use specific directory for observing

Back to archive index

YUKI Hiroshi null+****@clear*****
Fri May 9 16:31:31 JST 2014


YUKI Hiroshi	2014-05-09 16:31:31 +0900 (Fri, 09 May 2014)

  New Revision: 767e0689a57ecd3cb8aa93abdd7261493ea51378
  https://github.com/droonga/droonga-engine/commit/767e0689a57ecd3cb8aa93abdd7261493ea51378

  Message:
    Use specific directory for observing

  Modified files:
    lib/droonga/live_nodes_list_observer.rb
    lib/droonga/serf_event_handler.rb

  Modified: lib/droonga/live_nodes_list_observer.rb (+5 -1)
===================================================================
--- lib/droonga/live_nodes_list_observer.rb    2014-05-09 15:04:46 +0900 (c803398)
+++ lib/droonga/live_nodes_list_observer.rb    2014-05-09 16:31:31 +0900 (0338298)
@@ -13,6 +13,7 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
+require "fileutils"
 require "listen"
 require "droonga/loggable"
 require "droonga/live_nodes_list_loader"
@@ -24,6 +25,7 @@ module Droonga
     attr_accessor :on_update
 
     def initialize
+      FileUtils.mkdir_p(directory_path)
       @listener = Listen.to(directory_path) do |modified, added, removed|
         if added.include?(file_path) or
              modified.include?(file_path)
@@ -40,7 +42,9 @@ module Droonga
       @listener.stop
     end
 
-    DEFAULT_LIST_PATH = "live-nodes.json"
+    LIST_FILE_NAME = "list.json"
+    OBSERVE_DIR_NAME = "live-nodes"
+    DEFAULT_LIST_PATH = "#{OBSERVE_DIR_NAME}/#{LIST_FILE_NAME}"
 
     def base_path
       ENV["DROONGA_BASE_DIR"]

  Modified: lib/droonga/serf_event_handler.rb (+2 -0)
===================================================================
--- lib/droonga/serf_event_handler.rb    2014-05-09 15:04:46 +0900 (e8edba0)
+++ lib/droonga/serf_event_handler.rb    2014-05-09 16:31:31 +0900 (ef58593)
@@ -16,6 +16,7 @@
 require "optparse"
 require "pathname"
 require "json"
+require "fileutils"
 require "droonga/live_nodes_list_observer"
 
 module Droonga
@@ -90,6 +91,7 @@ module Droonga
       nodes = live_nodes
       file_contents = JSON.pretty_generate(nodes)
       if output_to_file?
+        FileUtils.mkdir_p(list_file.parent.to_s)
         list_file.write(file_contents)
       else
         puts file_contents
-------------- next part --------------
HTML����������������������������...
下載 



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