Class: Gesund::CLI

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/gesund/cli.rb

Instance Method Summary collapse

Instance Method Details

#checkObject



10
11
12
13
14
# 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

#httpObject

Raises:

  • (Errno::EACCES)


25
26
27
28
29
30
31
32
33
34
35
36
37
# 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