Navigation Menu

Skip to content

Commit

Permalink
Define path to serf related files in Path module, for other modules
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Apr 21, 2015
1 parent adf12e1 commit e90a13e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
8 changes: 8 additions & 0 deletions lib/droonga/path.rb
Expand Up @@ -74,6 +74,14 @@ def intentional_buffer
state + "buffer" + "intentional"
end

def serf_command
base + "serf"
end

def serf_tags_file
state + "serf-tags.json"
end

def serf_event_handler_errors
state + "serf-event-handler-errors"
end
Expand Down
14 changes: 2 additions & 12 deletions lib/droonga/serf.rb
Expand Up @@ -30,16 +30,6 @@

module Droonga
class Serf
class << self
def path
Droonga::Path.base + "serf"
end

def tags_file
Droonga::Path.state + "serf-tags.json"
end
end

include Loggable

def initialize(name, options={})
Expand All @@ -57,7 +47,7 @@ def run_agent(loop)
detect_other_hosts.each do |other_host|
retry_joins.push("-retry-join", other_host)
end
tags_file = self.class.tags_file
tags_file = Droonga::Path.serf_tags_file
FileUtils.mkdir_p(tags_file.dirname)
agent = Agent.new(loop, @serf_command,
@name.host, agent_port, rpc_port,
Expand Down Expand Up @@ -235,7 +225,7 @@ def ensure_serf
@serf_command ||= find_system_serf
return if @serf_command

serf_path = self.class.path
serf_path = Droonga::Path.serf_command
@serf_command = serf_path.to_s
return if serf_path.executable?
downloader = Downloader.new(serf_path)
Expand Down

0 comments on commit e90a13e

Please sign in to comment.