judges 0.57.0 → 0.57.2

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: 25236f211b356d3dfe62fd6ba9eb7eb70a04e2de64d2581d682db989967cefa9
4
- data.tar.gz: c804cf366c81db1834496d71852422dbb245edfc76f0a24511621a4aa7979ada
3
+ metadata.gz: 88354a97358028176ab246461d697b8a15665f9cc7f40a8027ea06e319ad2cac
4
+ data.tar.gz: a14e5f0de607ae66d42c564d0acce72bad9f631173e62012ffbd1e8930dabf42
5
5
  SHA512:
6
- metadata.gz: 1c33f8ae0312222d0ae2ec848d031648fc5f04cb2a64d49e63a26176157a2d9e82bb2fa1f8e010aa0fe8a482fe16690145bdca92f367f05afa851687a18f09af
7
- data.tar.gz: 6bfafca7127eca496160d7b57325e92815ced1872da8f929380aa0fee185d5f3931cdf5eb753d39a3c68c9c19800a2cfa100b99da60288d9dbae33ccb9680309
6
+ metadata.gz: 2f0e66bc1557e30a9e1197971c5218b8b31afa371bb5db7e180f758458e6c8efa9c6734ddf260101238a1b56b5b5acb05cf5946e5ad3205b4d201063f9a8c820
7
+ data.tar.gz: '08f46b98339901d7f045e07fd9569dedc09b33ccf20060a00421f5e52b0010cac384a92e2d24375c22a0ba8626d61a6501aba46fe6758c7ec5c98dfae8655838'
data/Gemfile.lock CHANGED
@@ -116,7 +116,7 @@ GEM
116
116
  gli (2.22.2)
117
117
  ostruct
118
118
  hashdiff (1.2.1)
119
- iri (0.11.2)
119
+ iri (0.11.3)
120
120
  json (2.16.0)
121
121
  language_server-protocol (3.17.0.5)
122
122
  lint_roller (1.1.0)
@@ -125,7 +125,7 @@ GEM
125
125
  logger (~> 1.0)
126
126
  memoist3 (1.0.0)
127
127
  mini_mime (1.1.5)
128
- minitest (5.26.1)
128
+ minitest (5.26.2)
129
129
  minitest-reporters (1.7.1)
130
130
  ansi
131
131
  builder
@@ -136,8 +136,8 @@ GEM
136
136
  moments (0.3.0)
137
137
  multi_test (1.1.0)
138
138
  multipart-post (2.4.1)
139
- net-http (0.7.0)
140
- uri
139
+ net-http (0.8.0)
140
+ uri (>= 0.11.1)
141
141
  nokogiri (1.18.10-aarch64-linux-gnu)
142
142
  racc (~> 1.4)
143
143
  nokogiri (1.18.10-aarch64-linux-musl)
@@ -167,7 +167,7 @@ GEM
167
167
  racc
168
168
  prism (1.6.0)
169
169
  public_suffix (6.0.2)
170
- qbash (0.4.7)
170
+ qbash (0.4.8)
171
171
  backtrace (> 0)
172
172
  elapsed (> 0)
173
173
  loog (> 0)
@@ -220,7 +220,7 @@ GEM
220
220
  memoist3 (~> 1.0.0)
221
221
  tago (0.4.0)
222
222
  timeout (0.4.4)
223
- total (0.4.1)
223
+ total (0.4.2)
224
224
  typhoeus (1.4.1)
225
225
  ethon (>= 0.9.0)
226
226
  unicode-display_width (3.2.0)
data/Rakefile CHANGED
@@ -7,7 +7,6 @@ require 'os'
7
7
  require 'qbash'
8
8
  require 'rubygems'
9
9
  require 'rake'
10
- require 'rdoc'
11
10
  require 'rake/clean'
12
11
  require 'shellwords'
13
12
 
data/bin/judges CHANGED
@@ -27,6 +27,7 @@ class JudgesGLI extend GLI::App
27
27
  require_relative "../lib/judges/commands/#{ruby}"
28
28
  start = Time.now
29
29
  @@loog.debug("Running '#{ruby}' command...")
