mutant 0.11.14 → 0.11.15

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 58b6affbd17beee4a525b5efa35e83b18d3d65316ec5abd2b773c4722377e79b
4
- data.tar.gz: 10b60ffd99ea8b477537bed09af2c122ffc14152a69c9a020ed09cca73dfa2d8
3
+ metadata.gz: 4f0fc5ddcee197485af9a005a41938eb5c056fe7112747e1ed5cefd7860e0d27
4
+ data.tar.gz: eed2005705a2ff4a58c18390d7f59cf4eff85aa67b6c3846cb44b014e9f3fba9
5
5
  SHA512:
6
- metadata.gz: 39bd2f27290e3e3ba1ec6be8ae515759db5970fe121e9732797819bcb243c1038b0582c49e52fe7c6ab99d9332dfce4eb4fcf62b75558bd79954929bb432a8fd
7
- data.tar.gz: da7555f1f168b6359163aeb3cd58dd69b5cb553da005830169cabdc9de949317f7ddae0790e6e84cc7990dfcd3d7c0c2c9b85f05c0b7b8de18bf96079d2c58e7
6
+ metadata.gz: ff9b7d961960b339405eda6b0bf16bbcc7ad0527d52787f7fe402c0689afea3f0e344697af9a87e5331c766b8002ccc03c34b517f47b3edea385948336889634
7
+ data.tar.gz: bfe080deae82a8b5aae5a281515344ecfd526e8fafc1350727608b989404cf34c821fedd42e1e8c04b8bca744a28d0ad66f2d273871cc044197556eec8ebad48
data/bin/mutant CHANGED
@@ -8,43 +8,48 @@ end
8
8
 
9
9
  require 'mutant'
10
10
 
11
- command = Mutant::CLI.parse(
11
+ Mutant::CLI.parse(
12
12
  arguments: ARGV,
13
13
  world: Mutant::WORLD
14
- )
14
+ ).either(
15
+ ->(message) { Mutant::WORLD.stderr.puts(message); Kernel.exit(false) },
16
+ # rubocop:disable Metrics/BlockLength
17
+ lambda do |command|
18
+ status =
19
+ if command.zombie?
20
+ $stderr.puts('Running mutant zombified!')
21
+ Mutant::Zombifier.call(
22
+ namespace: :Zombie,
23
+ load_path: $LOAD_PATH,
24
+ kernel: Kernel,
25
+ pathname: Pathname,
26
+ require_highjack: Mutant::RequireHighjack
27
+ .public_method(:call)
28
+ .to_proc
29
+ .curry
30
+ .call(Kernel),
31
+ root_require: 'mutant',
32
+ includes: %w[
33
+ adamantium
34
+ anima
35
+ concord
36
+ equalizer
37
+ mprelude
38
+ mutant
39
+ unparser
40
+ variable
41
+ ]
42
+ )
15
43
 
16
- status =
17
- if command.zombie?
18
- $stderr.puts('Running mutant zombified!')
19
- Mutant::Zombifier.call(
20
- namespace: :Zombie,
21
- load_path: $LOAD_PATH,
22
- kernel: Kernel,
23
- pathname: Pathname,
24
- require_highjack: Mutant::RequireHighjack
25
- .public_method(:call)
26
- .to_proc
27
- .curry
28
- .call(Kernel),
29
- root_require: 'mutant',
30
- includes: %w[
31
- adamantium
32
- anima
33
- concord
34
- equalizer
35
- mprelude
36
- mutant
37
- unparser
38
- variable
39
- ]
40
- )
44
+ Zombie::Mutant::CLI.parse(
45
+ arguments: ARGV,
46
+ world: Zombie::Mutant::WORLD
47
+ ).from_right.call
48
+ else
49
+ command.call
50
+ end
41
51
 
42
- Zombie::Mutant::CLI.parse(
43
- arguments: ARGV,
44
- world: Zombie::Mutant::WORLD
45
- ).call
46
- else
47
- command.call
52
+ Kernel.exit(status)
48
53
  end
49
-
50
- Kernel.exit(status)
54
+ # rubocop:enable Metrics/BlockLength
55
+ )
@@ -30,13 +30,6 @@ module Mutant
30
30
  ===============
