class Gesund::CLI

Public Instance Methods

check() click to toggle source
# File lib/gesund/cli.rb, line 10
def check
  gesundfile = File.expand_path(options[:gesundfile]) if options[:gesundfile]
  checks = Gesund::Dsl.evaluate(gesundfile)
  Gesund::Output::Text.new(checks)
end
http() click to toggle source
# File lib/gesund/cli.rb, line 25
def http
  opts = { # defaults
    'port'      => 9998,
    'host'      => '0.0.0.0',
    'daemonize' => false,
    'debug'     => false,
    'warn'      => true
  }.merge(options.to_hash)
  gesundfile = File.expand_path(opts.delete('gesundfile'))
  raise Errno::EACCES, "Can't read file #{gesundfile}" unless File.readable?(gesundfile)
  checks = Gesund::Dsl.evaluate(gesundfile)
  Gesund::Output::Rack.start(checks, opts)
end