Class: MockWS::CLI::MainCommand

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

Overview

The CLI Command structure for Thor

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ MainCommand

Returns a new instance of MainCommand.



9
10
11
12
13
14
15
16
17
# File 'lib/mockws/cli.rb', line 9

def initialize(*args) 
    super
    @output = Carioca::Registry.get.get_service name: :output
    @finisher = Carioca::Registry.get.get_service name: :finisher
    if options[:debug] then 
        @output.level = :debug
        @output.debug  "DEBUG activated" 
    end
end

Class Method Details

.exit_on_failure?Boolean

callback for managing ARGV errors

Returns:

  • (Boolean)


20
21
22
# File 'lib/mockws/cli.rb', line 20

def self.exit_on_failure?
    true
end

Instance Method Details

#sanitycheckObject



38
39
40
41
42
43
# File 'lib/mockws/cli.rb', line 38

def sanitycheck 
    @finisher.secure_execute! exit_case: :sanitycheck_success do
        MockWS::Configuration::Checker.sanitycheck
    end
    
end

#startObject



30
31
32
33
34
# File 'lib/mockws/cli.rb', line 30

def start
    @finisher.secure_execute! exit_case: :success_exit do
        MockWS::Daemon::Controller::start options
    end
end

#statusObject



63
64
65
66
67
# File 'lib/mockws/cli.rb', line 63

def status
    @finisher.secure_execute! exit_case: :success_exit do
        MockWS::Daemon::Controller::status options
    end
end

#stopObject



52
53
54
55
56
# File 'lib/mockws/cli.rb', line 52

def stop
    @finisher.secure_execute! exit_case: :success_exit do
        MockWS::Daemon::Controller::stop options
    end
end