Class: Gitl::Command
- Inherits:
-
CLAide::Command
- Object
- CLAide::Command
- Gitl::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
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/Command.rb', line 27 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
48 49 50 51 52 53 54 55 56 57 58 |
# 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) ⇒ Object
22 23 24 25 |
# 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 |
Instance Method Details
#error(message) ⇒ Object
64 65 66 |
# File 'lib/Command.rb', line 64 def error() puts(.red) end |
#info(message) ⇒ Object
60 61 62 |
# File 'lib/Command.rb', line 60 def info() puts(.green) end |