Class: AppCommand::Tail

Inherits:
Convoy::ActionCommand::Base
  • Object
show all
Defined in:
lib/routes/tail.rb

Instance Method Summary collapse

Instance Method Details

#executeObject



5
6
7
8
9
10
11
12
# File 'lib/routes/tail.rb', line 5

def execute

    @opts = command_options
    @args = arguments
    opts_validate
    opts_routing

end

#opts_routingObject



18
19
20
21
22
# File 'lib/routes/tail.rb', line 18

def opts_routing

    tail_all_catalina_out

end

#opts_validateObject



14
15
16
# File 'lib/routes/tail.rb', line 14

def opts_validate

end

#tail_all_catalina_outObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/routes/tail.rb', line 24

def tail_all_catalina_out

    if App::Tools::this_is_a_mac

        begin
            system('clear')
            App::Terminal::info("Tailing #{App::Terminal::format_action('all')} Java logs", ['tail -f /var/log/tomcat/*/catalina.out | grep -v "scheduling\|/var/log\|rabbitmq\|Clearing app version/service version cache\|^$"', nil, "Press '#{App::Terminal::format_command('CTRL + C')}\x1B[38;5;240m' to quit."])
            system("sshpass -p#{App::Config.param(App::Config::VM_USER_PASSWORD)} ssh #{App::Config.param(App::Config::VM_USER)}@#{App::Config.param(App::Config::VM_IP)} 'tail -f /var/log/tomcat/*/catalina.out | grep -v \"scheduling\\|/var/log\\|rabbitmq\\|Clearing app version/service version cache\\|^$\"'")
        ensure
            exit
        end

    else

        App::Terminal::info('This functionality has not yet been implemented on your OS', ["Currently only works on #{App::Terminal::format_action(App::Config.param(App::Config::WORKSTATION_OS))}", nil, "You are on #{App::Terminal::format_action(App::Config.param(App::Config::WORKSTATION_OS))}"])

    end

end