Class: Serverkit::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/serverkit/command.rb

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Command

Returns a new instance of Command.

Parameters:

  • argv (Array<String>)


10
11
12
# File 'lib/serverkit/command.rb', line 10

def initialize(argv)
  @argv = argv
end

Instance Method Details

#call ⇒ Object



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

def call
  case action_name
  when nil
    abort_for_missing_action_name
  when "apply"
    apply
  when "check"
    check
  when "inspect"
    _inspect
  when "validate"
    validate
  else
    abort_for_unknown_action_name
  end
rescue Slop::MissingOptionError => exception
  abort "Error: #{exception}"
end