Class: Serverkit::Command
- Inherits:
-
Object
- Object
- Serverkit::Command
- Defined in:
- lib/serverkit/command.rb
Overview
Command clsas takes care of command line interface. It builds and runs an Action object from given command line arguements.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(argv) ⇒ Command
constructor
A new instance of Command.
Constructor Details
#initialize(argv) ⇒ Command
Returns a new instance of Command.
14 15 16 |
# File 'lib/serverkit/command.rb', line 14 def initialize(argv) @argv = argv end |
Instance Method Details
#call ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/serverkit/command.rb', line 18 def call case action_name when nil raise Errors::MissingActionNameArgumentError when "apply" apply when "check" check when "inspect" _inspect when "validate" validate else raise Errors::UnknownActionNameError, action_name end rescue Errors::Base, Slop::MissingArgumentError, Slop::MissingOptionError => exception abort "Error: #{exception}" end |