Sha256: 0fdab1b0cd10cc3919ecf4f1d7ba0a70e795b52755a9c1c6496821f6ef3f1f31

Contents?: true

Size: 941 Bytes

Versions: 4

Compression:

Stored size: 941 Bytes

Contents

require "logger"
require "recognizer/cli"
require "recognizer/config"
require "recognizer/librato"
require "recognizer/input"
require "recognizer/inputs/tcp"
require "recognizer/inputs/amqp"

module Recognizer
  def self.run
    cli         = Recognizer::CLI.new
    config      = Recognizer::Config.new(cli.read)
    input_queue = Queue.new

    options = cli.read.merge(config.read)

    logger = Logger.new(STDOUT)

    logger.level = options[:verbose] ? Logger::DEBUG : Logger::INFO

    librato = Recognizer::Librato.new(
      :logger      => logger,
      :options     => options,
      :input_queue => input_queue
    )
    librato.run

    Recognizer::Input::Base.descendants.each do |klass|
      input = klass.new(
        :logger      => logger,
        :options     => options,
        :input_queue => input_queue
      )
      if input.enabled?
        input.run
      end
    end

    loop do
      sleep 30
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
recognizer-0.7.0-java lib/recognizer.rb
recognizer-0.6.0-java lib/recognizer.rb
recognizer-0.5.0-java lib/recognizer.rb
recognizer-0.4.0-java lib/recognizer.rb