Class: Henitai::CLI

Inherits:
Object
  • Object
show all
Includes:
CleanCommand, CommandSupport, InitCommand, OperatorCommand, Options, RunCommand
Defined in:
lib/henitai/cli.rb,
lib/henitai/cli/options.rb,
lib/henitai/cli/run_command.rb,
lib/henitai/cli/run_options.rb,
lib/henitai/cli/init_command.rb,
lib/henitai/cli/clean_command.rb,
lib/henitai/cli/command_support.rb,
lib/henitai/cli/operator_command.rb,
sig/henitai.rbs

Overview

Command-line interface entry point.

Usage:

henitai run [options] [SUBJECT_PATTERN...]

Options:

--since GIT_REF   Only mutate subjects changed since GIT_REF
--use INTEGRATION Override integration from config (e.g. rspec)
--config PATH     Path to .henitai.yml (default: .henitai.yml)
--operators SET   Operator set: light (default) | full
--jobs N          Number of parallel workers (default: 1)
--all-logs        Print all captured child logs
-h, --help        Show this help message
-v, --version     Show version

Argument parsing and command dispatch live here; the per-command behaviour lives in the mixed-in command modules under lib/henitai/cli/.

Defined Under Namespace

Modules: CleanCommand, CommandSupport, InitCommand, OperatorCommand, Options, RunCommand, RunOptions

Constant Summary collapse

REPORT_CLEANUP_PATHS =
[
  %w[coverage .resultset.json],
  %w[coverage .last_run.json],
  ["henitai_per_test.json"],
  [CoverageBootstrapper::DEPENDENCY_MANIFEST_FILE]
].freeze
REPORT_CLEANUP_DIRS =

Whole directories of per-mutant scratch artifacts, removed recursively. mutation-logs accumulates one stdout/stderr/combined log trio per mutant (and baseline) and mutation-coverage one dir per mutant, so both grow to GBs on a large run; deleting the tree is the only way to reclaim it (rm_f cannot remove a directory).

[
  %w[mutation-logs],
  %w[mutation-coverage]
].freeze

Constants included from OperatorCommand

OperatorCommand::OPERATOR_METADATA

Constants included from InitCommand

InitCommand::INIT_TEMPLATE_LINES

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ CLI

Returns a new instance of CLI.

Parameters:

  • (Array[String])


57
58
59
# File 'lib/henitai/cli.rb', line 57

def initialize(argv)
  @argv = argv.dup
end

Class Method Details

.start(argv) ⇒ Object

Parameters:

  • (Array[String])

Returns:

  • (Object)


53
54
55
# File 'lib/henitai/cli.rb', line 53

def self.start(argv)
  new(argv).run
end

Instance Method Details

#runObject

Returns:

  • (Object)


61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/henitai/cli.rb', line 61

def run
  command = @argv.shift
  case command
  when "run"     then run_command
  when "clean"   then clean_command
  when "version" then puts Henitai::VERSION
  when "init"    then init_command
  when "operator" then operator_command
  when nil, "-h", "--help" then puts help_text
  else
    warn "Unknown command: #{command}"
    warn help_text
    exit 1
  end
end