judges 0.42.1 → 0.43.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: '08d3de03e1b95604d047cef9fc57b854df50472735347fa9eefdb760ade40b2f'
4
- data.tar.gz: cfabae3261cdbbfe3a0960f30bde15705c2934f9acbba96032832fb88b1e69d1
3
+ metadata.gz: 9872185eca6e28654c9ee3395817985e8762408d022d961e189cbfcfab7c2ac8
4
+ data.tar.gz: 0c83c8a61f2661a17f8473469920b7e7c493be4d30e8f2f1bca7f3afaf6e6049
5
5
  SHA512:
6
- metadata.gz: 83c656135bbaae9ee295b8022ec3a6105fb2be8f9fecbac23cb28c1402d72260ae03872eb887fbe1224a989e7bf41512724b01d3687a9c78673757ded36927f3
7
- data.tar.gz: 11df07fc1c6049286aaac01f7af3c3fe6dc75cad176b3907dd2cb006f7ecc9936ea49b43949143874e42a7590fbc08662eec4f8013b792e808ee0be6736923da
6
+ metadata.gz: 76d8a0e542efee6b6e444857b4e1dbe3ff40ddb482f3f109e1170a8f9281021d5ff1952ac74d53aad513aaf3e87441f39080ec6c6adda0300c06566d37b85b9c
7
+ data.tar.gz: 6222dc327c05ee568395feb6c0b05ba37a5a152ac7d4d51b2be71b7be0262617ac82160491e13b90330729b10e6104e11fd3f50ce3ff8ea3ed47598057a4b9a5
@@ -16,6 +16,5 @@ jobs:
16
16
  runs-on: ubuntu-24.04
17
17
  steps:
18
18
  - uses: actions/checkout@v4
19
- - run: npm install -g eslint@9.17.0
20
- - run: npm install @eslint/js
21
- - run: eslint
19
+ - run: npm install
20
+ - run: npx eslint .
@@ -20,4 +20,4 @@ jobs:
20
20
  runs-on: ubuntu-24.04
21
21
  steps:
22
22
  - uses: actions/checkout@v4
23
- - uses: articulate/actions-markdownlint@v1
23
+ - uses: DavidAnson/markdownlint-cli2-action@v20.0.0
data/.gitignore CHANGED
@@ -9,3 +9,4 @@ node_modules/
9
9
  rdoc/
10
10
  temp/
11
11
  vendor/
12
+ .claude
data/Gemfile.lock CHANGED
@@ -78,6 +78,7 @@ GEM
78
78
  elapsed (0.0.1)
79
79
  loog (> 0)
80
80
  tago (> 0)
81
+ erb (5.0.1)
81
82
  ethon (0.16.0)
82
83
  ffi (>= 1.15.0)
83
84
  factbase (0.10.2)
@@ -111,7 +112,7 @@ GEM
111
112
  ffi (1.17.2-x86_64-linux-gnu)
112
113
  gli (2.22.2)
113
114
  ostruct
114
- hashdiff (1.1.2)
115
+ hashdiff (1.2.0)
115
116
  iri (0.10.0)
116
117
  json (2.12.0)
117
118
  language_server-protocol (3.17.0.5)
@@ -172,7 +173,8 @@ GEM
172
173
  rake (13.2.1)
173
174
  random-port (0.7.5)
174
175
  tago (> 0)
175
- rdoc (6.13.1)
176
+ rdoc (6.14.0)
177
+ erb
176
178
  psych (>= 4.0.0)
177
179
  regexp_parser (2.10.0)
178
180
  retries (0.0.5)
data/assets/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
- SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
3
- SPDX-License-Identifier: MIT
4
- */
2
+ * SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
5
 