31
31
  MESSAGE
32
32
 
33
- # Test if command needs to be executed in zombie environment
34
- #
35
- # @return [Bool]
36
- def zombie?
37
- @config.zombie
38
- end
39
-
40
33
  private
41
34
 
42
35
  def action
@@ -19,7 +19,9 @@ module Mutant
19
19
 
20
20
  def initialize(attributes)
21
21
  super(attributes)
22
- @config = Config::DEFAULT
22
+ @config = Config::DEFAULT.with(
23
+ coverage_criteria: Config::CoverageCriteria::EMPTY
24
+ )
23
25
  end
24
26
 
25
27
  def bootstrap
@@ -37,7 +39,7 @@ module Mutant
37
39
  )
38
40
  end
39
41
 
40
- @config = Config.env.merge(file_config).merge(@config).expand_defaults
42
+ @config = Config.env.merge(file_config).merge(@config)
41
43
  end
42
44
 
43
45
  def parse_remaining_arguments(arguments)
@@ -67,9 +69,6 @@ module Mutant
67
69
  # rubocop:disable Metrics/MethodLength
68
70
  def add_environment_options(parser)
69
71
  parser.separator('Environment:')
70
- parser.on('--zombie', 'Run mutant zombified') do
71
- set(zombie: true)
72
- end
73
72
  parser.on('-I', '--include DIRECTORY', 'Add DIRECTORY to $LOAD_PATH') do |directory|
74
73
  add(:includes, directory)
75
74
  end
@@ -4,9 +4,7 @@ module Mutant
4
4
  module CLI
5
5
  # rubocop:disable Metrics/ClassLength
6
6
  class Command
7
- include AbstractType, Anima.new(:world, :main, :parent, :arguments)
8
-
9
- include Equalizer.new(:parent, :arguments)
7
+ include AbstractType, Anima.new(:world, :main, :parent, :zombie)
10
8
 
11
9
  OPTIONS = [].freeze
12
10
  SUBCOMMANDS = [].freeze
@@ -18,21 +16,20 @@ module Mutant
18
16
  define_method(:add_officious) {}
19
17
  end # OptionParser
20
18
 
21
- class FailParse < self
22
- include Concord.new(:world, :message)
23
-
24
- def call
25
- world.stderr.puts(message)
26
- false
27
- end
28
- end
29
-
30
19
  # Parse command
31
20
  #
32
21
  # @return [Command]
33
- def self.parse(**attributes)
34
- new(main: nil, parent: nil, **attributes).__send__(:parse)
22
+ #
23
+ # rubocop:disable Metrics/ParameterLists
24
+ def self.parse(arguments:, parent: nil, world:, zombie: false)
25
+ new(
26
+ main: nil,
27
+ parent: parent,
28
+ world: world,
29
+ zombie: zombie
30
+ ).__send__(:parse, arguments)
35
31
  end
32
+ # rubocop:enable Metrics/ParameterLists
36
33
 
37
34
  # Command name
38
35
  #
@@ -62,12 +59,7 @@ module Mutant
62
59
  [*parent&.full_name, self.class.command_name].join(' ')
63
60
  end
64
61
 
65
- # Test if command needs to be executed in zombie environment
66
- #
67
- # @return [Bool]
68
- def zombie?
69
- false
70
- end
62
+ alias_method :zombie?, :zombie
71
63
 
72
64
  abstract_method :action
73
65
 
@@ -116,7 +108,7 @@ module Mutant
116
108
  end
117
109
  end
118
110
 
119
- def parse
111
+ def parse(arguments)
120
112
  Either
121
113
  .wrap_error(OptionParser::InvalidOption) { parser.order(arguments) }
122
114
  .lmap(&method(:with_help))
@@ -129,6 +121,7 @@ module Mutant
129
121
  parser.separator(nil)
130
122
  end
131
123
 
124
+ # rubocop:disable Metrics/MethodLength
132
125
  def add_global_options(parser)
133
126
  parser.separator("mutant version: #{VERSION}")
134
127
  parser.separator(nil)
@@ -142,6 +135,10 @@ module Mutant
142
135
  parser.on('--version', 'Print mutants version') do
143
136
  capture_main { world.stdout.puts("mutant-#{VERSION}"); true }