30
+ options = global.merge(options)
30
31
  begin
31
32
  Object.const_get("Judges::#{ruby.capitalize}").new(@@loog).run(options, args)
32
33
  @@loog.debug("Command '#{ruby}' completed in #{start.ago}")
@@ -117,6 +118,8 @@ class JudgesGLI extend GLI::App
117
118
  c.flag([:lib])
118
119
  c.desc 'Shuffle judges, except those starting with the specified prefix'
119
120
  c.flag([:shuffle], default_value: '')
121
+ c.desc 'Random seed for judge ordering (default: 0)'
122
+ c.flag([:seed], default_value: 0, type: Integer)
120
123
  c.desc 'Prioritize a judge to run before all others'
121
124
  c.flag([:boost], multiple: true)
122
125
  c.desc 'Demote a judge to run after all others'
@@ -18,6 +18,14 @@ Feature: Print
18
18
  Then Stdout contains "printed"
19
19
  And Exit code is zero
20
20
 
21
+ Scenario: Simple print of a small factbase, to HTML, in offline mode
22
+ Given I make a temp directory
23
+ Then I run bin/judges with "--verbose eval simple.fb '$fb.insert.foo = 42'"
24
+ Then I run bin/judges with "--offline print --format=html simple.fb simple.html"
25
+ Then Stdout contains "printed"
26
+ Then simple.html contains "sha256-offline"
27
+ And Exit code is zero
28
+
21
29
  Scenario: Simple print of a small factbase, to JSON
22
30
  Given I make a temp directory
23
31
  Then I run bin/judges with "--verbose eval simple.fb '$fb.insert.foo = 42'"
@@ -56,6 +56,11 @@ When(/^I run bash with:$/) do |text|
56
56
  @exitstatus = $CHILD_STATUS.exitstatus
57
57
  end
58
58
 
59
+ Then(/^([a-z].+) contains "([^"]*)"$/) do |file, txt|
60
+ data = File.read(file)
61
+ raise "The file #{file} doesn't contain '#{txt}':\n#{data}" unless data.include?(txt)
62
+ end
63
+
59
64
  Then(/^Stdout contains "([^"]*)"$/) do |txt|
60
65
  raise "STDOUT doesn't contain '#{txt}':\n#{@stdout}" unless @stdout.include?(txt)
61
66
  end
@@ -62,7 +62,7 @@ Feature: Update
62
62
  n = $fb.insert
63
63
  n.type = 'second'
64
64
  """
65
- Then I run bin/judges with "--verbose update --quiet --lifetime 4 --timeout 3 --max-cycles 5 . simple.fb"
65
+ Then I run bin/judges with "--verbose update --quiet --lifetime 4 --timeout 3 --max-cycles 5 --shuffle 'first' . simple.fb"
66
66
  Then Stdout contains "Update completed in 2 cycle(s), did 3i/0d/3a"
67
67
  And Exit code is zero
68
68
 
@@ -248,7 +248,7 @@ Feature: Update
248
248
  """
249
249
  $fb.insert.name = 'beta'
