judges 0.37.0 → 0.38.0

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: f31e0e559fe2bcf694b1e062e12c52fff8743bdf7d3ed2b8c2f255ccc930f4ad
4
- data.tar.gz: e92dc454e97dcfc4959377e0d74dc144d2a154bfb7baf1e0de954fb498171151
3
+ metadata.gz: 404a87a09b8eea92b27df18a4142207bc8f37ffbfe298fb3517aecffb78b9e78
4
+ data.tar.gz: d4a29a3870b5ac2c1737f3c5659812d41596bec90b63fa567f50852477f47b5e
5
5
  SHA512:
6
- metadata.gz: d4176c791c84c596976a320a5b8bd494e101ddfc48421e28a9059a847ef5210db0c6c98ec1d40991eec0c710932c3f10fc59a7dd913c0306cdc374b49737b7d8
7
- data.tar.gz: 6a64089d456705f4e72cb87e56b6e5fcf451edd0c5f5bdb0b79de6d4239979352c8ee11d2c7de935175732c19a882116a2590c841a7a30679afce389aa4be33e
6
+ metadata.gz: 5aed5acd2b705a2d1774b56abfd912491637c714a3e811e7bf50568229fa59d310a96b74f8992794c3858321b5ae2326160696662c568472d8a59364000a3b3f
7
+ data.tar.gz: 58a3bd4ce7094843409ff4cc50f23a9e9f48964afd95da8307b04c1680ffccdc0606c034a292e7427ea5c31345d617123aa44d660d10e77ca93c90ef029be80f
data/Gemfile CHANGED
@@ -6,21 +6,22 @@
6
6
  source 'https://rubygems.org'
7
7
  gemspec
8
8
 
9
- gem 'cucumber', '9.2.1', require: false
10
- gem 'minitest', '5.25.5', require: false
11
- gem 'minitest-reporters', '1.7.1', require: false
12
- gem 'net-ping', '2.0.8', require: false
9
+ gem 'cucumber', '~>9.2', require: false
10
+ gem 'minitest', '~>5.25', require: false
11
+ gem 'minitest-reporters', '~>1.7', require: false
12
+ gem 'minitest-retry', '~>0.2', require: false
13
+ gem 'net-ping', '~>2.0', require: false
13
14
  gem 'qbash', '>0', require: false
14
- gem 'rake', '13.2.1', require: false
15
+ gem 'rake', '~>13.2', require: false
15
16
  gem 'random-port', '~>0.0', require: false
16
- gem 'rspec-rails', '7.1.1', require: false
17
+ gem 'rspec-rails', '~>7.1', require: false
17
18
  gem 'rubocop', '1.74.0', require: false
18
19
  gem 'rubocop-minitest', '>0', require: false
19
20
  gem 'rubocop-performance', '>0', require: false
20
21
  gem 'rubocop-rake', '>0', require: false
21
22
  gem 'rubocop-rspec', '>0', require: false
22
- gem 'simplecov', '0.22.0', require: false
23
- gem 'simplecov-cobertura', '2.1.0', require: false
24
- gem 'w3c_validators', '1.3.7', require: false
25
- gem 'webmock', '3.25.1', require: false
26
- gem 'yard', '0.9.37', require: false
23
+ gem 'simplecov', '~>0.22', require: false
24
+ gem 'simplecov-cobertura', '~>2.1', require: false
25
+ gem 'w3c_validators', '~>1.3', require: false
26
+ gem 'webmock', '~>3.25', require: false
27
+ gem 'yard', '~>0.9', require: false
data/Gemfile.lock CHANGED
@@ -54,7 +54,7 @@ GEM
54
54
  addressable (2.8.7)
55
55
  public_suffix (>= 2.0.2, < 7.0)
56
56
  ansi (1.5.0)
57
- ast (2.4.2)
57
+ ast (2.4.3)
58
58
  backtrace (0.4.0)
59
59
  base64 (0.2.0)
