Module: Kicker::Utils

Extended by:
Utils
Included in:
Utils
Defined in:
lib/kicker/utils.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#execute(command, &block) ⇒ Object



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

def execute(command, &block)
  @last_command = command
  status = LogStatusHelper.new(block, command)
  
  will_execute_command(status)
  status.result(`#{command}`, last_command_succeeded?, last_command_status)
  did_execute_command(status)
end

#last_commandObject



14
15
16
# File 'lib/kicker/utils.rb', line 14

def last_command
  @last_command
end

#last_command_statusObject



31
32
33
# File 'lib/kicker/utils.rb', line 31

def last_command_status
  $?.to_i
end

#last_command_succeeded?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/kicker/utils.rb', line 27

def last_command_succeeded?
  $?.success?
end

#log(message) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/kicker/utils.rb', line 18

def log(message)
  if Kicker.quiet
    puts message
  else
    now = Time.now
    puts "#{now.strftime('%H:%M:%S')}.#{now.usec.to_s[0,2]} | #{message}"
  end
end