Sha256: fadee5941ed8230064b6f4d693746060355ddfb290d8079d19d6e7919441c3bb

Contents?: true

Size: 1.23 KB

Versions: 2

Compression:

Stored size: 1.23 KB

Contents

require 'cri'

class Kriterion
  class CLI
    class Worker
      def self.command
        @cmd ||= Cri::Command.define do
          name        'worker'
          usage       'worker --uri <uri>'
          summary     'Runs a kriterion worker'

          flag   :h,  :help,  'show help for this command' do |value, cmd|
            puts cmd.help
            exit 0
          end

          optional :u, :uri           , 'URI of the RestMQ server'             , default: ENV['uri'] || 'http://localhost:8888'
          optional :q, :queue         , 'Queue to subscribe to'                , default: ENV['queue']|| 'reports'
          optional :h, :mongo_hostname, 'Hostname of the MongoDB server to use', default: ENV['mongo_hostname']|| 'localhost'
          optional :d, :mongo_database, 'Name of the MongoDB database to use'  , default: ENV['mongo_database']|| 'kriterion'
          optional :p, :mongo_port    , 'Port for MongoDB'                     , default: ENV['mongo_port']|| 27017


          run do |opts, args, cmd|
            require 'kriterion/worker'
            worker = Kriterion::Worker.new(opts)
            worker.run
          end
        end
      end
    end
  end
end

Kriterion::CLI.command.add_command(Kriterion::CLI::Worker.command)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kriterion-0.1.0 lib/kriterion/cli/worker.rb
kriterion-0.0.1 lib/kriterion/cli/worker.rb