Module: MultiDaemons

Defined in:
lib/multi_daemons.rb,
lib/multi_daemons/log.rb,
lib/multi_daemons/pid.rb,
lib/multi_daemons/daemon.rb,
lib/multi_daemons/version.rb,
lib/multi_daemons/validate.rb,
lib/multi_daemons/pid_store.rb,
lib/multi_daemons/controller.rb,
lib/multi_daemons/configuration.rb,
lib/multi_daemons/error_reporter.rb

Defined Under Namespace

Modules: Log, PidStore Classes: Configuration, Controller, Daemon, ErrorReporter, Pid, Validate

Constant Summary collapse

CONFIG =
Configuration.new
VERSION =
'1.0.1'.freeze

Class Method Summary collapse

Class Method Details

.daemonize(controller) ⇒ Object


32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/multi_daemons.rb', line 32

def self.daemonize(controller)
  case !ARGV.empty? && ARGV[0]
  when 'start'
    controller.start
  when 'stop'
    controller.stop
  when 'restart'
    controller.stop
    controller.start
  when 'status'
    controller.status
  else
    raise 'Invalid argument. Specify start, stop or restart'
  end
end

.error_reportersObject


24
25
26
# File 'lib/multi_daemons.rb', line 24

def self.error_reporters
  CONFIG.error_reporters
end

.error_reporters=(reporters) ⇒ Object


28
29
30
# File 'lib/multi_daemons.rb', line 28

def self.error_reporters=(reporters)
  CONFIG.error_reporters = reporters
end

.runner(daemons, options = {}) ⇒ Object


17
18
19
20
21
22
# File 'lib/multi_daemons.rb', line 17

def self.runner(daemons, options = {})
  raise unless Validate.valid_multi_daemon?(daemons)

  controller = Controller.new(daemons, options)
  daemonize(controller)
end