judges 0.39.1 → 0.40.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/Gemfile.lock +17 -17
- data/README.md +4 -4
- data/Rakefile +1 -1
- data/assets/index.css +1 -0
- data/assets/index.js +7 -5
- data/assets/index.xsl +11 -1
- data/features/test.feature +2 -2
- data/features/update.feature +12 -0
- data/judges.gemspec +1 -1
- data/lib/judges/commands/print.rb +11 -6
- data/lib/judges/commands/update.rb +38 -11
- data/lib/judges.rb +1 -1
- data/package-lock.json +407 -419
- data/test/commands/test_print.rb +1 -0
- data/test/commands/test_update.rb +24 -0
- data/test/test__helper.rb +18 -5
- metadata +2 -3
- data/.simplecov +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b196cd4426d14641681cdfbb223f08b2ffb5d2695341b2af53a5912f0b9cbc77
|
4
|
+
data.tar.gz: 3db4f5d244d79acf5d056be8795af17f2d17d2e09e91cfdac53bafc50dca07c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c57bf9e691a4e227a4b6a7692bc8882ac044d23bc41936af8c997537ac7f0f3ecb924e4d48d0bcbf015c111b4c665502815cc8cfb66b947cedf9b0fdb91f6c09
|
7
|
+
data.tar.gz: 2977522f4485043ca0673f4e16dd806460874190b61159e50d39a8b01c9cf3174c08ab6195e21708798c3539c018442a5d770cca12e77916f1642a670efb0f8f
|
data/Gemfile.lock
CHANGED
@@ -28,7 +28,7 @@ GEM
|
|
28
28
|
ast (2.4.3)
|
29
29
|
backtrace (0.4.0)
|
30
30
|
base64 (0.2.0)
|
31
|
-
baza.rb (0.
|
31
|
+
baza.rb (0.4.0)
|
32
32
|
backtrace (> 0)
|
33
33
|
elapsed (> 0)
|
34
34
|
faraday (> 0)
|
@@ -80,7 +80,7 @@ GEM
|
|
80
80
|
tago (> 0)
|
81
81
|
ethon (0.16.0)
|
82
82
|
ffi (>= 1.15.0)
|
83
|
-
factbase (0.
|
83
|
+
factbase (0.10.0)
|
84
84
|
backtrace (~> 0.4)
|
85
85
|
decoor (~> 0.0)
|
86
86
|
json (~> 2.7)
|
@@ -90,7 +90,7 @@ GEM
|
|
90
90
|
others (~> 0.0)
|
91
91
|
tago (~> 0.0)
|
92
92
|
yaml (~> 0.3)
|
93
|
-
faraday (2.
|
93
|
+
faraday (2.13.0)
|
94
94
|
faraday-net_http (>= 2.0, < 3.5)
|
95
95
|
json
|
96
96
|
logger
|
@@ -100,15 +100,15 @@ GEM
|
|
100
100
|
multipart-post (~> 2.0)
|
101
101
|
faraday-net_http (3.4.0)
|
102
102
|
net-http (>= 0.5.0)
|
103
|
-
faraday-retry (2.3.
|
103
|
+
faraday-retry (2.3.1)
|
104
104
|
faraday (~> 2.0)
|
105
|
-
ffi (1.17.
|
106
|
-
ffi (1.17.
|
107
|
-
ffi (1.17.
|
108
|
-
ffi (1.17.
|
109
|
-
ffi (1.17.
|
110
|
-
ffi (1.17.
|
111
|
-
ffi (1.17.
|
105
|
+
ffi (1.17.2-aarch64-linux-gnu)
|
106
|
+
ffi (1.17.2-arm-linux-gnu)
|
107
|
+
ffi (1.17.2-arm64-darwin)
|
108
|
+
ffi (1.17.2-x64-mingw-ucrt)
|
109
|
+
ffi (1.17.2-x86-linux-gnu)
|
110
|
+
ffi (1.17.2-x86_64-darwin)
|
111
|
+
ffi (1.17.2-x86_64-linux-gnu)
|
112
112
|
gli (2.22.2)
|
113
113
|
ostruct
|
114
114
|
hashdiff (1.1.2)
|
@@ -152,8 +152,8 @@ GEM
|
|
152
152
|
os (1.1.4)
|
153
153
|
ostruct (0.6.1)
|
154
154
|
others (0.0.3)
|
155
|
-
parallel (1.
|
156
|
-
parser (3.3.
|
155
|
+
parallel (1.27.0)
|
156
|
+
parser (3.3.8.0)
|
157
157
|
ast (~> 2.4.1)
|
158
158
|
racc
|
159
159
|
prism (1.4.0)
|
@@ -176,7 +176,7 @@ GEM
|
|
176
176
|
regexp_parser (2.10.0)
|
177
177
|
retries (0.0.5)
|
178
178
|
rexml (3.4.1)
|
179
|
-
rubocop (1.75.
|
179
|
+
rubocop (1.75.2)
|
180
180
|
json (~> 2.3)
|
181
181
|
language_server-protocol (~> 3.17.0.2)
|
182
182
|
lint_roller (~> 1.1.0)
|
@@ -184,10 +184,10 @@ GEM
|
|
184
184
|
parser (>= 3.3.0.2)
|
185
185
|
rainbow (>= 2.2.2, < 4.0)
|
186
186
|
regexp_parser (>= 2.9.3, < 3.0)
|
187
|
-
rubocop-ast (>= 1.
|
187
|
+
rubocop-ast (>= 1.44.0, < 2.0)
|
188
188
|
ruby-progressbar (~> 1.7)
|
189
189
|
unicode-display_width (>= 2.4.0, < 4.0)
|
190
|
-
rubocop-ast (1.
|
190
|
+
rubocop-ast (1.44.1)
|
191
191
|
parser (>= 3.3.7.2)
|
192
192
|
prism (~> 1.4)
|
193
193
|
rubocop-minitest (0.38.0)
|
@@ -201,7 +201,7 @@ GEM
|
|
201
201
|
rubocop-rake (0.7.1)
|
202
202
|
lint_roller (~> 1.1)
|
203
203
|
rubocop (>= 1.72.1)
|
204
|
-
rubocop-rspec (3.
|
204
|
+
rubocop-rspec (3.6.0)
|
205
205
|
lint_roller (~> 1.1)
|
206
206
|
rubocop (~> 1.72, >= 1.72.1)
|
207
207
|
ruby-progressbar (1.13.0)
|
data/README.md
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# Judges over a Factbase Executor
|
2
2
|
|
3
|
-
[](https://www.rultor.com/p/yegor256/judges)
|
4
4
|
[](https://www.jetbrains.com/ruby/)
|
5
5
|
|
6
6
|
[](https://github.com/yegor256/judges/actions/workflows/rake.yml)
|
7
|
-
[](
|
7
|
+
[](https://www.0pdd.com/p?name=yegor256/judges)
|
8
|
+
[](https://badge.fury.io/rb/judges)
|
9
9
|
[](https://codecov.io/github/yegor256/judges?branch=master)
|
10
|
-
[](https://rubydoc.info/github/yegor256/judges/master/frames)
|
11
11
|
[](https://hitsofcode.com/view/github/yegor256/judges)
|
12
12
|
[](https://github.com/yegor256/judges/blob/master/LICENSE.txt)
|
13
13
|
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fyegor256%2Fjudges?ref=badge_shield&issueType=license)
|
data/Rakefile
CHANGED
@@ -38,7 +38,7 @@ task :picks do
|
|
38
38
|
next if OS.windows?
|
39
39
|
%w[test lib].each do |d|
|
40
40
|
Dir["#{d}/**/*.rb"].each do |f|
|
41
|
-
qbash("bundle exec ruby #{Shellwords.escape(f)}", log: $stdout)
|
41
|
+
qbash("bundle exec ruby #{Shellwords.escape(f)}", log: $stdout, env: { 'PICKS' => 'yes' })
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
data/assets/index.css
CHANGED
data/assets/index.js
CHANGED
@@ -9,9 +9,11 @@ $(() => {
|
|
9
9
|
|
10
10
|
updateTime = () => {
|
11
11
|
const now = new Date();
|
12
|
-
const
|
13
|
-
const
|
14
|
-
|
12
|
+
const iso = now.toISOString();
|
13
|
+
const div = document.getElementById('current-time');
|
14
|
+
div.textContent = `Current time: ${iso}`;
|
15
15
|
}
|
16
|
-
|
17
|
-
|
16
|
+
$(() => {
|
17
|
+
updateTime();
|
18
|
+
setInterval(updateTime, 1000);
|
19
|
+
});
|
data/assets/index.xsl
CHANGED
@@ -141,7 +141,17 @@
|
|
141
141
|
</tbody>
|
142
142
|
</table>
|
143
143
|
</xsl:template>
|
144
|
-
<xsl:template match="f">
|
144
|
+
<xsl:template match="f[not(*)]">
|
145
|
+
<tr>
|
146
|
+
<td class="empty">
|
147
|
+
<xsl:attribute name="colspan">
|
148
|
+
<xsl:value-of select="string-length($columns) - string-length(translate($columns, ',', '')) + 2"/>
|
149
|
+
</xsl:attribute>
|
150
|
+
<xsl:text>nothing</xsl:text>
|
151
|
+
</td>
|
152
|
+
</tr>
|
153
|
+
</xsl:template>
|
154
|
+
<xsl:template match="f[*]">
|
145
155
|
<tr>
|
146
156
|
<xsl:call-template name="td">
|
147
157
|
<xsl:with-param name="cols" select="$columns"/>
|
data/features/test.feature
CHANGED
@@ -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.
|
19
|
+
When I run bin/judges with "--factbase 0.10.0 --verbose test --judge guess ./fixtures"
|
20
20
|
Then Exit code is zero
|
21
|
-
And Stdout contains "Factbase version to be used: '0.
|
21
|
+
And Stdout contains "Factbase version to be used: '0.10.0'"
|
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/features/update.feature
CHANGED
@@ -18,6 +18,18 @@ Feature: Update
|
|
18
18
|
Then Stdout contains "Update finished in 3 cycle(s), did 3i/0d/3a"
|
19
19
|
And Exit code is zero
|
20
20
|
|
21
|
+
Scenario: Generate a summary fact, with errors
|
22
|
+
Given I make a temp directory
|
23
|
+
Then I have a "buggy/buggy.rb" file with content:
|
24
|
+
"""
|
25
|
+
this is a bug
|
26
|
+
"""
|
27
|
+
Then I run bin/judges with "update --quiet --summary --max-cycles 1 . simple.fb"
|
28
|
+
Then Exit code is zero
|
29
|
+
Then I run bin/judges with "inspect simple.fb"
|
30
|
+
Then Stdout contains "Facts: 1"
|
31
|
+
And Exit code is zero
|
32
|
+
|
21
33
|
Scenario: Skips the judge on lifetime running out
|
22
34
|
Given I make a temp directory
|
23
35
|
Then I have a "simple/simple.rb" file with content:
|
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.40.0'
|
13
13
|
s.license = 'MIT'
|
14
14
|
s.summary = 'Command-Line Tool for a Factbase'
|
15
15
|
s.description =
|
@@ -8,6 +8,7 @@ require 'elapsed'
|
|
8
8
|
require 'factbase'
|
9
9
|
require 'fileutils'
|
10
10
|
require 'nokogiri'
|
11
|
+
require 'retries'
|
11
12
|
require 'time'
|
12
13
|
require 'typhoeus'
|
13
14
|
require_relative '../../judges'
|
@@ -92,11 +93,15 @@ class Judges::Print
|
|
92
93
|
end
|
93
94
|
|
94
95
|
def sha384(asset)
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
96
|
+
with_retries do
|
97
|
+
url = "https://yegor256.github.io/judges/assets/#{asset}"
|
98
|
+
http = Typhoeus::Request.get(url)
|
99
|
+
return "Timeout at #{url.inspect}" if http.timed_out?
|
100
|
+
raise "Failed to load #{url.inspect}" unless http.code == 200
|
101
|
+
sha = Base64.strict_encode64(Digest::SHA256.digest(http.body))
|
102
|
+
"sha256-#{sha}"
|
103
|
+
rescue RuntimeError => e
|
104
|
+
e.message
|
105
|
+
end
|
101
106
|
end
|
102
107
|
end
|
@@ -84,22 +84,49 @@ class Judges::Update
|
|
84
84
|
throw :"Update finished in #{c} cycle(s), did #{churn}"
|
85
85
|
end
|
86
86
|
return unless opts['summary']
|
87
|
-
fb
|
88
|
-
f = fb.insert
|
89
|
-
f.what = 'judges-summary'
|
90
|
-
f.when = Time.now
|
91
|
-
f.version = Judges::VERSION
|
92
|
-
f.seconds = Time.now - start
|
93
|
-
f.cycles = c
|
94
|
-
f.inserted = churn.inserted.size
|
95
|
-
f.deleted = churn.deleted.size
|
96
|
-
f.added = churn.added.size
|
97
|
-
errors.each { |e| f.error = e }
|
87
|
+
summarize(fb, churn, errors, start, c)
|
98
88
|
impex.export(fb)
|
99
89
|
end
|
100
90
|
|
101
91
|
private
|
102
92
|
|
93
|
+
# Update the summary.
|
94
|
+
# @param [Factbase] fb The factbase
|
95
|
+
# @param [Churn] churn The churn
|
96
|
+
# @param [Array<String>] errors List of errors
|
97
|
+
# @param [Time] start Whe we started
|
98
|
+
# @param [Integer] cycles How many cycles
|
99
|
+
def summarize(fb, churn, errors, start, cycles)
|
100
|
+
before = fb.query('(eq what "judges-summary")').each.to_a
|
101
|
+
if before.empty?
|
102
|
+
@loog.info('A summary not found')
|
103
|
+
s = fb.insert
|
104
|
+
s.what = 'judges-summary'
|
105
|
+
s.when = Time.now
|
106
|
+
s.version = Judges::VERSION
|
107
|
+
s.seconds = Time.now - start
|
108
|
+
s.cycles = cycles
|
109
|
+
s.inserted = churn.inserted.size
|
110
|
+
s.deleted = churn.deleted.size
|
111
|
+
s.added = churn.added.size
|
112
|
+
else
|
113
|
+
s = before.first
|
114
|
+
errs = s['errors']&.size || 0
|
115
|
+
@loog.info(
|
116
|
+
"A summary found, with #{errs || 'no'} error#{'s' if errs > 1}: " \
|
117
|
+
"#{%w[when cycles version inserted deleted added].map { |a| "#{a}=#{s[a]&.first}" }.join(', ')}"
|
118
|
+
)
|
119
|
+
end
|
120
|
+
f =
|
121
|
+
s
|
122
|
+
if errors.empty?
|
123
|
+
@loog.info('No errors added to the summary')
|
124
|
+
else
|
125
|
+
errors.each { |e| f.error = e }
|
126
|
+
@loog.info("#{errors.size} error#{'s' if errors.size > 1} added to the summary")
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
103
130
|
# Run all judges in a full cycle, one by one.
|
104
131
|
#
|
105
132
|
# @param [Hash] opts The command line options
|
data/lib/judges.rb
CHANGED