Class: Gb::Command
- Inherits:
-
CLAide::Command
- Object
- CLAide::Command
- Gb::Command
- Defined in:
- lib/Command.rb
Direct Known Subclasses
Class Method Summary collapse
- .handle_exception(command, exception) ⇒ Object
- .report_error(exception) ⇒ Object
- .run(argv) ⇒ Object
Instance Method Summary collapse
Class Method Details
.handle_exception(command, exception) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/Command.rb', line 32 def self.handle_exception(command, exception) if exception.is_a?(Error) || exception.is_a?(Git::GitExecuteError) puts exception..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..red) puts(*exception.backtrace) else puts exception..red end exit(1) else super end end |
.report_error(exception) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 |
# 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) ⇒ Object
27 28 29 30 |
# 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 |
Instance Method Details
#error(message) ⇒ Object
69 70 71 |
# File 'lib/Command.rb', line 69 def error() puts(.red) end |
#info(message) ⇒ Object
65 66 67 |
# File 'lib/Command.rb', line 65 def info() puts(.green) end |