Class: Edaemon::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/edaemon/server.rb

Constant Summary collapse

PID_FILE_PATH =
'./edaemon.pid'
LOG_FILE_PATH =
'./edaemon.log'
Error =
Class.new(StandardError)
ApplicationAllreadyRunnedError =
Class.new(Error)

Instance Method Summary collapse

Constructor Details

#initialize(block:) ⇒ Server

Returns a new instance of Server.



10
11
12
# File 'lib/edaemon/server.rb', line 10

def initialize(block:)
  @block = block
end

Instance Method Details

#startObject

TODO: Конфиг лога TODO: Конфиг пид файла



16
17
18
19
20
21
22
23
# File 'lib/edaemon/server.rb', line 16

def start
  # TODO: simplecov raise почему не подсвечивается
  raise ApplicationAllreadyRunnedError if pid_runned?(pid: saved_pid)

  pid = fork_block!
  save_pid!(pid: pid)
  pid
end