Module: Pushr::Daemon

Defined in:
lib/pushr/daemon.rb,
lib/pushr/daemon/app.rb,
lib/pushr/daemon/logger.rb,
lib/pushr/daemon/pid_file.rb,
lib/pushr/daemon/settings.rb,
lib/pushr/daemon/delivery_error.rb,
lib/pushr/daemon/message_handler.rb,
lib/pushr/daemon/feedback_handler.rb

Defined Under Namespace

Classes: App, DeliveryError, FeedbackHandler, Logger, MessageHandler, PidFile, Settings

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configObject

Returns the value of attribute config.



16
17
18
# File 'lib/pushr/daemon.rb', line 16

def config
  @config
end

.feedback_handlerObject

Returns the value of attribute feedback_handler.



16
17
18
# File 'lib/pushr/daemon.rb', line 16

def feedback_handler
  @feedback_handler
end

.loggerObject

Returns the value of attribute logger.



16
17
18
# File 'lib/pushr/daemon.rb', line 16

def logger
  @logger
end

Class Method Details

.start(config) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/pushr/daemon.rb', line 19

def self.start(config)
  self.config = config
  self.logger = Logger.new(foreground: config.foreground, error_notification: config.error_notification)
  setup_signal_hooks

  daemonize unless config.foreground

  start_app

  logger.info('[Daemon] Ready')

  sleep 1 until @shutting_down
end