judges 0.33.0 ā 0.35.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 +4 -4
- data/.gitignore +6 -5
- data/.rultor.yml +1 -1
- data/Gemfile +1 -1
- data/Gemfile.lock +5 -5
- data/README.md +5 -1
- data/bin/judges +2 -0
- data/features/test.feature +1 -1
- data/fixtures/repeat/repeat.rb +6 -0
- data/fixtures/repeat/repeated.yml +9 -0
- data/judges.gemspec +1 -1
- data/lib/judges/commands/test.rb +13 -9
- data/lib/judges/commands/update.rb +11 -4
- data/lib/judges.rb +1 -1
- data/test/commands/test_update.rb +11 -0
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6ea5b0cb2d8ad5e54b8fe3dc642b389b9fbca98f9f4d28924ecd8d4c8f85fb4
|
4
|
+
data.tar.gz: 35fba3154528724481be97f23bce59ff30761f100c6d056a6514a72c5f660b02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 402a83df023ef0428007ff704a910491c6ad382b1285bb376dc85cc127772be58cac9d60cb447a585556b5578cda3c9b36e15c09bb166063d24834be1e27ee8b
|
7
|
+
data.tar.gz: e88e01844ae33059d03b030c893d5d3f8dbb2ed9e654c8a78f87c3da9c21cbebde989cffb43bee8944e82f08d6774cab85d428da8c694aba49b28860bcd41249
|
data/.gitignore
CHANGED
data/.rultor.yml
CHANGED
data/Gemfile
CHANGED
@@ -12,7 +12,7 @@ gem 'minitest-reporters', '1.7.1', require: false
|
|
12
12
|
gem 'rake', '13.2.1', require: false
|
13
13
|
gem 'random-port', '~>0.0', require: false
|
14
14
|
gem 'rspec-rails', '7.1.1', require: false
|
15
|
-
gem 'rubocop', '1.
|
15
|
+
gem 'rubocop', '1.73.1', require: false
|
16
16
|
gem 'rubocop-minitest', '>0', require: false
|
17
17
|
gem 'rubocop-performance', '>0', require: false
|
18
18
|
gem 'rubocop-rake', '>0', require: false
|
data/Gemfile.lock
CHANGED
@@ -113,7 +113,7 @@ GEM
|
|
113
113
|
erubi (1.13.1)
|
114
114
|
ethon (0.16.0)
|
115
115
|
ffi (>= 1.15.0)
|
116
|
-
factbase (0.7.
|
116
|
+
factbase (0.7.4)
|
117
117
|
backtrace (> 0)
|
118
118
|
decoor (> 0)
|
119
119
|
json (~> 2.7)
|
@@ -253,7 +253,7 @@ GEM
|
|
253
253
|
rspec-mocks (~> 3.13)
|
254
254
|
rspec-support (~> 3.13)
|
255
255
|
rspec-support (3.13.2)
|
256
|
-
rubocop (1.
|
256
|
+
rubocop (1.73.1)
|
257
257
|
json (~> 2.3)
|
258
258
|
language_server-protocol (~> 3.17.0.2)
|
259
259
|
lint_roller (~> 1.1.0)
|
@@ -264,7 +264,7 @@ GEM
|
|
264
264
|
rubocop-ast (>= 1.38.0, < 2.0)
|
265
265
|
ruby-progressbar (~> 1.7)
|
266
266
|
unicode-display_width (>= 2.4.0, < 4.0)
|
267
|
-
rubocop-ast (1.38.
|
267
|
+
rubocop-ast (1.38.1)
|
268
268
|
parser (>= 3.3.1.0)
|
269
269
|
rubocop-minitest (0.37.1)
|
270
270
|
lint_roller (~> 1.1)
|
@@ -304,7 +304,7 @@ GEM
|
|
304
304
|
unicode-display_width (3.1.4)
|
305
305
|
unicode-emoji (~> 4.0, >= 4.0.4)
|
306
306
|
unicode-emoji (4.0.4)
|
307
|
-
uri (1.0.
|
307
|
+
uri (1.0.3)
|
308
308
|
useragent (0.16.11)
|
309
309
|
w3c_validators (1.3.7)
|
310
310
|
json (>= 1.8)
|
@@ -336,7 +336,7 @@ DEPENDENCIES
|
|
336
336
|
rake (= 13.2.1)
|
337
337
|
random-port (~> 0.0)
|
338
338
|
rspec-rails (= 7.1.1)
|
339
|
-
rubocop (= 1.
|
339
|
+
rubocop (= 1.73.1)
|
340
340
|
rubocop-minitest (> 0)
|
341
341
|
rubocop-performance (> 0)
|
342
342
|
rubocop-rake (> 0)
|
data/README.md
CHANGED
@@ -40,6 +40,7 @@ before:
|
|
40
40
|
category: slow
|
41
41
|
runs: 1
|
42
42
|
skip: false
|
43
|
+
repeat: 20
|
43
44
|
input:
|
44
45
|
-
|
45
46
|
foo: 42
|
@@ -65,6 +66,9 @@ when the test is finished.
|
|
65
66
|
The `category` (default: `[]`) may have one or an array of categories,
|
66
67
|
which then may be turned on via the `--category` command line flag.
|
67
68
|
|
69
|
+
The `repeat` (default: `1`) makes `input` to be repeated multiple times
|
70
|
+
(mostly useful for speed measuring on big data inputs).
|
71
|
+
|
68
72
|
The `runs` (default: `1`) is the number of times the `.rb` script should
|
69
73
|
be executed. After each execution, all expected XPath expressions are validated.
|
70
74
|
|
@@ -82,7 +86,7 @@ be present in the message of the exception being raised.
|
|
82
86
|
|
83
87
|
Read
|
84
88
|
[these guidelines](https://www.yegor256.com/2014/04/15/github-guidelines.html).
|
85
|
-
Make sure
|
89
|
+
Make sure your build is green before you contribute
|
86
90
|
your pull request. You will need to have
|
87
91
|
[Ruby](https://www.ruby-lang.org/en/) 3.0+ and
|
88
92
|
[Bundler](https://bundler.io/) installed. Then:
|
data/bin/judges
CHANGED
@@ -55,6 +55,8 @@ class JudgesGLI extend GLI::App
|
|
55
55
|
c.flag([:o, :option], multiple: true, arg_name: '<key=value>')
|
56
56
|
c.desc 'File with options, one k=v pair per line'
|
57
57
|
c.flag([:'options-file'])
|
58
|
+
c.desc 'Name of the judge to run (directory name)'
|
59
|
+
c.flag([:judge], multiple: true)
|
58
60
|
c.desc 'The location of a Ruby library (directory with .rb files to include)'
|
59
61
|
c.flag([:lib])
|
60
62
|
c.desc 'Maximum time in seconds to spend on every judge (forcefully terminate if over time)'
|
data/features/test.feature
CHANGED
@@ -7,7 +7,7 @@ Feature: Test
|
|
7
7
|
Scenario: Simple test of a few judges
|
8
8
|
Given I run bin/judges with "test ./fixtures"
|
9
9
|
Then Stdout contains "š Testing"
|
10
|
-
Then Stdout contains "All
|
10
|
+
Then Stdout contains "All 3 judge(s) and 3 tests passed"
|
11
11
|
And Exit code is zero
|
12
12
|
|
13
13
|
Scenario: Simple test of just one 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.
|
12
|
+
s.version = '0.35.0'
|
13
13
|
s.license = 'MIT'
|
14
14
|
s.summary = 'Command-Line Tool for a Factbase'
|
15
15
|
s.description =
|
data/lib/judges/commands/test.rb
CHANGED
@@ -92,7 +92,9 @@ class Judges::Test
|
|
92
92
|
'Time summaries:',
|
93
93
|
format(fmt, 'Script', 'Seconds'),
|
94
94
|
format(fmt, '---', '---'),
|
95
|
-
times.
|
95
|
+
times.sort_by { |_, v| v }.reverse.map do |script, sec|
|
96
|
+
format(fmt, script, format('%.3f', sec))
|
97
|
+
end.join("\n ")
|
96
98
|
].join("\n ")
|
97
99
|
)
|
98
100
|
end
|
@@ -126,15 +128,17 @@ class Judges::Test
|
|
126
128
|
|
127
129
|
def prepare(fb, yaml)
|
128
130
|
inputs = yaml['input']
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
vv.
|
134
|
-
|
131
|
+
(yaml['repeat']&.to_i || 1).times do
|
132
|
+
inputs&.each do |i|
|
133
|
+
f = fb.insert
|
134
|
+
i.each do |k, vv|
|
135
|
+
if vv.is_a?(Array)
|
136
|
+
vv.each do |v|
|
137
|
+
f.send(:"#{k}=", v)
|
138
|
+
end
|
139
|
+
else
|
140
|
+
f.send(:"#{k}=", vv)
|
135
141
|
end
|
136
|
-
else
|
137
|
-
f.send(:"#{k}=", vv)
|
138
142
|
end
|
139
143
|
end
|
140
144
|
end
|
@@ -111,12 +111,13 @@ class Judges::Update
|
|
111
111
|
global = {}
|
112
112
|
elapsed(@loog, level: Logger::INFO) do
|
113
113
|
done =
|
114
|
-
judges.each_with_index do |
|
115
|
-
|
114
|
+
judges.each_with_index do |judge, i|
|
115
|
+
next unless include?(opts, judge.name)
|
116
|
+
@loog.info("\nš Running #{judge.name} (##{i}) at #{judge.dir.to_rel} (#{start.ago} already)...")
|
116
117
|
elapsed(@loog, level: Logger::INFO) do
|
117
|
-
c = one_judge(opts, fb,
|
118
|
+
c = one_judge(opts, fb, judge, global, options, errors)
|
118
119
|
churn += c
|
119
|
-
throw :"š The '#{
|
120
|
+
throw :"š The '#{judge.name}' judge #{c} out of #{fb.size}"
|
120
121
|
end
|
121
122
|
rescue StandardError, SyntaxError => e
|
122
123
|
@loog.warn(Backtrace.new(e))
|
@@ -152,4 +153,10 @@ class Judges::Update
|
|
152
153
|
throw :"š The '#{judge.name}' judge timed out: #{e.message}"
|
153
154
|
end
|
154
155
|
end
|
156
|
+
|
157
|
+
def include?(opts, name)
|
158
|
+
judges = opts['judge'] || []
|
159
|
+
return true if judges.empty?
|
160
|
+
judges.any?(name)
|
161
|
+
end
|
155
162
|
end
|
data/lib/judges.rb
CHANGED
@@ -28,6 +28,17 @@ class TestUpdate < Minitest::Test
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
+
def test_with_only_one_judge
|
32
|
+
Dir.mktmpdir do |d|
|
33
|
+
save_it(File.join(d, 'foo/foo.rb'), 'return if $fb.size > 2; $fb.insert')
|
34
|
+
save_it(File.join(d, 'bar/bar.rb'), '-&- bug here -&-')
|
35
|
+
file = File.join(d, 'base.fb')
|
36
|
+
Judges::Update.new(Loog::NULL).run({ 'judge' => ['foo'] }, [d, file])
|
37
|
+
assert_path_exists(file)
|
38
|
+
assert_raises(StandardError) { Judges::Update.new(Loog::NULL).run({}, [d, file]) }
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
31
42
|
def test_cancels_slow_judge
|
32
43
|
Dir.mktmpdir do |d|
|
33
44
|
save_it(File.join(d, 'foo/foo.rb'), 'sleep 10; $fb.insert.foo = 1')
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: judges
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.35.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date: 2025-
|
10
|
+
date: 2025-03-03 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: backtrace
|
@@ -272,6 +271,8 @@ files:
|
|
272
271
|
- fixtures/guess/guess.rb
|
273
272
|
- fixtures/guess/guess_made.yml
|
274
273
|
- fixtures/guess/skipped.yml
|
274
|
+
- fixtures/repeat/repeat.rb
|
275
|
+
- fixtures/repeat/repeated.yml
|
275
276
|
- fixtures/try/tried.yml
|
276
277
|
- fixtures/try/try.rb
|
277
278
|
- judges.gemspec
|
@@ -316,7 +317,6 @@ licenses:
|
|
316
317
|
- MIT
|
317
318
|
metadata:
|
318
319
|
rubygems_mfa_required: 'true'
|
319
|
-
post_install_message:
|
320
320
|
rdoc_options:
|
321
321
|
- "--charset=UTF-8"
|
322
322
|
require_paths:
|
@@ -332,8 +332,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
332
332
|
- !ruby/object:Gem::Version
|
333
333
|
version: '0'
|
334
334
|
requirements: []
|
335
|
-
rubygems_version: 3.
|
336
|
-
signing_key:
|
335
|
+
rubygems_version: 3.6.2
|
337
336
|
specification_version: 4
|
338
337
|
summary: Command-Line Tool for a Factbase
|
339
338
|
test_files: []
|