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



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

def execute(command, &block)
  @last_command = command
  status = LogStatusHelper.new(block, command)
  will_execute_command(status)
  output = _execute(command)
  status.result(output, last_command_succeeded?, last_command_status)
  did_execute_command(status)
end

#last_commandObject



16
17
18
# File 'lib/kicker/utils.rb', line 16

def last_command
  @last_command
end

#last_command_statusObject



33
34
35
# File 'lib/kicker/utils.rb', line 33

def last_command_status
  $?.to_i
end

#last_command_succeeded?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/kicker/utils.rb', line 29

def last_command_succeeded?
  $?.success?
end

#log(message) ⇒ Object



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

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