60
60
  baza.rb (0.0.9)
@@ -114,7 +114,7 @@ GEM
114
114
  erubi (1.13.1)
115
115
  ethon (0.16.0)
116
116
  ffi (>= 1.15.0)
117
- factbase (0.9.3)
117
+ factbase (0.9.5)
118
118
  backtrace (>= 0.4.0)
119
119
  decoor (>= 0.0.1)
120
120
  json (~> 2.7)
@@ -169,26 +169,28 @@ GEM
169
169
  builder
170
170
  minitest (>= 5.0)
171
171
  ruby-progressbar
172
+ minitest-retry (0.2.5)
173
+ minitest (>= 5.0)
172
174
  moments (0.3.0)
173
175
  multi_test (1.1.0)
174
176
  multipart-post (2.4.1)
175
177
  net-http (0.6.0)
176
178
  uri
177
179
  net-ping (2.0.8)
178
- nokogiri (1.18.4)
180
+ nokogiri (1.18.5)
179
181
  mini_portile2 (~> 2.8.2)
180
182
  racc (~> 1.4)
181
- nokogiri (1.18.4-aarch64-linux-gnu)
183
+ nokogiri (1.18.5-aarch64-linux-gnu)
182
184
  racc (~> 1.4)
183
- nokogiri (1.18.4-arm-linux-gnu)
185
+ nokogiri (1.18.5-arm-linux-gnu)
184
186
  racc (~> 1.4)
185
- nokogiri (1.18.4-arm64-darwin)
187
+ nokogiri (1.18.5-arm64-darwin)
186
188
  racc (~> 1.4)
187
- nokogiri (1.18.4-x64-mingw-ucrt)
189
+ nokogiri (1.18.5-x64-mingw-ucrt)
188
190
  racc (~> 1.4)
189
- nokogiri (1.18.4-x86_64-darwin)
191
+ nokogiri (1.18.5-x86_64-darwin)
190
192
  racc (~> 1.4)
191
- nokogiri (1.18.4-x86_64-linux-gnu)
193
+ nokogiri (1.18.5-x86_64-linux-gnu)
192
194
  racc (~> 1.4)
193
195
  ostruct (0.6.1)
194
196
  others (0.0.3)
@@ -271,7 +273,7 @@ GEM
271
273
  rubocop-ast (>= 1.38.0, < 2.0)
272
274
  ruby-progressbar (~> 1.7)
273
275
  unicode-display_width (>= 2.4.0, < 4.0)
274
- rubocop-ast (1.39.0)
276
+ rubocop-ast (1.40.0)
275
277
  parser (>= 3.3.1.0)
276
278
  rubocop-minitest (0.37.1)
277
279
  lint_roller (~> 1.1)
@@ -301,7 +303,7 @@ GEM
301
303
  stringio (3.1.5)
302
304
  sys-uname (1.3.1)
303
305
  ffi (~> 1.1)
304
- tago (0.0.2)
306
+ tago (0.1.0)
305
307
  thor (1.3.2)
306
308
  timeout (0.4.3)
307
309
  total (0.4.1)
@@ -337,25 +339,26 @@ PLATFORMS
337
339
  x86_64-linux
338
340
 
339
341
  DEPENDENCIES
340
- cucumber (= 9.2.1)
342
+ cucumber (~> 9.2)
341
343
  judges!
342
- minitest (= 5.25.5)
343
- minitest-reporters (= 1.7.1)
344
- net-ping (= 2.0.8)
344
+ minitest (~> 5.25)
345
+ minitest-reporters (~> 1.7)
346
+ minitest-retry (~> 0.2)
347
+ net-ping (~> 2.0)
345
348
  qbash (> 0)
346
- rake (= 13.2.1)
349
+ rake (~> 13.2)
347
350
  random-port (~> 0.0)
348
- rspec-rails (= 7.1.1)
351
+ rspec-rails (~> 7.1)
349
352
  rubocop (= 1.74.0)
