Class: Ductwork::CLI

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

Constant Summary collapse

DEFAULT_COMMAND =
"start"

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ CLI

Returns a new instance of CLI.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/ductwork/cli.rb', line 13

def initialize(args)
  @raw_args = args.dup
  @configuration_options = {}
  @health_check_options = {}
  @top_level_parser = OptionParser.new do |op|
    op.banner = "ductwork [options]"

    op.on("-c", "--config PATH", "path to YAML config file") do |arg|
      configuration_options[:path] = arg
    end

    op.on("-h", "--help", "Prints this help") do
      puts op
      puts "\nCommands:\n  start\n  health"
      exit
    end
  end
end

Class Method Details

.start!(args) ⇒ Object



9
10
11
# File 'lib/ductwork/cli.rb', line 9

def self.start!(args)
  new(args).start!
end

Instance Method Details

#start!Object



32
33
34
35
36
# File 'lib/ductwork/cli.rb', line 32

def start!
  parse!
  auto_configure
  execute_command
end