class Gb::Command
Public Class Methods
handle_exception(command, exception)
click to toggle source
Calls superclass method
# File lib/Command.rb, line 32 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 53 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 27 def self.run(argv) help! 'You cannot run gb 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 69 def error(message) puts(message.red) end
info(message)
click to toggle source
# File lib/Command.rb, line 65 def info(message) puts(message.green) end