Class: Mutant::Config Private
- Inherits:
-
Object
- Object
- Mutant::Config
- Includes:
- Adamantium::Flat
- Defined in:
- lib/mutant.rb,
lib/mutant/config.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Standalone configuration of a mutant execution.
Does not reference any “external” volatile state. The configuration applied to current environment is being represented by the Mutant::Env object.
Defined Under Namespace
Classes: CoverageCriteria
Constant Summary collapse
- DEFAULT =
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.
new( coverage_criteria: Config::CoverageCriteria::DEFAULT, expression_parser: Expression::Parser.new([ Expression::Method, Expression::Methods, Expression::Namespace::Exact, Expression::Namespace::Recursive ]), fail_fast: false, includes: EMPTY_ARRAY, integration: nil, isolation: Mutant::Isolation::Fork.new(WORLD), jobs: nil, matcher: Matcher::Config::DEFAULT, mutation_timeout: nil, reporter: Reporter::CLI.build(WORLD.stdout), requires: EMPTY_ARRAY, zombie: false )
- MORE_THAN_ONE_CONFIG_FILE =
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' Found more than one candidate for use as implicit config file: %s MESSAGE
- CANDIDATES =
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.
%w[ .mutant.yml config/mutant.yml mutant.yml ].freeze
Class Method Summary collapse
-
.env ⇒ Config
private
The configuration from the environment.
-
.load_config_file(world) ⇒ Either<String,Config>
private
Load config file.
Instance Method Summary collapse
-
#merge(other) ⇒ Config
private
Merge with other config.
Class Method Details
.env ⇒ Config
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.
The configuration from the environment
114 115 116 |
# File 'lib/mutant/config.rb', line 114 def self.env DEFAULT.with(jobs: Etc.nprocessors) end |
.load_config_file(world) ⇒ Either<String,Config>
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.
Load config file
90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/mutant/config.rb', line 90 def self.load_config_file(world) config = DEFAULT files = CANDIDATES.map(&world.pathname.public_method(:new)).select(&:readable?) if files.one? load_contents(files.first).fmap(&config.public_method(:with)) elsif files.empty? Either::Right.new(config) else Either::Left.new(MORE_THAN_ONE_CONFIG_FILE % files.join(', ')) end end |
Instance Method Details
#merge(other) ⇒ Config
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.
Merge with other config
71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/mutant/config.rb', line 71 def merge(other) other.with( fail_fast: fail_fast || other.fail_fast, includes: other.includes + includes, jobs: other.jobs || jobs, integration: other.integration || integration, mutation_timeout: other.mutation_timeout || mutation_timeout, matcher: matcher.merge(other.matcher), requires: other.requires + requires, zombie: zombie || other.zombie ) end |