Module: Mutant::Bootstrap Private

Includes:
Unparser::Adamantium
Defined in:
lib/mutant/bootstrap.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Bootstrap process

The role of the boostrap is to take the pure config and apply it against the impure world to produce an environment.

env = config interpreted against the world

rubocop:disable Metrics/ModuleLength

Constant Summary collapse

SEMANTICS_MESSAGE_FORMAT =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

"%<message>s. Fix your lib to follow normal ruby semantics!\n" \
'{Module,Class}#name should return resolvable constant name as String or nil'
CLASS_NAME_RAISED_EXCEPTION =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

'%<scope_class>s#name from: %<scope>s raised an error: %<exception>s'
CLASS_NAME_TYPE_MISMATCH_FORMAT =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

'%<scope_class>s#name from: %<raw_scope>s returned %<name>s'

Class Method Summary collapse

Class Method Details

.call(env) ⇒ Either<String, Env>

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 Bootstrap

rubocop:disable Metrics/MethodLength

Parameters:

Returns:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/mutant/bootstrap.rb', line 34

def self.call(env)
  env.record(:bootstrap) do
    env = load_hooks(env)
      .tap(&method(:infect))
      .with(matchable_scopes: matchable_scopes(env))

    matched_subjects = env.record(:subject_match) do
      Matcher.expand(env:).call(env)
    end

    selected_subjects = subject_select(env, matched_subjects)

    mutations = env.record(:mutation_generate) do
      selected_subjects.flat_map(&:mutations)
    end

    setup_integration(
      env:,
      mutations:,
      selected_subjects:
    )
  end
end

.call_test(env) ⇒ Either<String, Env>

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 test only bootstrap

Parameters:

Returns:



64
65
66
67
68
69
70
71
72
# File 'lib/mutant/bootstrap.rb', line 64

def self.call_test(env)
  env.record(:bootstrap) do
    setup_integration(
      env:               load_hooks(env),
      mutations:         [],
      selected_subjects: []
    )
  end
end