class Gitl::Command

Public Class Methods

handle_exception(command, exception) click to toggle source
Calls superclass method
# File lib/Command.rb, line 27
def self.handle_exception(command, exception)
  if exception.is_a?(Error) || exception.is_a?(Git::GitExecuteError)
    puts exception.message.red
    if command.nil? || command.verbose?
      puts
      puts(*exception.backtrace)
    end
    exit(1)
  elsif exception.is_a?(Gitlab::Error::ResponseError)
    if command.nil? || command.verbose?
      puts(exception.message.red)
      puts(*exception.backtrace)
    else
      puts exception.message.red
    end
    exit(1)
  else
    super
  end
end
report_error(exception) click to toggle source
# File lib/Command.rb, line 48
def self.report_error(exception)
  case exception
  when Interrupt
    puts '[!] Cancelled'.red
    exit(1)
  when SystemExit
    raise
  else
    raise exception
  end
end
run(argv) click to toggle source
Calls superclass method
# File lib/Command.rb, line 22
def self.run(argv)
  help! 'You cannot run gitl as root.' if Process.uid == 0 && !Gem.win_platform?
  super(argv)
end

Public Instance Methods

error(message) click to toggle source
# File lib/Command.rb, line 64
def error(message)
  puts(message.red)
end
info(message) click to toggle source
# File lib/Command.rb, line 60
def info(message)
  puts(message.green)
end