Class: Assert::CLI
- Inherits:
-
Object
- Object
- Assert::CLI
- Defined in:
- lib/assert/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
- #help ⇒ Object
-
#initialize ⇒ CLI
constructor
A new instance of CLI.
- #run(*args) ⇒ Object
Constructor Details
Class Method Details
.run(*args) ⇒ Object
8 9 10 |
# File 'lib/assert/cli.rb', line 8 def self.run(*args) self.new.run(*args) end |
Instance Method Details
#help ⇒ Object
40 41 42 43 44 |
# File 'lib/assert/cli.rb', line 40 def help "Usage: assert [TESTS] [options]\n\n"\ "Options:"\ "#{@cli}" end |
#run(*args) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/assert/cli.rb', line 16 def run(*args) begin @cli.parse!(*args) tests = @cli.args tests = ['test'] if tests.empty? Assert::CLIRunner.new(*tests).run rescue CLIRB::HelpExit puts help rescue CLIRB::VersionExit puts Assert::VERSION rescue CLIRB::Error => exception puts "#{exception.}\n" puts help exit(1) rescue Exception => exception puts "#{exception.class}: #{exception.}" puts exception.backtrace.join("\n") if ENV['DEBUG'] exit(1) end # Don't call `exit(0)`. The test suite runs as the by an `at_exit` # callback. Calling `exit(0)` bypasses that callback. end |