350
353
  rubocop-minitest (> 0)
351
354
  rubocop-performance (> 0)
352
355
  rubocop-rake (> 0)
353
356
  rubocop-rspec (> 0)
354
- simplecov (= 0.22.0)
355
- simplecov-cobertura (= 2.1.0)
356
- w3c_validators (= 1.3.7)
357
- webmock (= 3.25.1)
358
- yard (= 0.9.37)
357
+ simplecov (~> 0.22)
358
+ simplecov-cobertura (~> 2.1)
359
+ w3c_validators (~> 1.3)
360
+ webmock (~> 3.25)
361
+ yard (~> 0.9)
359
362
 
360
363
  BUNDLED WITH
361
364
  2.5.16
data/Rakefile CHANGED
@@ -49,7 +49,7 @@ end
49
49
  require 'cucumber/rake/task'
50
50
  Cucumber::Rake::Task.new(:features) do |t|
51
51
  Rake::Cleaner.cleanup_files(['coverage'])
52
- t.cucumber_opts = %w[--no-color --format=pretty --retry=2 --fail-fast --backtrace --order=random]
52
+ t.cucumber_opts = %w[--no-color --format=summary --retry=2 --fail-fast --backtrace --order=random]
53
53
  end
54
54
  Cucumber::Rake::Task.new(:'features:html') do |t|
55
55
  t.profile = 'html_report'
data/bin/judges CHANGED
@@ -71,6 +71,8 @@ class JudgesGLI extend GLI::App
71
71
  c.flag([:judge], multiple: true)
72
72
  c.desc 'The location of a Ruby library (directory with .rb files to include)'
73
73
  c.flag([:lib])
74
+ c.desc 'Shuffle them, except the ones that start with the prefix'
75
+ c.flag([:shuffle], default_value: '')
74
76
  c.desc 'Maximum time in seconds to spend on the entire update cycle'
75
77
  c.flag([:lifetime], default_value: 300, type: Integer)
76
78
  c.desc 'Maximum time in seconds to spend on every judge (forcefully terminate if over time)'
@@ -16,9 +16,9 @@ Feature: Test
16
16
  And Exit code is zero
17
17
 
18
18
  Scenario: Factbase version can be set
19
- When I run bin/judges with "--factbase 0.9.3 --verbose test --judge guess ./fixtures"
19
+ When I run bin/judges with "--factbase 0.9.5 --verbose test --judge guess ./fixtures"
20
20
  Then Exit code is zero
21
- And Stdout contains "Factbase version to be used: '0.9.3'"
21
+ And Stdout contains "Factbase version to be used: '0.9.5'"
22
22
 
23
23
  Scenario: Simple test of no judges
24
24
  Given I run bin/judges with "test --judge absent_for_sure ./fixtures"
data/judges.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
10
10
  s.required_ruby_version = '>=3.2'
11
11
  s.name = 'judges'
12
- s.version = '0.37.0'
12
+ s.version = '0.38.0'
13
13
  s.license = 'MIT'
14
14
  s.summary = 'Command-Line Tool for a Factbase'
15
15
  s.description =
@@ -59,7 +59,7 @@ class Judges::Update
59
59
  else
60
60
  @loog.debug("The following options provided:\n\t#{options.to_s.gsub("\n", "\n\t")}")
61
61
  end
62
- judges = Judges::Judges.new(dir, opts['lib'], @loog, start:)
62
+ judges = Judges::Judges.new(dir, opts['lib'], @loog, start:, shuffle: opts['shuffle'])
63
63
  c = 0
64
64
  churn = Factbase::Churn.new
65
65
  errors = []
data/lib/judges/judges.rb CHANGED
@@ -26,11 +26,12 @@ require_relative 'judge'
26
26
  # Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
27
27
  # License:: MIT
28
28
  class Judges::Judges