6
6
  $(() => {
7
7
  $('#facts').tablesorter();
data/bin/judges CHANGED
@@ -23,7 +23,7 @@ class JudgesGLI extend GLI::App
23
23
  start = Time.now
24
24
  @@loog.debug("Running '#{ruby}' command...")
25
25
  Object.const_get("Judges::#{ruby.capitalize}").new(@@loog).run(options, args)
26
- @@loog.debug("Command '#{ruby}' finished in #{start.ago}")
26
+ @@loog.debug("Command '#{ruby}' completed in #{start.ago}")
27
27
  end
28
28
  end
29
29
 
@@ -37,9 +37,9 @@ class JudgesGLI extend GLI::App
37
37
 
38
38
  subcommand_option_handling(:normal)
39
39
 
40
- desc 'Make it more verbose, logging as much as possible'
40
+ desc 'Enable verbose mode with maximum logging'
41
41
  switch([:v, :verbose])
42
- desc 'Version of Factbase to use'
42
+ desc 'Specify Factbase version to use'
43
43
  flag([:factbase], type: String)
44
44
 
45
45
  pre do |global, command, options, args|
@@ -61,36 +61,38 @@ class JudgesGLI extend GLI::App
61
61
  true
62
62
  end
63
63
 
64
- desc 'Update the factbase by passing all judges one by one'
64
+ desc 'Update the factbase by executing all judges sequentially'
65
65
  command :update do |c|
66
- c.desc 'Options to pass to every judge'
66
+ c.desc 'Options to pass to each judge'
67
67
  c.flag([:o, :option], multiple: true, arg_name: '<key=value>')
68
- c.desc 'File with options, one k=v pair per line'
68
+ c.desc 'File containing options, one key=value pair per line'
69
69
  c.flag([:'options-file'])
70
70
  c.desc 'Name of the judge to run (directory name)'
71
71
  c.flag([:judge], multiple: true)
72
- c.desc 'The location of a Ruby library (directory with .rb files to include)'
72
+ c.desc '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'
74
+ c.desc 'Shuffle judges, except those starting with the specified prefix'
75
75
  c.flag([:shuffle], default_value: '')
76
- c.desc 'Boost one judge, running it on top of all others'
76
+ c.desc 'Prioritize a judge to run before all others'
77
77
  c.flag([:boost], multiple: true)
78
- c.desc 'Maximum time in seconds to spend on the entire update cycle'
78
+ c.desc 'Maximum time in seconds for the entire update cycle'
79
79
  c.flag([:lifetime], default_value: 300, type: Integer)
80
- c.desc 'Maximum time in seconds to spend on every judge (forcefully terminate if over time)'
80
+ c.desc 'Maximum time in seconds for each judge (forcefully terminates if exceeded)'
81
81
  c.flag([:timeout], default_value: 30, type: Integer)
82
82
  c.desc 'Maximum number of update cycles to run'
83
83
  c.flag([:'max-cycles'], default_value: 8, type: Integer)
84
- c.desc 'Stay quiet even if some judges fail'
84
+ c.desc 'Suppress errors even when judges fail'
85
85
  c.switch([:q, :quiet], default_value: false)
86
- c.desc 'Place a summarization fact into the factbase'
86
+ c.desc 'Stop processing immediately after the first error'
87
+ c.switch([:'fail-fast'], default_value: false)
88
+ c.desc 'Add a summary fact to the factbase'
87
89
  c.switch([:summary], default_value: false)
88
90
  c.desc 'Use default logging facility'
89
91
  c.switch([:log], default_value: true)
90
92
  run_it(c, 'update')
91
93
  end
92
94
 
93
- desc 'Evaluate a single Ruby expression on the factbase'
95
+ desc 'Evaluate a single Ruby expression against the factbase'
94
96
  command :eval do |c|
95
97
  c.desc 'Use default logging facility'
96
98
  c.switch([:log], default_value: true)
@@ -109,40 +111,40 @@ class JudgesGLI extend GLI::App
109
111
  run_it(c, 'import')
110
112
  end
111
113
 
112
- desc 'Remove the facts that are too old'
114
+ desc 'Remove outdated facts from the factbase'
113
115
  command :trim do |c|
114
- c.desc 'Only the facts that match the expression are deleted'
116
+ c.desc 'Delete only facts matching the specified expression'
115
117
  c.flag([:query], default_value: '(never)')
116
118
  run_it(c, 'trim')
117
119
  end
118
120
 
119
- desc 'Print the factbase into a human-readable format (YAML, JSON, etc.)'
121
+ desc 'Convert the factbase to a human-readable format (YAML, JSON, etc.)'
120
122
  command :print do |c|
121
123
  c.desc 'Output format (xml, json, or yaml)'
122
124
  c.flag([:format], default_value: 'yaml')
123
- c.desc 'Generate output name of the file automatically'
125
+ c.desc 'Automatically generate the output filename'
124
126
  c.switch([:auto], default_value: false)
125
- c.desc 'The title of the document to use'
127
+ c.desc 'Document title to use'
126
128
  c.flag([:title], default_value: 'summary')
127
- c.desc 'Only the facts that match the expression are printed'
129
+ c.desc 'Print only facts matching the specified expression'
128
130
  c.flag([:query], default_value: '(always)')
129
- c.desc 'Comma separated list of columns to show in HTML output (no spaces!)'
131
+ c.desc 'Comma-separated list of columns to display in HTML output (no spaces)'
130
132
  c.flag([:columns], default_value: 'when,what')
131
- c.desc 'Comma separated list of hidden columns, not to be rendered (no spaces!)'
133
+ c.desc 'Comma-separated list of columns to hide from rendering (no spaces)'
132
134
  c.flag([:hidden], default_value: '_id,_time,_version,_job')
133
- c.desc 'Print even if target file already exists and is older than the factbase'
135
+ c.desc 'Force printing even if the target file exists and is older than the factbase'
134
136
  c.switch([:force], default_value: false)
135
137
  run_it(c, 'print')
136
138
  end
137
139
 
138
- desc 'Inspect the factbase and print all its possible meta-data'
140
+ desc 'Inspect the factbase and display all available metadata'
139
141
  command :inspect do |c|
140
142
  run_it(c, 'inspect')
141
143
  end
142
144
 
143
145
  desc 'Run automated tests for all judges'
144
146
  command :test do |c|
145
- c.desc 'Options to pass to every judge (may be overwritten by YAML)'
147
+ c.desc 'Options to pass to each judge (may be overridden by YAML)'
146
148
  c.flag([:o, :option], multiple: true, arg_name: '<key=value>')
147
149
  c.desc 'Categories of tests to disable'
148
150
  c.flag([:disable], multiple: true)
@@ -150,57 +152,57 @@ class JudgesGLI extend GLI::App
150
152
  c.flag([:enable], multiple: true)
151
153
  c.desc 'Name of the judge to run (directory name)'
152
154
  c.flag([:judge], multiple: true)
153
- c.desc 'How many times to run?'
155
+ c.desc 'Number of times to run the tests'
154
156
  c.flag([:runs], type: Integer)
155
- c.desc 'The location of a Ruby library (directory with .rb files to include)'
157
+ c.desc 'Location of a Ruby library (directory with .rb files to include)'
156
158
  c.flag([:lib])
157
- c.desc 'Stay quiet even if some tests fail or simply no tests executed?'
159
+ c.desc 'Suppress output even if tests fail or none are executed'
158
160
  c.switch([:quiet], default_value: false)
159
161
  c.desc 'Use default logging facility'
160
162
  c.switch([:log], default_value: true)
161
163
  run_it(c, 'test')
162
164
  end
163
165
 
164
- desc 'Push the factbase to the server and unlock it over there'
166
+ desc 'Push the factbase to the server and unlock it remotely'
165
167
  command :push do |c|
166
168
  c.desc 'Authentication token'
167
169
  c.flag([:token])
168
- c.desc 'The IP/hostname of the server'
170
+ c.desc 'Server IP/hostname'
169
171
  c.flag([:host], default_value: 'api.zerocracy.com')
170
- c.desc 'The TCP port number of the server'
172
+ c.desc 'Server TCP port number'
171
173
  c.flag([:port], default_value: 443, type: Integer)
172
- c.desc 'Connection and read time in seconds'
174
+ c.desc 'Connection and read timeout in seconds'
173
175
  c.flag([:timeout], default_value: 30, type: Integer)
174
- c.desc 'Shall SSL be used?'
176
+ c.desc 'Enable SSL connection'
175
177
  c.switch([:ssl], default_value: true)
176
- c.desc 'A unique name to use for a lock/unlock'
178
+ c.desc 'Unique identifier for lock/unlock operations'
177
179
  c.flag([:owner], default_value: 'default', type: String)
178
- c.desc 'Supplementary meta information about the upload (key:value)'
180
+ c.desc 'Additional metadata for the upload (key:value format)'
179
181
  c.flag([:meta], type: String, multiple: true)
180
- c.desc 'How many times to retry'
182
+ c.desc 'Number of retry attempts'
181
183
  c.flag([:retries], type: Integer, default_value: 3)
182
- c.desc 'Turn on the package compression'
184
+ c.desc 'Enable package compression'
183
185
  c.switch([:zip], default_value: true)
184
186
  run_it(c, 'push')
185
187
  end
186
188
 
187
- desc 'Pull the factbase from the server and lock it over there'
189
+ desc 'Pull the factbase from the server and lock it remotely'
188
190
  command :pull do |c|
189
191
  c.desc 'Authentication token'
190
192
  c.flag([:token])
191
- c.desc 'How many seconds to wait'
193
+ c.desc 'Maximum wait time in seconds'
192
194
  c.flag([:wait], default_value: 10 * 60, arg_name: '<seconds>', type: Integer)
193
- c.desc 'The IP/hostname of the server'
195
+ c.desc 'Server IP/hostname'
194
196
  c.flag([:host], default_value: 'api.zerocracy.com')
195
- c.desc 'The TCP port number of the server'
197
+ c.desc 'Server TCP port number'
196
198
  c.flag([:port], default_value: 443, type: Integer)
197
- c.desc 'Connection and read time in seconds'
199
+ c.desc 'Connection and read timeout in seconds'
198
200
  c.flag([:timeout], default_value: 30, type: Integer)
199
- c.desc 'Shall SSL be used?'
201
+ c.desc 'Enable SSL connection'
200
202
  c.switch([:ssl], default_value: true)
201
- c.desc 'A unique name to use for a lock/unlock'
203
+ c.desc 'Unique identifier for lock/unlock operations'
202
204
  c.flag([:owner], default_value: 'default', type: String)
203
- c.desc 'How many times to retry'
205
+ c.desc 'Number of retry attempts'
204
206
  c.flag([:retries], type: Integer, default_value: 3)
205
207
  run_it(c, 'pull')
206
208
  end
@@ -16,5 +16,5 @@ Feature: Import
16
16
  z: 3.14
17
17
  """
18
18
  Then I run bin/judges with "--verbose import simple.yaml simple.fb"
19
- Then Stdout contains "Import of 2 facts finished"
19
+ Then Stdout contains "Import of 2 facts completed"
20
20
  And Exit code is zero
@@ -15,7 +15,7 @@ Feature: Update
15
15
  Then Stdout contains "FOO → "
16
16
  Then Stdout contains "BAR → "
17
17
  Then Stdout contains "1 judge(s) processed"
18
- Then Stdout contains "Update finished in 3 cycle(s), did 3i/0d/3a"
18
+ Then Stdout contains "Update completed in 3 cycle(s), did 3i/0d/3a"
19
19
  And Exit code is zero
20
20
 
21
21
  Scenario: Generate a summary fact, with errors
@@ -39,7 +39,7 @@ Feature: Update
39
39
  """
40
40
  Then I run bin/judges with "--verbose update --quiet --lifetime 1 --max-cycles 5 . simple.fb"
41
41
  Then Stdout contains "The 'simple' judge skipped, no time left"
42
- Then Stdout contains "Update finished in 2 cycle(s), did 1i/0d/0a"
42
+ Then Stdout contains "Update completed in 2 cycle(s), did 1i/0d/0a"
43
43
  And Exit code is zero
44
44
 
45
45
  Scenario: Use options from a file
@@ -57,7 +57,7 @@ Feature: Update
57
57
  Then Stdout contains "A1 → "
58
58
  Then Stdout contains "A2 → "
59
59
  Then Stdout contains "1 judge(s) processed"
60
- Then Stdout contains "Update finished"
60
+ Then Stdout contains "Update completed"
61
61
  And Exit code is zero
62
62
 
63
63
  Scenario: Simple run with a timeout for a judge
@@ -71,7 +71,7 @@ Feature: Update
71
71
  Then Stdout contains "execution expired"
72
72
  Then Stdout contains "judge timed out after"
73
73
  Then Stdout contains "1 judge(s) processed"
74
- Then Stdout contains "Update finished in 1 cycle(s), did 0i/0d/0a"
74
+ Then Stdout contains "Update completed in 1 cycle(s), did 0i/0d/0a"
75
75
  And Exit code is zero
76
76
 
77
77
  Scenario: Simple run of a few judges, with a lib
@@ -87,7 +87,7 @@ Feature: Update
87
87
  """
88
88
  Then I run bin/judges with "update --lib mylib --max-cycles 1 mine simple.fb"
89
89
  Then Stdout contains "1 judge(s) processed"
90
- Then Stdout contains "Update finished in 1 cycle(s)"
90
+ Then Stdout contains "Update completed in 1 cycle(s)"
91
91
  And Exit code is zero
92
92
 
93
93
  Scenario: The update fails when a bug in a judge
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.42.1'
12
+ s.version = '0.43.0'
13
13
  s.license = 'MIT'
14
14
  s.summary = 'Command-Line Tool for a Factbase'
15
15
  s.description =
@@ -22,7 +22,7 @@ class Judges::Eval
22
22
  @loog = loog
23
23
  end
24
24
 
25
- # Run the eval command.
25
+ # Run the eval command (called by the +bin/judges+ script).
26
26
  # @param [Hash] opts Command line options (start with '--')
27
27
  # @param [Array] args List of command line arguments
28
28
  # @raise [RuntimeError] If not exactly two arguments provided
@@ -40,7 +40,7 @@ class Judges::Eval
40
40
  eval(expr)
41
41
  # rubocop:enable Security/Eval
42
42
  impex.export($fb)
43
- throw :'Evaluated successfully'
43
+ throw :'šŸ‘ Evaluated successfully'
44
44
  end
45
45
  end
46
46
  end
@@ -24,7 +24,7 @@ class Judges::Import
24
24
  @loog = loog
25
25
  end
26
26
 
27
- # Run the import command.
27
+ # Run the import command (called by the +bin/judges+ script).
28
28
  # @param [Hash] opts Command line options (start with '--')
29
29
  # @param [Array] args List of command line arguments
30
30
  # @raise [RuntimeError] If not exactly two arguments provided or file not found
@@ -47,7 +47,7 @@ class Judges::Import
47
47
  end
48
48
  end
49
49
  impex.export(fb)
50
- throw :"Import of #{yaml.size} facts finished"
50
+ throw :"šŸ‘ Import of #{yaml.size} facts completed"
51
51
  end
52
52
  end
53
53
  end
@@ -21,12 +21,12 @@ class Judges::Inspect
21
21
  @loog = loog
22
22
  end
23
23
 
24
- # Run the inspect command.
24
+ # Run the inspect command (called by the +bin/judges+ script).
25
25
  # @param [Hash] _opts Command line options (not used)
26
26
  # @param [Array] args List of command line arguments
27
27
  # @raise [RuntimeError] If no arguments provided
28
28
  def run(_opts, args)
29
- raise 'At lease one argument required' if args.empty?
29
+ raise 'At least one argument required' if args.empty?
30
30
  fb = Judges::Impex.new(@loog, args[0]).import
31
31
  @loog.info("Facts: #{fb.size}")
32
32
  end
@@ -22,7 +22,7 @@ class Judges::Join
22
22
  @loog = loog
23
23
  end
24
24
 
25
- # Run the join command.
25
+ # Run the join command (called by the +bin/judges+ script).
26
26
  # @param [Hash] _opts Command line options (not used)
27
27
  # @param [Array] args List of command line arguments
28
28
  # @raise [RuntimeError] If not exactly two arguments provided
@@ -34,7 +34,7 @@ class Judges::Join
34
34
  fb = master.import
35
35
  slave.import_to(fb)
36
36
  master.export(fb)
37
- throw :'Two factbases joined'
37
+ throw :'šŸ‘ Two factbases joined successfully'
38
38
  end
39
39
  end
40
40
  end
@@ -29,11 +29,12 @@ class Judges::Print
29
29
  @loog = loog
30
30
  end
31
31
 
32
- # Run it (it is supposed to be called by the +bin/judges+ script.
32
+ # Run the print command (called by the +bin/judges+ script).
33
33
  # @param [Hash] opts Command line options (start with '--')
34
34
  # @param [Array] args List of command line arguments
35
+ # @raise [RuntimeError] If no arguments provided
35
36
  def run(opts, args)
36
- raise 'At lease one argument required' if args.empty?
37
+ raise 'At least one argument required' if args.empty?
37
38
  f = args[0]
38
39
  fb = Judges::Impex.new(@loog, f).import
39
40
  fb.query("(not #{opts['query']})").delete! unless opts['query'].nil?
@@ -70,7 +71,7 @@ class Judges::Print
70
71
  raise "Unknown format '#{fmt}'"
71
72
  end
72
73
  File.binwrite(o, output)
73
- throw :"Factbase printed to #{o.to_rel} (#{File.size(o)} bytes)"
74
+ throw :"šŸ‘ Factbase printed to #{o.to_rel} (#{File.size(o)} bytes)"
74
75
  end
75
76
  end
76
77
 
@@ -25,9 +25,10 @@ class Judges::Pull
25
25
  @loog = loog
26
26
  end
27
27
 
28
- # Run it (it is supposed to be called by the +bin/judges+ script.
28
+ # Run the pull command (called by the +bin/judges+ script).
29
29
  # @param [Hash] opts Command line options (start with '--')
30
30
  # @param [Array] args List of command line arguments
31
+ # @raise [RuntimeError] If not exactly two arguments provided
31
32
  def run(opts, args)
32
33
  raise 'Exactly two arguments required' unless args.size == 2
33
34
  fb = Factbase.new
@@ -54,9 +55,9 @@ class Judges::Pull
54
55
  baza.unlock(name, opts['owner'])
55
56
  raise e
56
57
  end
57
- throw :"Pulled #{fb.size} facts by the name '#{name}'"
58
+ throw :"šŸ‘ Pulled #{fb.size} facts by name '#{name}'"
58
59
  else
59
- throw :"There is nothing to pull, the name '#{name}' is absent on the server"
60
+ throw :"āš ļø Nothing to pull - name '#{name}' not found on server"
60
61
  end
61
62
  end
62
63
  end
@@ -69,7 +70,7 @@ class Judges::Pull
69
70
  loop do
70
71
  break if baza.finished?(id)
71
72
  sleep 1
72
- raise "Time is over, the job ##{id} ('#{name}') is still not finished" if Time.now - start > limit
73
+ raise "Time is over, the job ##{id} ('#{name}') is still not completed" if Time.now - start > limit
73
74
  lapsed = Time.now - start
74
75
  @loog.debug("Still waiting for the job ##{id} ('#{name}') to finish... (#{format('%.2f', lapsed)}s already)")
75
76
  end
@@ -25,9 +25,10 @@ class Judges::Push
25
25
  @loog = loog
26
26
  end
27
27
 
28
- # Run it (it is supposed to be called by the +bin/judges+ script.
28
+ # Run the push command (called by the +bin/judges+ script).
29
29
  # @param [Hash] opts Command line options (start with '--')
30
30
  # @param [Array] args List of command line arguments
31
+ # @raise [RuntimeError] If not exactly two arguments provided
31
32
  def run(opts, args)
32
33
  raise 'Exactly two arguments required' unless args.size == 2
33
34
  name = args[0]
@@ -44,7 +45,7 @@ class Judges::Push
44
45
  baza.lock(name, opts['owner'])
45
46
  begin
46
47
  id = baza.push(name, fb.export, opts['meta'] || [])
47
- throw :"Pushed #{fb.size} facts, job ID is #{id}"
48
+ throw :"šŸ‘ Pushed #{fb.size} facts, job ID is #{id}"
48
49
  ensure
49
50
  baza.unlock(name, opts['owner'])
50
51
  end
@@ -29,9 +29,10 @@ class Judges::Test
29
29
  @loog = loog
30
30
  end
31
31
 
32
- # Run it (it is supposed to be called by the +bin/judges+ script.
32
+ # Run the test command (called by the +bin/judges+ script).
33
33
  # @param [Hash] opts Command line options (start with '--')
34
34
  # @param [Array] args List of command line arguments
35
+ # @raise [RuntimeError] If not exactly one argument provided
35
36
  def run(opts, args)
36
37
  raise 'Exactly one argument required' unless args.size == 1
37
38
  dir = args[0]
@@ -23,18 +23,19 @@ class Judges::Trim
23
23
  @loog = loog
24
24
  end
25
25
 
26
- # Run it (it is supposed to be called by the +bin/judges+ script.
26
+ # Run the trim command (called by the +bin/judges+ script).
27
27
  # @param [Hash] opts Command line options (start with '--')
28
28
  # @param [Array] args List of command line arguments
29
+ # @raise [RuntimeError] If not exactly one argument provided
29
30
  def run(opts, args)
30
31
  raise 'Exactly one argument required' unless args.size == 1
31
32
  impex = Judges::Impex.new(@loog, args[0])
32
33
  fb = impex.import
33
34
  elapsed(@loog, level: Logger::INFO) do
34
35
  deleted = fb.query(opts['query']).delete!
35
- throw :'No facts deleted' if deleted.zero?
36
+ throw :'āš ļø No facts deleted' if deleted.zero?
36
37
  impex.export(fb)
37
- throw :"šŸ—‘ #{deleted} fact(s) deleted"
38
+ throw :"šŸ‘ #{deleted} fact(s) deleted"
38
39
  end
39
40
  end
40
41
  end
@@ -33,10 +33,10 @@ class Judges::Update
33
33
  @start = Time.now
34
34
  end
35
35
 
36
- # Run it (it is supposed to be called by the +bin/judges+ script.
37
- #
36
+ # Run the update command (called by the +bin/judges+ script).
38
37
  # @param [Hash] opts Command line options (start with '--')
39
38
  # @param [Array] args List of command line arguments
39
+ # @raise [RuntimeError] If not exactly two arguments provided or directory is missing
40
40
  def run(opts, args)
41
41
  raise 'Exactly two arguments required' unless args.size == 2
42
42
  dir = args[0]
@@ -81,9 +81,13 @@ class Judges::Update
81
81
  @loog.info("Too many cycles already, as set by --max-cycles=#{opts['max-cycles']}, breaking")
82
82
  break
83
83
  end
84
+ if opts['fail-fast'] && !errors.empty?
85
+ @loog.info("Due to #{errors.count} errors we must stop at the update cycle ##{c}")
86
+ break
87
+ end
84
88
  @loog.info("The cycle #{c} did #{delta}")
85
89
  end
86
- throw :"Update finished in #{c} cycle(s), did #{churn}"
90
+ throw :"šŸ‘ Update completed in #{c} cycle(s), did #{churn}"
87
91
  end
88
92
  return unless opts['summary']
89
93
  summarize(fb, churn, errors, start, c)
@@ -144,6 +148,10 @@ class Judges::Update
144
148
  elapsed(@loog, level: Logger::INFO) do
145
149
  done =
146
150
  judges.each_with_index do |judge, i|
151
+ if opts['fail-fast'] && !errors.empty?
152
+ @loog.info("Not running #{judge.name.inspect} due to #{errors.count} errors above, in --fail-fast mode")
153
+ next
154
+ end
147
155
  next unless include?(opts, judge.name)
148
156
  @loog.info("\nšŸ‘‰ Running #{judge.name} (##{i}) at #{judge.dir.to_rel} (#{start.ago} already)...")
149
157
  elapsed(@loog, level: Logger::INFO) do
data/lib/judges/judge.rb CHANGED
@@ -59,7 +59,7 @@ class Judges::Judge
59
59
  end
60
60
  s = File.join(@dir, script)
61
61
  raise "Can't load '#{s}'" unless File.exist?(s)
62
- elapsed(@loog, intro: "#{$judge} finished", level: Logger::INFO) do
62
+ elapsed(@loog, intro: "#{$judge} completed", level: Logger::INFO) do
63
63
  load(s, true)
64
64
  $fb.churn
65
65
  # rubocop:disable Lint/RescueException
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.42.1' unless const_defined?(:VERSION)
11
+ VERSION = '0.43.0' unless const_defined?(:VERSION)
12
12
  end