Class: Troo::Launcher
- Inherits:
-
Object
- Object
- Troo::Launcher
- Defined in:
- lib/troo/launcher.rb
Instance Method Summary collapse
- #execute! ⇒ String, NilClass
-
#initialize(argv, stdin = STDIN, stdout = STDOUT, stderr = STDERR, kernel = Kernel) ⇒ Object
constructor
[].
Constructor Details
#initialize(argv, stdin = STDIN, stdout = STDOUT, stderr = STDERR, kernel = Kernel) ⇒ Object
Returns [].
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/troo/launcher.rb', line 9 def initialize(argv, stdin = STDIN, stdout = STDOUT, stderr = STDERR, kernel = Kernel) @argv = argv @stdin = stdin @stdout = stdout @stderr = stderr @kernel = kernel @exit_code = 1 end |
Instance Method Details
#execute! ⇒ String, NilClass
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/troo/launcher.rb', line 22 def execute! $stdin, $stdout, $stderr = @stdin, @stdout, @stderr pad { Troo::CLI::Main.start(@argv) } @exit_code = 0 rescue ConfigurationNotFound pad do puts "Configuration cannot be found, please run " \ "`troo wizard` to get started." end rescue ConfigurationAborted pad { puts 'Configuration wizard aborted.' } rescue Redis::CannotConnectError pad { puts 'Cannot connect to Redis database.' } rescue ExpiredAccessToken pad do puts "Your Trello access token has expired, please run " \ "`troo wizard` for help, or manually renew." end ensure $stdin, $stdout, $stderr = STDIN, STDOUT, STDERR @kernel.exit(@exit_code) end |