144
137
  end
138
+
139
+ parser.on('--zombie', 'Run mutant zombified') do
140
+ @zombie = true
141
+ end
145
142
  end
146
143
 
147
144
  def add_subcommands(parser)
@@ -178,7 +175,12 @@ module Mutant
178
175
  Either::Left.new(with_help('Missing required subcommand!'))
179
176
  else
180
177
  find_command(command_name).bind do |command|
181
- command.parse(**to_h, parent: self, arguments: arguments)
178
+ command.parse(
179
+ arguments: arguments,
180
+ parent: self,
181
+ world: world,
182
+ zombie: zombie
183
+ )
182
184
  end
183
185
  end
184
186
  end
data/lib/mutant/cli.rb CHANGED
@@ -6,10 +6,8 @@ module Mutant
6
6
  # Parse command
7
7
  #
8
8
  # @return [Command]
9
- def self.parse(world:, **attributes)
10
- Command::Root
11
- .parse(world: world, **attributes)
12
- .from_right { |message| Command::FailParse.new(world, message) }
9
+ def self.parse(arguments:, world:)
10
+ Command::Root.parse(arguments: arguments, world: world)
13
11
  end
14
12
  end # CLI
15
13
  end # Mutant
data/lib/mutant/config.rb CHANGED
@@ -21,11 +21,10 @@ module Mutant
21
21
  :matcher,
22
22
  :mutation,
23
23
  :reporter,
24
- :requires,
25
- :zombie
24
+ :requires
26
25
  )
27
26
 
28
- %i[fail_fast zombie].each do |name|
27
+ %i[fail_fast].each do |name|
29
28
  define_method(:"#{name}?") { public_send(name) }
30
29
  end
31
30
 
@@ -74,8 +73,7 @@ module Mutant
74
73
  jobs: other.jobs || jobs,
75
74
  matcher: matcher.merge(other.matcher),
76
75
  mutation: mutation.merge(other.mutation),
77
- requires: requires + other.requires,
78
- zombie: zombie || other.zombie
76
+ requires: requires + other.requires
79
77
  )
80
78
  end
81
79
  # rubocop:enable Metrics/AbcSize
@@ -100,16 +98,6 @@ module Mutant
100
98
  end
101
99
  end
102
100
 
103
- # Expand config with defaults
104
- #
105
- # @return [Config]
106
- def expand_defaults
107
- with(
108
- coverage_criteria: CoverageCriteria::DEFAULT.merge(coverage_criteria),
109
- jobs: jobs || 1
110
- )
111
- end
112
-
113
101
  def self.load_contents(env, path)
114
102
  Transform::Named
115
103
  .new(
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Mutant
4
4
  # Current mutant version
5
- VERSION = '0.11.14'
5
+ VERSION = '0.11.15'
6
6
  end # Mutant
data/lib/mutant.rb CHANGED
@@ -273,7 +273,7 @@ module Mutant
273
273
  # Reopen class to initialize constant to avoid dep circle
274
274
  class Config
275
275
  DEFAULT = new(
276
- coverage_criteria: Config::CoverageCriteria::EMPTY,
276
+ coverage_criteria: Config::CoverageCriteria::DEFAULT,
277
277
  expression_parser: Expression::Parser.new([
278
278
  Expression::Descendants,
279
279
  Expression::Method,
@@ -291,8 +291,7 @@ module Mutant
291
291
  matcher: Matcher::Config::DEFAULT,
292
292
  mutation: Mutation::Config::DEFAULT,
293
293
  reporter: Reporter::CLI.build(WORLD.stdout),
294
- requires: EMPTY_ARRAY,
295
- zombie: false
294
+ requires: EMPTY_ARRAY
296
295
  )
297
296
  end # Config
298
297
 
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.11.14
4
+ version: 0.11.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Markus Schirp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-31 00:00:00.000000000 Z
11
+ date: 2022-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: diff-lcs
@@ -393,7 +393,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
393
393
  - !ruby/object:Gem::Version
394
394
  version: '0'
395
395
  requirements: []
396
- rubygems_version: 3.1.6
396
+ rubygems_version: 3.3.7
397
397
  signing_key:
398
398
  specification_version: 4
399
399
  summary: ''