class Redoxed::Core

Public Class Methods

new(_args) click to toggle source
# File lib/redoxed/core.rb, line 11
def initialize(_args)
  Redoxed.mgr = Manager.new
  Redoxed.hooks = HookManager.from_config(Redoxed.config)
  nodes = Nodes.new
  raise NoNodesFound, 'source returns no usable nodes' if nodes.size.zero?

  @worker = Worker.new nodes
  trap('HUP') { nodes.load }
  if Redoxed.config.rest?
    begin
      require 'redoxed/web'
    rescue LoadError
      raise RedoxedError, 'redoxed-web not found: sudo gem install redoxed-web - \
      or disable web support by setting "rest: false" in your configuration'
    end
    @rest = API::Web.new nodes, Redoxed.config.rest
    @rest.run
  end
  run
end

Private Instance Methods

run() click to toggle source
# File lib/redoxed/core.rb, line 34
def run
  Redoxed.logger.debug "lib/redoxed/core.rb: Starting the worker..."
  @worker.work while sleep Config::Sleep
end