Class: Mutant::CLI

Inherits:
Object
  • Object
show all
Includes:
Adamantium::Flat, NodeHelpers
Defined in:
lib/mutant/cli.rb,
lib/mutant/cli/classifier.rb,
lib/mutant/cli/classifier/method.rb,
lib/mutant/cli/classifier/namespace.rb

Overview

Comandline parser

Defined Under Namespace

Classes: Builder, Classifier

Constant Summary collapse

Error =

Error raised when CLI argv is invalid

Class.new(RuntimeError)
EXIT_FAILURE =
1
EXIT_SUCCESS =
0

Constants included from NodeHelpers

NodeHelpers::INFINITY, NodeHelpers::NAN, NodeHelpers::NEGATIVE_INFINITY, NodeHelpers::NEW_OBJECT, NodeHelpers::N_EMPTY, NodeHelpers::N_FALSE, NodeHelpers::N_NIL, NodeHelpers::N_TRUE, NodeHelpers::RAISE

Class Method Summary collapse

Instance Method Summary collapse

Methods included from NodeHelpers

#n_not, s

Constructor Details

#initialize(arguments = []) ⇒ undefined

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.

Initialize objecct

Parameters:

  • (Array<String>)


169
170
171
172
173
174
175
176
177
# File 'lib/mutant/cli.rb', line 169

def initialize(arguments = [])
  @builder = Builder.new
  @debug = @fail_fast = @zombie = false
  @expect_coverage = 100.0
  @strategy = Strategy::Null.new
  @cache = Mutant::Cache.new
  parse(arguments)
  config # trigger lazyness now
end

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

Parameters:

  • arguments (Array<String>)

Returns:

  • (Fixnum)

    the exit status



26
27
28
29
30
31
32
33
# File 'lib/mutant/cli.rb', line 26

def self.run(arguments)
  config = new(arguments).config
  runner = Runner::Config.run(config)
  runner.success? ? EXIT_SUCCESS : EXIT_FAILURE
rescue Error => exception
  $stderr.puts(exception.message)
  EXIT_FAILURE
end

Instance Method Details

#configConfig

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 config

Returns:



185
186
187
188
189
190
191
192
193
194
195
196
# File 'lib/mutant/cli.rb', line 185

def config
  Config.new(
    cache:             @cache,
    zombie:            @zombie,
    debug:             @debug,
    matcher:           @builder.matcher,
    strategy:          @strategy,
    fail_fast:         @fail_fast,
    reporter:          Reporter::CLI.new($stdout),
    expected_coverage: @expect_coverage
  )
end