Class: Kriterion::CLI::API

Inherits:
Object
  • Object
show all
Defined in:
lib/kriterion/cli/api.rb

Class Method Summary collapse

Class Method Details

.commandObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/kriterion/cli/api.rb', line 6

def self.command
  @cmd ||= Cri::Command.define do
    name        'api'
    usage       'api --standards_dir <uri>'
    summary     'Runs a kriterion API server'

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

    option   :u, :standards_dir,            'URI of the RestMQ server', argument: :required
    optional :h, :mongo_hostname, 'Hostname of the MongoDB server to use', default: 'localhost'
    optional :d, :mongo_database, 'Name of the MongoDB database to use', default: 'kriterion'
    optional :p, :mongo_port,     'Port for MongoDB', default: 27017


    run do |opts, args, cmd|
      # TODO: Get log levels working properly
      require 'kriterion/api'
      worker = Kriterion::API.new(opts)
      worker.run
    end
  end
end