Sha256: fed52dd9ab4f0965aa5784a8cc99f01e4fa1562981ddaceeaf1cd097354c315d

Contents?: true

Size: 960 Bytes

Versions: 11

Compression:

Stored size: 960 Bytes

Contents

module Oxidized
  class << self
    def new *args
      Core.new args
    end
  end

  class Core
    class NoNodesFound < OxidizedError; end

    def initialize args
      Oxidized.mgr = Manager.new
      Oxidized.Hooks = HookManager.from_config(Oxidized.config)
      nodes        = Nodes.new
      raise NoNodesFound, 'source returns no usable nodes' if nodes.size == 0
      @worker      = Worker.new nodes
      trap('HUP') { nodes.load }
      if Oxidized.config.rest?
        begin
          require 'oxidized/web'
        rescue LoadError
          raise OxidizedError, 'oxidized-web not found: sudo gem install oxidized-web - \
          or disable web support by setting "rest: false" in your configuration'
        end
        @rest        = API::Web.new nodes, Oxidized.config.rest
        @rest.run
      end
      run
    end

    private

    def run
      while true
        @worker.work
        sleep Config::Sleep
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
oxidized-0.14.3 lib/oxidized/core.rb
oxidized-0.14.2 lib/oxidized/core.rb
oxidized-0.14.1 lib/oxidized/core.rb
oxidized-0.14.0 lib/oxidized/core.rb
oxidized-0.13.1 lib/oxidized/core.rb
oxidized-0.13.0 lib/oxidized/core.rb
oxidized-0.12.2 lib/oxidized/core.rb
oxidized-0.12.1 lib/oxidized/core.rb
oxidized-0.12.0 lib/oxidized/core.rb
oxidized-0.11.0 lib/oxidized/core.rb
oxidized-0.10.0 lib/oxidized/core.rb