250
250
  """
251
- Then I run bin/judges with "update --statistics --quiet --max-cycles 2 --lifetime 4 --timeout 3 . stats.fb"
251
+ Then I run bin/judges with "update --statistics --quiet --max-cycles 2 --lifetime 4 --timeout 3 --shuffle 'alpha' . stats.fb"
252
252
  Then Stdout contains "Judge execution summary:"
253
253
  Then Stdout contains "alpha"
254
254
  Then Stdout contains "beta"
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.57.0'
12
+ s.version = '0.57.2'
13
13
  s.license = 'MIT'
14
14
  s.summary = 'Command-Line Tool for a Factbase'
15
15
  s.description =
@@ -68,7 +68,7 @@ class Judges::Update
68
68
  judges = Judges::Judges.new(
69
69
  dir, opts['lib'], @loog,
70
70
  epoch: @epoch, shuffle: opts['shuffle'], boost: opts['boost'],
71
- demote: opts['demote']
71
+ demote: opts['demote'], seed: opts['seed']
72
72
  )
73
73
  begin
74
74
  Timeout.timeout(opts['lifetime']) do
@@ -43,19 +43,15 @@ class Judges::Upload
43
43
  )
44
44
  elapsed(@loog, level: Logger::INFO) do
45
45
  id = baza.durable_find(jname, name)
46
- size = File.size(path)
47
46
  if id.nil? || id.to_s.strip.empty?
48
- f = Tempfile.new('placeholder')
49
- begin
50
- File.write(f.path, 'placeholder')
51
- f.close
52
- id = baza.durable_place(jname, f.path)
47
+ Dir.mktmpdir do |tmp|
48
+ f = File.join(tmp, name)
49
+ File.write(f, 'placeholder')
50
+ id = baza.durable_place(jname, f)
53
51
  @loog.info("Placed a placeholder to new durable '#{name}' in '#{jname}' (ID: #{id})")
54
- ensure
55
- f.close unless f.closed?
56
- f.unlink
57
52
  end
58
53
  end
54
+ size = File.size(path)
59
55
  id = id.to_i
60
56
  baza.durable_lock(id, opts['owner'] || 'default')
61
57
  begin
data/lib/judges/judges.rb CHANGED
@@ -34,7 +34,8 @@ class Judges::Judges
34
34
  # @param [String] shuffle Prefix for names of judges to shuffle
35
35
  # @param [Array<String>] boost Names of judges to boost in priority
36
36
  # @param [Array<String>] demote Names of judges to demote in priority
37
- def initialize(dir, lib, loog, epoch: Time.now, shuffle: '', boost: [], demote: [])
37
+ # @param [Integer] seed Random seed for judge ordering (default: 0)
38
+ def initialize(dir, lib, loog, epoch: Time.now, shuffle: '', boost: [], demote: [], seed: 0)
38
39
  @dir = dir
39
40
  @lib = lib
40
41
  @loog = loog
@@ -42,6 +43,7 @@ class Judges::Judges
42
43
  @shuffle = shuffle || ''
43
44
  @boost = boost
44
45
  @demote = demote
46
+ @seed = seed || 0
45
47
  end
46
48
 
47
49
  # Retrieves a specific judge by its name.
@@ -62,10 +64,10 @@ class Judges::Judges
62
64
  # This method discovers all judge directories, validates them (ensuring they contain
63
65
  # a corresponding .rb file), and yields them in a specific order. The order is
64
66
  # determined by:
65
- # 1. Judges whose names match the boost list are placed first
66
- # 2. Judges whose names start with the shuffle prefix are randomly reordered
67
+ # 1. Randomly reorder judges (if shuffle prefix is empty, shuffle all judges;
68
+ # if prefix is not empty, shuffle only those NOT starting with the prefix)
69
+ # 2. Judges whose names match the boost list are placed first
67
70
  # 3. Judges whose names match the demote list are placed last
68
- # 4. All other judges maintain their alphabetical order
69
71
  #
70
72
  # @yield [Judges::Judge] Yields each valid judge object
71
73
  # @return [Enumerator] Returns an enumerator if no block is given
@@ -84,9 +86,9 @@ class Judges::Judges
84
86
  good = all.dup
85
87
  mapping = all
86
88
  .map { |a| [a[0].name, a[1], a[1]] }
87
- .reject { |a| a[0].start_with?(@shuffle) }
89
+ .reject { |a| !@shuffle.empty? && a[0].start_with?(@shuffle) }
88
90
  .to_h { |a| [a[1], a[2]] }
89
- positions = mapping.values.shuffle
91
+ positions = mapping.values.shuffle(random: Random.new(@seed))
90
92
  mapping.keys.zip(positions).to_h.each do |before, after|
91
93
  good[after] = all[before]
92
94
  end
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.57.0' unless const_defined?(:VERSION)
11
+ VERSION = '0.57.2' unless const_defined?(:VERSION)
12
12
  end
data/package-lock.json CHANGED
@@ -10,9 +10,9 @@
10
10
  }
11
11
  },
12
12
  "node_modules/@eslint-community/eslint-utils": {
13
- "version": "4.7.0",
14
- "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.7.0.tgz",
15
- "integrity": "sha512-dyybb3AcajC7uha6CvhdVRJqaKyn7w2YKqKyAN37NKYgZT36w+iRb0Dymmc5qEJ549c/S31cMMSFd75bteCpCw==",
13
+ "version": "4.9.0",
14
+ "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.0.tgz",
15
+ "integrity": "sha512-ayVFHdtZ+hsq1t2Dy24wCmGXGe4q9Gu3smhLYALJrr473ZH27MsnSL+LKUlimp4BWJqMDMLmPpx/Q9R3OAlL4g==",
16
16
  "dev": true,
17
17
  "license": "MIT",
18
18
  "dependencies": {
@@ -52,13 +52,13 @@
52
52
  }
53
53
  },
54
54
  "node_modules/@eslint/config-array": {
55
- "version": "0.21.0",
56
- "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.0.tgz",
57
- "integrity": "sha512-ENIdc4iLu0d93HeYirvKmrzshzofPw6VkZRKQGe9Nv46ZnWUzcF1xV01dcvEg/1wXUR61OmmlSfyeyO7EvjLxQ==",
55
+ "version": "0.21.1",
56
+ "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.1.tgz",
57
+ "integrity": "sha512-aw1gNayWpdI/jSYVgzN5pL0cfzU02GT3NBpeT/DXbx1/1x7ZKxFPd9bwrzygx/qiwIQiJ1sw/zD8qY/kRvlGHA==",
58
58
  "dev": true,
59
59
  "license": "Apache-2.0",
60
60
  "dependencies": {
61
- "@eslint/object-schema": "^2.1.6",
61
+ "@eslint/object-schema": "^2.1.7",
62
62
  "debug": "^4.3.1",
63
63
  "minimatch": "^3.1.2"
64
64
  },
@@ -67,19 +67,22 @@
67
67
  }
68
68
  },
69
69
  "node_modules/@eslint/config-helpers": {
70
- "version": "0.3.0",
71
- "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.3.0.tgz",
72
- "integrity": "sha512-ViuymvFmcJi04qdZeDc2whTHryouGcDlaxPqarTD0ZE10ISpxGUVZGZDx4w01upyIynL3iu6IXH2bS1NhclQMw==",
70
+ "version": "0.4.2",
71
+ "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.4.2.tgz",
72
+ "integrity": "sha512-gBrxN88gOIf3R7ja5K9slwNayVcZgK6SOUORm2uBzTeIEfeVaIhOpCtTox3P6R7o2jLFwLFTLnC7kU/RGcYEgw==",
73
73
  "dev": true,
74
74
  "license": "Apache-2.0",
75
+ "dependencies": {
76
+ "@eslint/core": "^0.17.0"
77
+ },
75
78
  "engines": {
76
79
  "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
77
80
  }
78
81
  },
79
82
  "node_modules/@eslint/core": {
80
- "version": "0.14.0",
81
- "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.14.0.tgz",
82
- "integrity": "sha512-qIbV0/JZr7iSDjqAc60IqbLdsj9GDt16xQtWD+B78d/HAlvysGdZZ6rpJHGAc2T0FQx1X6thsSPdnoiGKdNtdg==",
83
+ "version": "0.17.0",
84
+ "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.17.0.tgz",
85
+ "integrity": "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==",
83
86
  "dev": true,
84
87
  "license": "Apache-2.0",
85
88
  "dependencies": {
@@ -114,9 +117,9 @@
114
117
  }
115
118
  },
116
119
  "node_modules/@eslint/js": {
117
- "version": "9.30.1",
118
- "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.30.1.tgz",
119
- "integrity": "sha512-zXhuECFlyep42KZUhWjfvsmXGX39W8K8LFb8AWXM9gSV9dQB+MrJGLKvW6Zw0Ggnbpw0VHTtrhFXYe3Gym18jg==",
120
+ "version": "9.39.1",
121
+ "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.1.tgz",
122
+ "integrity": "sha512-S26Stp4zCy88tH94QbBv3XCuzRQiZ9yXofEILmglYTh/Ug/a9/umqvgFtYBAo3Lp0nsI/5/qH1CCrbdK3AP1Tw==",
120
123
  "dev": true,
121
124
  "license": "MIT",
122
125
  "engines": {
@@ -127,9 +130,9 @@
127
130
  }
128
131
  },
129
132
  "node_modules/@eslint/object-schema": {
130
- "version": "2.1.6",
131
- "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.6.tgz",
132
- "integrity": "sha512-RBMg5FRL0I0gs51M/guSAj5/e14VQ4tpZnQNWwuDT66P14I43ItmPfIZRhO9fUVIPOAQXU47atlywZ/czoqFPA==",
133
+ "version": "2.1.7",
134
+ "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.7.tgz",
135
+ "integrity": "sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA==",
133
136
  "dev": true,
134
137
  "license": "Apache-2.0",
135
138
  "engines": {
@@ -137,13 +140,13 @@
137
140
  }
138
141
  },
139
142
  "node_modules/@eslint/plugin-kit": {
140
- "version": "0.3.1",
141
- "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.3.1.tgz",
142
- "integrity": "sha512-0J+zgWxHN+xXONWIyPWKFMgVuJoZuGiIFu8yxk7RJjxkzpGmyja5wRFqZIVtjDVOQpV+Rw0iOAjYPE2eQyjr0w==",
143
+ "version": "0.4.1",
144
+ "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.4.1.tgz",
145
+ "integrity": "sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==",
143
146
  "dev": true,
144
147
  "license": "Apache-2.0",
145
148
  "dependencies": {
146
- "@eslint/core": "^0.14.0",
149
+ "@eslint/core": "^0.17.0",
147
150
  "levn": "^0.4.1"
148
151
  },
149
152
  "engines": {
@@ -236,6 +239,7 @@
236
239
  "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
237
240
  "dev": true,
238
241
  "license": "MIT",
242
+ "peer": true,
239
243
  "bin": {
240
244
  "acorn": "bin/acorn"
241
245
  },
@@ -419,25 +423,25 @@
419
423
  }
420
424
  },
421
425
  "node_modules/eslint": {
422
- "version": "9.30.1",
423
- "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.30.1.tgz",
424
- "integrity": "sha512-zmxXPNMOXmwm9E0yQLi5uqXHs7uq2UIiqEKo3Gq+3fwo1XrJ+hijAZImyF7hclW3E6oHz43Yk3RP8at6OTKflQ==",
426
+ "version": "9.39.1",
427
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.1.tgz",
428
+ "integrity": "sha512-BhHmn2yNOFA9H9JmmIVKJmd288g9hrVRDkdoIgRCRuSySRUHH7r/DI6aAXW9T1WwUuY3DFgrcaqB+deURBLR5g==",
425
429
  "dev": true,
426
430
  "license": "MIT",
431
+ "peer": true,
427
432
  "dependencies": {
428
- "@eslint-community/eslint-utils": "^4.2.0",
433
+ "@eslint-community/eslint-utils": "^4.8.0",
429
434
  "@eslint-community/regexpp": "^4.12.1",
430
- "@eslint/config-array": "^0.21.0",
431
- "@eslint/config-helpers": "^0.3.0",
432
- "@eslint/core": "^0.14.0",
435
+ "@eslint/config-array": "^0.21.1",
436
+ "@eslint/config-helpers": "^0.4.2",
437
+ "@eslint/core": "^0.17.0",
433
438
  "@eslint/eslintrc": "^3.3.1",
434
- "@eslint/js": "9.30.1",
435
- "@eslint/plugin-kit": "^0.3.1",
439
+ "@eslint/js": "9.39.1",
440
+ "@eslint/plugin-kit": "^0.4.1",
436
441
  "@humanfs/node": "^0.16.6",
437
442
  "@humanwhocodes/module-importer": "^1.0.1",
438
443
  "@humanwhocodes/retry": "^0.4.2",
439
444
  "@types/estree": "^1.0.6",
440
- "@types/json-schema": "^7.0.15",
441
445
  "ajv": "^6.12.4",
442
446
  "chalk": "^4.0.0",
443
447
  "cross-spawn": "^7.0.6",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: judges
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.57.0
4
+ version: 0.57.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko