Class: Mutant::CLI
- Inherits:
-
Object
- Object
- Mutant::CLI
- Includes:
- Adamantium::Flat
- Defined in:
- lib/mutant/cli.rb
Overview
Comandline parser
Constant Summary collapse
- Error =
Error raised when CLI argv is inalid
Class.new(RuntimeError)
- EXIT_FAILURE =
1
- EXIT_SUCCESS =
0
Class Method Summary collapse
-
.run(*arguments) ⇒ Fixnum
private
Run cli with arguments.
Instance Method Summary collapse
-
#debug? ⇒ true, false
private
Test for running in debug mode.
-
#filter ⇒ Mutant::Matcher
private
Return mutation filter.
-
#matcher ⇒ Mutant::Matcher
private
Return matcher.
-
#reporter ⇒ Mutant::Reporter::CLI
private
Return reporter.
-
#strategy ⇒ Strategy
private
Return stratety.
Class Method Details
.run(*arguments) ⇒ Fixnum
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Run cli with arguments
21 22 23 24 25 26 27 |
# File 'lib/mutant/cli.rb', line 21 def self.run(*arguments) error = Runner.run(new(*arguments)).fail? error ? EXIT_FAILURE : EXIT_SUCCESS rescue Error => exception $stderr.puts(exception.) EXIT_FAILURE end |
Instance Method Details
#debug? ⇒ true, false
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Test for running in debug mode
57 58 59 |
# File 'lib/mutant/cli.rb', line 57 def debug? !!@debug end |
#filter ⇒ Mutant::Matcher
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return mutation filter
67 68 69 70 71 72 73 |
# File 'lib/mutant/cli.rb', line 67 def filter if @filters.empty? Mutation::Filter::ALL else Mutation::Filter::Whitelist.new(@filters) end end |
#matcher ⇒ Mutant::Matcher
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return matcher
38 39 40 41 42 43 44 |
# File 'lib/mutant/cli.rb', line 38 def matcher if @matchers.empty? raise Error, 'No matchers given' end Mutant::Matcher::Chain.build(@matchers) end |
#reporter ⇒ Mutant::Reporter::CLI
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return reporter
94 95 96 |
# File 'lib/mutant/cli.rb', line 94 def reporter Mutant::Reporter::CLI.new(self) end |
#strategy ⇒ Strategy
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return stratety
82 83 84 85 |
# File 'lib/mutant/cli.rb', line 82 def strategy @strategy || raise(Error, 'no strategy was set!') @strategy.new(self) end |