mutant 0.10.10 → 0.10.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/mutant.rb +3 -1
- data/lib/mutant/cli/command.rb +1 -1
- data/lib/mutant/cli/command/{run.rb → environment.rb} +5 -43
- data/lib/mutant/cli/command/environment/run.rb +56 -0
- data/lib/mutant/cli/command/environment/show.rb +29 -0
- data/lib/mutant/cli/command/root.rb +7 -3
- data/lib/mutant/integration.rb +9 -0
- data/lib/mutant/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f812d15b5c09f8681cc6c75eb01bd00fffe412bc53397b9e13c29c7cad69db9a
|
4
|
+
data.tar.gz: 45c24afcbfbef29a50b90b81946e75391c58ecea7ac32b9545a5e7fdc22fd063
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fcb16a15ec71fe5dc51d07e08b426e8dc68e2f4bad2bd47f95a19b136cd06dbefdc9be44f4a7e0723b8a9450b4b924ab2744f8be05b09fbf1d6e9774431f2e97
|
7
|
+
data.tar.gz: b9213ce07ce70908f072b23d92bd86c86492ed8f348ae2c7419ed625989a36b7b2d1e110048e14364e044790e7e086894c124f081043d989844de02adcc81684
|
data/lib/mutant.rb
CHANGED
@@ -167,8 +167,10 @@ require 'mutant/world'
|
|
167
167
|
require 'mutant/config'
|
168
168
|
require 'mutant/cli'
|
169
169
|
require 'mutant/cli/command'
|
170
|
-
require 'mutant/cli/command/run'
|
171
170
|
require 'mutant/cli/command/subscription'
|
171
|
+
require 'mutant/cli/command/environment'
|
172
|
+
require 'mutant/cli/command/environment/run'
|
173
|
+
require 'mutant/cli/command/environment/show'
|
172
174
|
require 'mutant/cli/command/root'
|
173
175
|
require 'mutant/runner'
|
174
176
|
require 'mutant/runner/sink'
|
data/lib/mutant/cli/command.rb
CHANGED
@@ -3,10 +3,9 @@
|
|
3
3
|
module Mutant
|
4
4
|
module CLI
|
5
5
|
class Command
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
SHORT_DESCRIPTION = 'Run code analysis'
|
6
|
+
class Environment < self
|
7
|
+
NAME = 'environment'
|
8
|
+
SHORT_DESCRIPTION = 'Environment subcommands'
|
10
9
|
|
11
10
|
OPTIONS =
|
12
11
|
%i[
|
@@ -16,21 +15,6 @@ module Mutant
|
|
16
15
|
add_matcher_options
|
17
16
|
].freeze
|
18
17
|
|
19
|
-
SLEEP = 40
|
20
|
-
|
21
|
-
UNLICENSED = <<~MESSAGE.lines.freeze
|
22
|
-
Soft fail, continuing in #{SLEEP} seconds
|
23
|
-
Next major version will enforce the license
|
24
|
-
See https://github.com/mbj/mutant#licensing
|
25
|
-
MESSAGE
|
26
|
-
|
27
|
-
# Test if command needs to be executed in zombie environment
|
28
|
-
#
|
29
|
-
# @return [Bool]
|
30
|
-
def zombie?
|
31
|
-
@config.zombie
|
32
|
-
end
|
33
|
-
|
34
18
|
private
|
35
19
|
|
36
20
|
def initialize(attributes)
|
@@ -38,37 +22,16 @@ module Mutant
|
|
38
22
|
@config = Config.env
|
39
23
|
end
|
40
24
|
|
41
|
-
def
|
42
|
-
|
43
|
-
.bind { Config.load_config_file(world) }
|
25
|
+
def bootstrap
|
26
|
+
Config.load_config_file(world)
|
44
27
|
.fmap(&method(:expand))
|
45
28
|
.bind { Bootstrap.apply(world, @config) }
|
46
|
-
.bind(&Runner.public_method(:apply))
|
47
|
-
.from_right { |error| world.stderr.puts(error); return false }
|
48
|
-
.success?
|
49
29
|
end
|
50
30
|
|
51
31
|
def expand(file_config)
|
52
32
|
@config = file_config.merge(@config)
|
53
33
|
end
|
54
34
|
|
55
|
-
def soft_fail(result)
|
56
|
-
result.either(
|
57
|
-
lambda do |message|
|
58
|
-
stderr = world.stderr
|
59
|
-
stderr.puts(message)
|
60
|
-
UNLICENSED.each { |line| stderr.puts(unlicensed(line)) }
|
61
|
-
world.kernel.sleep(SLEEP)
|
62
|
-
Either::Right.new(nil)
|
63
|
-
end,
|
64
|
-
->(_subscription) { Either::Right.new(nil) }
|
65
|
-
)
|
66
|
-
end
|
67
|
-
|
68
|
-
def unlicensed(message)
|
69
|
-
"[Mutant-License-Error]: #{message}"
|
70
|
-
end
|
71
|
-
|
72
35
|
def parse_remaining_arguments(arguments)
|
73
36
|
traverse(@config.expression_parser.public_method(:apply), arguments)
|
74
37
|
.fmap do |match_expressions|
|
@@ -158,7 +121,6 @@ module Mutant
|
|
158
121
|
end
|
159
122
|
end
|
160
123
|
end # Run
|
161
|
-
# rubocop:enable Metrics/ClassLength
|
162
124
|
end # Command
|
163
125
|
end # CLI
|
164
126
|
end # Mutant
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mutant
|
4
|
+
module CLI
|
5
|
+
class Command
|
6
|
+
class Environment
|
7
|
+
class Run < self
|
8
|
+
NAME = 'run'
|
9
|
+
SHORT_DESCRIPTION = 'Run code analysis'
|
10
|
+
SLEEP = 40
|
11
|
+
SUBCOMMANDS = EMPTY_ARRAY
|
12
|
+
|
13
|
+
UNLICENSED = <<~MESSAGE.lines.freeze
|
14
|
+
Soft fail, continuing in #{SLEEP} seconds
|
15
|
+
Next major version will enforce the license
|
16
|
+
See https://github.com/mbj/mutant#licensing
|
17
|
+
MESSAGE
|
18
|
+
|
19
|
+
# Test if command needs to be executed in zombie environment
|
20
|
+
#
|
21
|
+
# @return [Bool]
|
22
|
+
def zombie?
|
23
|
+
@config.zombie
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def execute
|
29
|
+
soft_fail(License.apply(world))
|
30
|
+
.bind { bootstrap }
|
31
|
+
.bind(&Runner.public_method(:apply))
|
32
|
+
.from_right { |error| world.stderr.puts(error); return false }
|
33
|
+
.success?
|
34
|
+
end
|
35
|
+
|
36
|
+
def soft_fail(result)
|
37
|
+
result.either(
|
38
|
+
lambda do |message|
|
39
|
+
stderr = world.stderr
|
40
|
+
stderr.puts(message)
|
41
|
+
UNLICENSED.each { |line| stderr.puts(unlicensed(line)) }
|
42
|
+
world.kernel.sleep(SLEEP)
|
43
|
+
Either::Right.new(nil)
|
44
|
+
end,
|
45
|
+
->(_subscription) { Either::Right.new(nil) }
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
49
|
+
def unlicensed(message)
|
50
|
+
"[Mutant-License-Error]: #{message}"
|
51
|
+
end
|
52
|
+
end # Run
|
53
|
+
end # Environment
|
54
|
+
end # Command
|
55
|
+
end # CLI
|
56
|
+
end # Mutant
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mutant
|
4
|
+
module CLI
|
5
|
+
class Command
|
6
|
+
class Environment
|
7
|
+
class Show < self
|
8
|
+
NAME = 'show'
|
9
|
+
SHORT_DESCRIPTION = 'Display environment without coverage analysis'
|
10
|
+
SUBCOMMANDS = EMPTY_ARRAY
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def execute
|
15
|
+
Config.load_config_file(world)
|
16
|
+
.fmap(&method(:expand))
|
17
|
+
.bind { Bootstrap.apply(world, @config) }
|
18
|
+
.fmap(&method(:report_env))
|
19
|
+
.right?
|
20
|
+
end
|
21
|
+
|
22
|
+
def report_env(env)
|
23
|
+
env.config.reporter.start(env)
|
24
|
+
end
|
25
|
+
end # Show
|
26
|
+
end # Environment
|
27
|
+
end # Command
|
28
|
+
end # CLI
|
29
|
+
end # Mutant
|
@@ -3,11 +3,15 @@
|
|
3
3
|
module Mutant
|
4
4
|
module CLI
|
5
5
|
class Command
|
6
|
+
class Environment < self
|
7
|
+
SUBCOMMANDS = [Environment::Show].freeze
|
8
|
+
end # Environment
|
9
|
+
|
6
10
|
class Root < self
|
7
|
-
SUBCOMMANDS = [Run, Subscription].freeze
|
8
|
-
SHORT_DESCRIPTION = 'mutation testing engine main command'
|
9
11
|
NAME = 'mutant'
|
10
|
-
|
12
|
+
SHORT_DESCRIPTION = 'mutation testing engine main command'
|
13
|
+
SUBCOMMANDS = [Environment::Run, Environment, Subscription].freeze
|
14
|
+
end # Root
|
11
15
|
end # Command
|
12
16
|
end # CLI
|
13
17
|
end # Mutant
|
data/lib/mutant/integration.rb
CHANGED
@@ -19,6 +19,11 @@ module Mutant
|
|
19
19
|
The integration is supposed to define %<constant_name>s!
|
20
20
|
MESSAGE
|
21
21
|
|
22
|
+
INTEGRATION_MISSING = <<~'MESSAGE'
|
23
|
+
No test framework integration configured.
|
24
|
+
See https://github.com/mbj/mutant/blob/master/docs/configuration.md#integration
|
25
|
+
MESSAGE
|
26
|
+
|
22
27
|
private_constant(*constants(false))
|
23
28
|
|
24
29
|
# Setup integration
|
@@ -27,6 +32,10 @@ module Mutant
|
|
27
32
|
#
|
28
33
|
# @return [Either<String, Integration>]
|
29
34
|
def self.setup(env)
|
35
|
+
unless env.config.integration
|
36
|
+
return Either::Left.new(INTEGRATION_MISSING)
|
37
|
+
end
|
38
|
+
|
30
39
|
attempt_require(env).bind { attempt_const_get(env) }.fmap do |klass|
|
31
40
|
klass.new(
|
32
41
|
expression_parser: env.config.expression_parser,
|
data/lib/mutant/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mutant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Markus Schirp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: abstract_type
|
@@ -304,8 +304,10 @@ files:
|
|
304
304
|
- lib/mutant/bootstrap.rb
|
305
305
|
- lib/mutant/cli.rb
|
306
306
|
- lib/mutant/cli/command.rb
|
307
|
+
- lib/mutant/cli/command/environment.rb
|
308
|
+
- lib/mutant/cli/command/environment/run.rb
|
309
|
+
- lib/mutant/cli/command/environment/show.rb
|
307
310
|
- lib/mutant/cli/command/root.rb
|
308
|
-
- lib/mutant/cli/command/run.rb
|
309
311
|
- lib/mutant/cli/command/subscription.rb
|
310
312
|
- lib/mutant/config.rb
|
311
313
|
- lib/mutant/context.rb
|