Class: AppCommand::Fix

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

Instance Method Summary collapse

Instance Method Details

#clear_sessionsObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/routes/fix.rb', line 32

def clear_sessions
    App::Terminal::info('Attempting to clear all sessions from DB..')

    App::Terminal::output('DELETE FROM _session.session;')
    @mysql_ses.query('DELETE FROM session;')

    App::Terminal::output('DELETE FROM app.session_to_licence_type;')
    @mysql_app.query('DELETE FROM session_to_licence_type;')

    App::Terminal::output('DELETE FROM app.sessions;')
    @mysql_app.query('DELETE FROM sessions;')

    puts
end

#executeObject



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/routes/fix.rb', line 5

def execute

    @opts = command_options
    @args = arguments

    @mysql_app = App::MySQL::vm
    @mysql_ses = App::MySQL::vm('_session')

    opts_validate
    opts_routing

end

#opts_routingObject



22
23
24
25
26
27
28
29
30
# File 'lib/routes/fix.rb', line 22

def opts_routing

    if @opts[:clear_sessions]
        clear_sessions
    else
        system('bp f -h')
    end

end

#opts_validateObject



18
19
20
# File 'lib/routes/fix.rb', line 18

def opts_validate

end