Module: Kamaze::Project::Concern::Cli::WithExitOnFailure
- Includes:
- Kamaze::Project::Concern::Cli
- Included in:
- Tools::Gemspec::Packer::Command, Tools::Git::Hooks::BaseHook, Tools::Rspec, Tools::Rubocop, Tools::Vagrant::Shell
- Defined in:
- lib/kamaze/project/concern/cli/with_exit_on_failure.rb
Overview
TODO:
Add (rspec) test and examples
Concern exit on failure
Use retcode
to exit in with_exit_on_failure
blocks.
Instance Method Summary collapse
-
#failure? ⇒ Boolean
(also: #failed?)
included
from Kamaze::Project::Concern::Cli
Denote execution is a failure.
-
#retcode ⇒ Fixnum
included
from Kamaze::Project::Concern::Cli
Status code usable to eventually initiates the termination.
-
#success? ⇒ Boolean
(also: #successful?)
included
from Kamaze::Project::Concern::Cli
Denote execution is a success.
-
#with_exit_on_failure {|Object| ... } ⇒ Object
protected
Initiates termination by raising
SystemExit
exception depending onsuccess
of given block.
Instance Method Details
#failure? ⇒ Boolean Also known as: failed? Originally defined in module Kamaze::Project::Concern::Cli
Denote execution is a failure.
#retcode ⇒ Fixnum Originally defined in module Kamaze::Project::Concern::Cli
Status code usable to eventually initiates the termination.
#success? ⇒ Boolean Also known as: successful? Originally defined in module Kamaze::Project::Concern::Cli
Denote execution is a success.
#with_exit_on_failure {|Object| ... } ⇒ Object (protected)
Initiates termination by raising SystemExit
exception
depending on success
of given block.
29 30 31 32 33 34 35 |
# File 'lib/kamaze/project/concern/cli/with_exit_on_failure.rb', line 29 def with_exit_on_failure result = yield(self) exit(retcode) if failure? result end |