29
- def initialize(dir, lib, loog, start: Time.now)
29
+ def initialize(dir, lib, loog, start: Time.now, shuffle: '')
30
30
  @dir = dir
31
31
  @lib = lib
32
32
  @loog = loog
33
33
  @start = start
34
+ @shuffle = shuffle || ''
34
35
  end
35
36
 
36
37
  # Get one judge by name.
@@ -43,14 +44,23 @@ class Judges::Judges
43
44
 
44
45
  # Iterate over them all.
45
46
  # @yield [Judge]
46
- def each
47
+ def each(&)
47
48
  return to_enum(__method__) unless block_given?
48
- Dir.glob(File.join(@dir, '*')).each do |d|
49
- next unless File.directory?(d)
50
- b = File.basename(d)
51
- next unless File.exist?(File.join(d, "#{b}.rb"))
52
- yield Judges::Judge.new(File.absolute_path(d), @lib, @loog)
49
+ list =
50
+ Dir.glob(File.join(@dir, '*')).each.to_a.map do |d|
51
+ next unless File.directory?(d)
52
+ b = File.basename(d)
53
+ next unless File.exist?(File.join(d, "#{b}.rb"))
54
+ Judges::Judge.new(File.absolute_path(d), @lib, @loog)
55
+ end
56
+ list.compact!
57
+ list.sort_by!(&:name)
58
+ all = list.each_with_index.to_a
59
+ good = all.dup
60
+ all.reject { |a| a[0].name.start_with?(@shuffle) }.map { |a| a[1] }.each_with_index do |i, idx|
61
+ good[i] = all[idx]
53
62
  end
63
+ good.map { |a| a[0] }.each(&)
54
64
  end
55
65
 
56
66
  # Iterate over them all.
data/lib/judges.rb CHANGED
@@ -8,5 +8,5 @@
8
8
  # Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
9
9
  # License:: MIT
10
10
  module Judges
11
- VERSION = '0.37.0' unless const_defined?(:VERSION)
11
+ VERSION = '0.38.0' unless const_defined?(:VERSION)
12
12
  end
data/test/test__helper.rb CHANGED
@@ -16,6 +16,12 @@ require 'minitest/autorun'
16
16
  require 'minitest/reporters'
17
17
  Minitest::Reporters.use! [Minitest::Reporters::SpecReporter.new]
18
18
 
19
+ # To make tests retry on failure:
20
+ if ENV['RACK_RUN']
21
+ require 'minitest/retry'
22
+ Minitest::Retry.use!
23
+ end
24
+
19
25
  class Minitest::Test
20
26
  def save_it(file, content)
21
27
  require 'fileutils'
data/test/test_judges.rb CHANGED
@@ -29,6 +29,22 @@ class TestJudges < Minitest::Test
29
29
  end
30
30
  end
31
31
 
32
+ def test_shuffles_them
33
+ Dir.mktmpdir do |d|
34
+ names = %w[apple banana blueberry mellon orange papaya pear strawberry].sort
35
+ names.each do |n|
36
+ dir = File.join(d, n)
37
+ save_it(File.join(dir, "#{n}.rb"), 'puts 1')
38
+ end
39
+ list = Judges::Judges.new(d, nil, Loog::NULL, shuffle: 'b').each.to_a
40
+ assert_equal('banana', list[1].name)
41
+ assert_equal('blueberry', list[2].name)
42
+ refute_equal(names.join(' '), list.map(&:name).join(' '))
43
+ list = Judges::Judges.new(d, nil, Loog::NULL, shuffle: '').each.to_a
44
+ assert_equal(names.join(' '), list.map(&:name).join(' '))
45
+ end
46
+ end
47
+
32
48
  def test_get_one
33
49
  Dir.mktmpdir do |d|
34
50
  save_it(File.join(d, 'boo/boo.rb'), 'hey')
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: judges
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.37.0
4
+ version: 0.38.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-03-19 00:00:00.000000000 Z
10
+ date: 2025-03-20 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: backtrace