judges 0.25.2 → 0.26.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -2
- data/Gemfile.lock +23 -14
- data/assets/index.xsl +7 -7
- data/features/join.feature +2 -2
- data/judges.gemspec +10 -9
- data/lib/judges/commands/eval.rb +2 -2
- data/lib/judges/commands/import.rb +2 -2
- data/lib/judges/commands/join.rb +2 -2
- data/lib/judges/commands/print.rb +3 -3
- data/lib/judges/commands/pull.rb +2 -1
- data/lib/judges/commands/push.rb +2 -1
- data/lib/judges/commands/test.rb +2 -2
- data/lib/judges/commands/trim.rb +2 -2
- data/lib/judges/commands/update.rb +4 -4
- data/lib/judges/impex.rb +4 -4
- data/lib/judges/judge.rb +2 -2
- data/lib/judges.rb +1 -1
- data/test/commands/test_join.rb +3 -1
- data/test/commands/test_print.rb +18 -0
- metadata +32 -19
- data/lib/judges/elapsed.rb +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7ddc9ee179c24bb4b9fb1fe4c1447bbc3bafe6efa533565aae29e310bb08efa
|
4
|
+
data.tar.gz: '084241cc86f8cbd93ff5fb83402ea7ebfb794e2ba303bbabbae6483185988908'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e4731457f4cf139056b1ff8bdc553d56d7f8344a5f9b076a2bfe91ab2da6234135b8967cb2dad34d3858477abb9eebfa791399876a0d030f08abc184417fb35
|
7
|
+
data.tar.gz: 4c1f6d824ca49f9374aef2a4bbb9bb4d585e7cc53d0458864110b6f7a99956df8d8ff1814e6a7e996b2b413b189913a41cdd88006ea404438cbbef0ee47529b2
|
data/Gemfile
CHANGED
@@ -24,16 +24,17 @@ source 'https://rubygems.org'
|
|
24
24
|
gemspec
|
25
25
|
|
26
26
|
gem 'cucumber', '9.2.0', require: false
|
27
|
-
gem 'minitest', '5.
|
27
|
+
gem 'minitest', '5.25.1', require: false
|
28
28
|
gem 'minitest-reporters', '1.7.1', require: false
|
29
29
|
gem 'net-ping', '2.0.8', require: false
|
30
30
|
gem 'rake', '13.2.1', require: false
|
31
31
|
gem 'random-port', '~>0.0', require: false
|
32
|
-
gem 'rspec-rails', '6.1.
|
32
|
+
gem 'rspec-rails', '6.1.4', require: false
|
33
33
|
gem 'rubocop', '1.65.1', require: false
|
34
34
|
gem 'rubocop-performance', '1.21.1', require: false
|
35
35
|
gem 'rubocop-rspec', '3.0.4', require: false
|
36
36
|
gem 'simplecov', '0.22.0', require: false
|
37
37
|
gem 'simplecov-cobertura', '2.1.0', require: false
|
38
|
+
gem 'w3c_validators', '1.3.7', require: false
|
38
39
|
gem 'webmock', '3.23.1', require: false
|
39
40
|
gem 'yard', '0.9.36', require: false
|
data/Gemfile.lock
CHANGED
@@ -2,18 +2,19 @@ PATH
|
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
4
|
judges (0.0.0)
|
5
|
-
backtrace (
|
6
|
-
baza.rb (
|
5
|
+
backtrace (> 0)
|
6
|
+
baza.rb (> 0)
|
7
7
|
concurrent-ruby (~> 1.2)
|
8
|
-
|
8
|
+
elapsed (> 0)
|
9
|
+
factbase (> 0)
|
9
10
|
gli (~> 2.21)
|
10
|
-
iri (
|
11
|
-
loog (
|
11
|
+
iri (> 0)
|
12
|
+
loog (> 0)
|
12
13
|
moments (~> 0.3)
|
13
14
|
nokogiri (~> 1.10)
|
14
|
-
others (
|
15
|
-
retries (
|
16
|
-
tago (
|
15
|
+
others (> 0)
|
16
|
+
retries (> 0)
|
17
|
+
tago (> 0)
|
17
18
|
typhoeus (~> 1.3)
|
18
19
|
|
19
20
|
GEM
|
@@ -53,7 +54,7 @@ GEM
|
|
53
54
|
ast (2.4.2)
|
54
55
|
backtrace (0.4.0)
|
55
56
|
base64 (0.2.0)
|
56
|
-
baza.rb (0.0.
|
57
|
+
baza.rb (0.0.7)
|
57
58
|
backtrace (> 0)
|
58
59
|
faraday (> 0)
|
59
60
|
faraday-http-cache (> 0)
|
@@ -101,6 +102,9 @@ GEM
|
|
101
102
|
diff-lcs (1.5.1)
|
102
103
|
docile (1.4.1)
|
103
104
|
drb (2.2.1)
|
105
|
+
elapsed (0.0.1)
|
106
|
+
loog (> 0)
|
107
|
+
tago (> 0)
|
104
108
|
erubi (1.13.0)
|
105
109
|
ethon (0.16.0)
|
106
110
|
ffi (>= 1.15.0)
|
@@ -148,7 +152,7 @@ GEM
|
|
148
152
|
nokogiri (>= 1.12.0)
|
149
153
|
loog (0.6.0)
|
150
154
|
mini_mime (1.1.5)
|
151
|
-
minitest (5.
|
155
|
+
minitest (5.25.1)
|
152
156
|
minitest-reporters (1.7.1)
|
153
157
|
ansi
|
154
158
|
builder
|
@@ -175,7 +179,7 @@ GEM
|
|
175
179
|
nokogiri (1.16.7-x86_64-linux)
|
176
180
|
racc (~> 1.4)
|
177
181
|
others (0.0.3)
|
178
|
-
parallel (1.26.
|
182
|
+
parallel (1.26.3)
|
179
183
|
parser (3.3.4.2)
|
180
184
|
ast (~> 2.4.1)
|
181
185
|
racc
|
@@ -225,7 +229,7 @@ GEM
|
|
225
229
|
rspec-mocks (3.13.1)
|
226
230
|
diff-lcs (>= 1.2.0, < 2.0)
|
227
231
|
rspec-support (~> 3.13.0)
|
228
|
-
rspec-rails (6.1.
|
232
|
+
rspec-rails (6.1.4)
|
229
233
|
actionpack (>= 6.1)
|
230
234
|
activesupport (>= 6.1)
|
231
235
|
railties (>= 6.1)
|
@@ -276,6 +280,10 @@ GEM
|
|
276
280
|
unicode-display_width (2.5.0)
|
277
281
|
uri (0.13.0)
|
278
282
|
useragent (0.16.10)
|
283
|
+
w3c_validators (1.3.7)
|
284
|
+
json (>= 1.8)
|
285
|
+
nokogiri (~> 1.6)
|
286
|
+
rexml (~> 3.2)
|
279
287
|
webmock (3.23.1)
|
280
288
|
addressable (>= 2.8.0)
|
281
289
|
crack (>= 0.3.2)
|
@@ -297,17 +305,18 @@ PLATFORMS
|
|
297
305
|
DEPENDENCIES
|
298
306
|
cucumber (= 9.2.0)
|
299
307
|
judges!
|
300
|
-
minitest (= 5.
|
308
|
+
minitest (= 5.25.1)
|
301
309
|
minitest-reporters (= 1.7.1)
|
302
310
|
net-ping (= 2.0.8)
|
303
311
|
rake (= 13.2.1)
|
304
312
|
random-port (~> 0.0)
|
305
|
-
rspec-rails (= 6.1.
|
313
|
+
rspec-rails (= 6.1.4)
|
306
314
|
rubocop (= 1.65.1)
|
307
315
|
rubocop-performance (= 1.21.1)
|
308
316
|
rubocop-rspec (= 3.0.4)
|
309
317
|
simplecov (= 0.22.0)
|
310
318
|
simplecov-cobertura (= 2.1.0)
|
319
|
+
w3c_validators (= 1.3.7)
|
311
320
|
webmock (= 3.23.1)
|
312
321
|
yard (= 0.9.36)
|
313
322
|
|
data/assets/index.xsl
CHANGED
@@ -23,7 +23,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
23
|
SOFTWARE.
|
24
24
|
-->
|
25
25
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
26
|
-
<xsl:output method="xml"
|
26
|
+
<xsl:output method="xml" omit-xml-declaration="yes" encoding="UTF-8" indent="yes"/>
|
27
27
|
<xsl:param name="title"/>
|
28
28
|
<xsl:param name="date"/>
|
29
29
|
<xsl:param name="version"/>
|
@@ -36,9 +36,11 @@ SOFTWARE.
|
|
36
36
|
</script>
|
37
37
|
</xsl:template>
|
38
38
|
<xsl:template match="/">
|
39
|
+
<xsl:text disable-output-escaping='yes'><!DOCTYPE html></xsl:text>
|
39
40
|
<html>
|
40
41
|
<head>
|
41
|
-
<meta
|
42
|
+
<meta charset="UTF-8"/>
|
43
|
+
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
|
42
44
|
<title>
|
43
45
|
<xsl:choose>
|
44
46
|
<xsl:when test="$title = ''">
|
@@ -49,8 +51,6 @@ SOFTWARE.
|
|
49
51
|
</xsl:otherwise>
|
50
52
|
</xsl:choose>
|
51
53
|
</title>
|
52
|
-
<meta charset="UTF-8"/>
|
53
|
-
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
|
54
54
|
<link rel="icon" href="https://www.zerocracy.com/svg/logo.svg" type="image/svg"/>
|
55
55
|
<link href="https://cdn.jsdelivr.net/gh/yegor256/tacit@gh-pages/tacit-css.min.css" rel="stylesheet"/>
|
56
56
|
<link href="https://cdn.jsdelivr.net/gh/yegor256/drops@gh-pages/drops.min.css" rel="stylesheet"/>
|
@@ -143,7 +143,7 @@ SOFTWARE.
|
|
143
143
|
<xsl:call-template name="th">
|
144
144
|
<xsl:with-param name="cols" select="$columns"/>
|
145
145
|
</xsl:call-template>
|
146
|
-
</
|
146
|
+
</tr>
|
147
147
|
</thead>
|
148
148
|
<tbody>
|
149
149
|
<xsl:apply-templates select="f"/>
|
@@ -185,7 +185,7 @@ SOFTWARE.
|
|
185
185
|
</xsl:when>
|
186
186
|
<xsl:otherwise>
|
187
187
|
<th>
|
188
|
-
<xsl:text
|
188
|
+
<xsl:text> </xsl:text>
|
189
189
|
</th>
|
190
190
|
</xsl:otherwise>
|
191
191
|
</xsl:choose>
|
@@ -259,4 +259,4 @@ SOFTWARE.
|
|
259
259
|
</xsl:otherwise>
|
260
260
|
</xsl:choose>
|
261
261
|
</xsl:template>
|
262
|
-
</xsl:stylesheet>
|
262
|
+
</xsl:stylesheet>
|
data/features/join.feature
CHANGED
@@ -8,5 +8,5 @@ Feature: Join
|
|
8
8
|
Then I run bin/judges with "update . first.fb"
|
9
9
|
Then I run bin/judges with "update . second.fb"
|
10
10
|
Then I run bin/judges with "join first.fb second.fb"
|
11
|
-
Then
|
12
|
-
And
|
11
|
+
Then Exit code is zero
|
12
|
+
And Stdout contains "joined"
|
data/judges.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
27
27
|
s.required_ruby_version = '>=3.2'
|
28
28
|
s.name = 'judges'
|
29
|
-
s.version = '0.
|
29
|
+
s.version = '0.26.0'
|
30
30
|
s.license = 'MIT'
|
31
31
|
s.summary = 'Command-Line Tool for a Factbase'
|
32
32
|
s.description =
|
@@ -42,18 +42,19 @@ Gem::Specification.new do |s|
|
|
42
42
|
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
43
43
|
s.rdoc_options = ['--charset=UTF-8']
|
44
44
|
s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
|
45
|
-
s.add_dependency 'backtrace', '
|
46
|
-
s.add_dependency 'baza.rb', '
|
45
|
+
s.add_dependency 'backtrace', '>0'
|
46
|
+
s.add_dependency 'baza.rb', '>0'
|
47
47
|
s.add_dependency 'concurrent-ruby', '~>1.2'
|
48
|
-
s.add_dependency '
|
48
|
+
s.add_dependency 'elapsed', '>0'
|
49
|
+
s.add_dependency 'factbase', '>0'
|
49
50
|
s.add_dependency 'gli', '~>2.21'
|
50
|
-
s.add_dependency 'iri', '
|
51
|
-
s.add_dependency 'loog', '
|
51
|
+
s.add_dependency 'iri', '>0'
|
52
|
+
s.add_dependency 'loog', '>0'
|
52
53
|
s.add_dependency 'moments', '~>0.3'
|
53
54
|
s.add_dependency 'nokogiri', '~>1.10'
|
54
|
-
s.add_dependency 'others', '
|
55
|
-
s.add_dependency 'retries', '
|
56
|
-
s.add_dependency 'tago', '
|
55
|
+
s.add_dependency 'others', '>0'
|
56
|
+
s.add_dependency 'retries', '>0'
|
57
|
+
s.add_dependency 'tago', '>0'
|
57
58
|
s.add_dependency 'typhoeus', '~>1.3'
|
58
59
|
s.metadata['rubygems_mfa_required'] = 'true'
|
59
60
|
end
|
data/lib/judges/commands/eval.rb
CHANGED
@@ -20,10 +20,10 @@
|
|
20
20
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
21
|
# SOFTWARE.
|
22
22
|
|
23
|
+
require 'elapsed'
|
23
24
|
require 'factbase/looged'
|
24
25
|
require_relative '../../judges'
|
25
26
|
require_relative '../../judges/impex'
|
26
|
-
require_relative '../../judges/elapsed'
|
27
27
|
|
28
28
|
# The +eval+ command.
|
29
29
|
#
|
@@ -41,7 +41,7 @@ class Judges::Eval
|
|
41
41
|
def run(_opts, args)
|
42
42
|
raise 'Exactly two arguments required' unless args.size == 2
|
43
43
|
impex = Judges::Impex.new(@loog, args[0])
|
44
|
-
elapsed(@loog) do
|
44
|
+
elapsed(@loog, level: Logger::INFO) do
|
45
45
|
$fb = impex.import(strict: false)
|
46
46
|
$fb = Factbase::Looged.new($fb, @loog)
|
47
47
|
expr = args[1]
|
@@ -20,12 +20,12 @@
|
|
20
20
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
21
|
# SOFTWARE.
|
22
22
|
|
23
|
+
require 'elapsed'
|
23
24
|
require 'time'
|
24
25
|
require 'factbase/looged'
|
25
26
|
require_relative '../../judges'
|
26
27
|
require_relative '../../judges/impex'
|
27
28
|
require_relative '../../judges/to_rel'
|
28
|
-
require_relative '../../judges/elapsed'
|
29
29
|
|
30
30
|
# The +import+ command.
|
31
31
|
#
|
@@ -43,7 +43,7 @@ class Judges::Import
|
|
43
43
|
def run(_opts, args)
|
44
44
|
raise 'Exactly two arguments required' unless args.size == 2
|
45
45
|
raise "File not found #{args[0].to_rel}" unless File.exist?(args[0])
|
46
|
-
elapsed(@loog) do
|
46
|
+
elapsed(@loog, level: Logger::INFO) do
|
47
47
|
yaml = YAML.load_file(args[0], permitted_classes: [Time])
|
48
48
|
@loog.info("YAML loaded from #{args[0].to_rel} (#{yaml.size} facts)")
|
49
49
|
impex = Judges::Impex.new(@loog, args[1])
|
data/lib/judges/commands/join.rb
CHANGED
@@ -20,9 +20,9 @@
|
|
20
20
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
21
|
# SOFTWARE.
|
22
22
|
|
23
|
+
require 'elapsed'
|
23
24
|
require_relative '../../judges'
|
24
25
|
require_relative '../../judges/impex'
|
25
|
-
require_relative '../../judges/elapsed'
|
26
26
|
|
27
27
|
# The +join+ command.
|
28
28
|
#
|
@@ -41,7 +41,7 @@ class Judges::Join
|
|
41
41
|
raise 'Exactly two arguments required' unless args.size == 2
|
42
42
|
master = Judges::Impex.new(@loog, args[0])
|
43
43
|
slave = Judges::Impex.new(@loog, args[1])
|
44
|
-
elapsed(@loog) do
|
44
|
+
elapsed(@loog, level: Logger::INFO) do
|
45
45
|
fb = master.import
|
46
46
|
slave.import_to(fb)
|
47
47
|
master.export(fb)
|
@@ -24,9 +24,9 @@ require 'time'
|
|
24
24
|
require 'fileutils'
|
25
25
|
require 'factbase'
|
26
26
|
require 'nokogiri'
|
27
|
+
require 'elapsed'
|
27
28
|
require_relative '../../judges'
|
28
29
|
require_relative '../../judges/impex'
|
29
|
-
require_relative '../../judges/elapsed'
|
30
30
|
|
31
31
|
# The +print+ command.
|
32
32
|
#
|
@@ -64,7 +64,7 @@ class Judges::Print
|
|
64
64
|
end
|
65
65
|
@loog.debug("The factbase #{f.to_rel} is younger than the target #{o.to_rel}, need to print")
|
66
66
|
end
|
67
|
-
elapsed(@loog) do
|
67
|
+
elapsed(@loog, level: Logger::INFO) do
|
68
68
|
output =
|
69
69
|
case fmt
|
70
70
|
when 'yaml'
|
@@ -92,7 +92,7 @@ class Judges::Print
|
|
92
92
|
xslt = Nokogiri::XSLT(File.read(File.join(__dir__, '../../../assets/index.xsl')))
|
93
93
|
require 'factbase/to_xml'
|
94
94
|
xml = Factbase::ToXML.new(fb).xml
|
95
|
-
xslt.
|
95
|
+
xslt.apply_to(
|
96
96
|
Nokogiri::XML(xml),
|
97
97
|
Nokogiri::XSLT.quote_params(
|
98
98
|
'title' => opts['title'],
|
data/lib/judges/commands/pull.rb
CHANGED
@@ -23,6 +23,7 @@
|
|
23
23
|
require 'typhoeus'
|
24
24
|
require 'iri'
|
25
25
|
require 'baza-rb'
|
26
|
+
require 'elapsed'
|
26
27
|
require_relative '../../judges'
|
27
28
|
require_relative '../../judges/impex'
|
28
29
|
|
@@ -53,7 +54,7 @@ class Judges::Pull
|
|
53
54
|
retries: (opts['retries'] || 3).to_i
|
54
55
|
)
|
55
56
|
name = args[0]
|
56
|
-
elapsed(@loog) do
|
57
|
+
elapsed(@loog, level: Logger::INFO) do
|
57
58
|
if baza.name_exists?(name)
|
58
59
|
baza.lock(name, opts['owner'])
|
59
60
|
begin
|
data/lib/judges/commands/push.rb
CHANGED
@@ -23,6 +23,7 @@
|
|
23
23
|
require 'typhoeus'
|
24
24
|
require 'iri'
|
25
25
|
require 'baza-rb'
|
26
|
+
require 'elapsed'
|
26
27
|
require_relative '../../judges'
|
27
28
|
require_relative '../../judges/impex'
|
28
29
|
|
@@ -54,7 +55,7 @@ class Judges::Push
|
|
54
55
|
retries: (opts['retries'] || 3).to_i,
|
55
56
|
compression: opts.fetch('zip', true)
|
56
57
|
)
|
57
|
-
elapsed(@loog) do
|
58
|
+
elapsed(@loog, level: Logger::INFO) do
|
58
59
|
baza.lock(name, opts['owner'])
|
59
60
|
begin
|
60
61
|
id = baza.push(name, fb.export, opts['meta'] || [])
|
data/lib/judges/commands/test.rb
CHANGED
@@ -25,12 +25,12 @@ require 'factbase'
|
|
25
25
|
require 'backtrace'
|
26
26
|
require 'factbase/looged'
|
27
27
|
require 'factbase/to_xml'
|
28
|
+
require 'elapsed'
|
28
29
|
require_relative '../../judges'
|
29
30
|
require_relative '../../judges/to_rel'
|
30
31
|
require_relative '../../judges/judges'
|
31
32
|
require_relative '../../judges/options'
|
32
33
|
require_relative '../../judges/categories'
|
33
|
-
require_relative '../../judges/elapsed'
|
34
34
|
|
35
35
|
# The +test+ command.
|
36
36
|
#
|
@@ -57,7 +57,7 @@ class Judges::Test
|
|
57
57
|
tests = 0
|
58
58
|
visible = []
|
59
59
|
judges = Judges::Judges.new(dir, opts['lib'], @loog)
|
60
|
-
elapsed(@loog) do
|
60
|
+
elapsed(@loog, level: Logger::INFO) do
|
61
61
|
judges.each_with_index do |judge, i|
|
62
62
|
visible << judge.name
|
63
63
|
next unless include?(opts, judge.name)
|
data/lib/judges/commands/trim.rb
CHANGED
@@ -21,9 +21,9 @@
|
|
21
21
|
# SOFTWARE.
|
22
22
|
|
23
23
|
require 'time'
|
24
|
+
require 'elapsed'
|
24
25
|
require_relative '../../judges'
|
25
26
|
require_relative '../../judges/impex'
|
26
|
-
require_relative '../../judges/elapsed'
|
27
27
|
|
28
28
|
# The +trim+ command.
|
29
29
|
#
|
@@ -45,7 +45,7 @@ class Judges::Trim
|
|
45
45
|
raise 'Exactly one argument required' unless args.size == 1
|
46
46
|
impex = Judges::Impex.new(@loog, args[0])
|
47
47
|
fb = impex.import
|
48
|
-
elapsed(@loog) do
|
48
|
+
elapsed(@loog, level: Logger::INFO) do
|
49
49
|
deleted = fb.query(opts['query']).delete!
|
50
50
|
throw :'No facts deleted' if deleted.zero?
|
51
51
|
impex.export(fb)
|
@@ -22,13 +22,13 @@
|
|
22
22
|
|
23
23
|
require 'backtrace'
|
24
24
|
require 'factbase/looged'
|
25
|
+
require 'elapsed'
|
25
26
|
require_relative '../../judges'
|
26
27
|
require_relative '../../judges/to_rel'
|
27
28
|
require_relative '../../judges/judges'
|
28
29
|
require_relative '../../judges/churn'
|
29
30
|
require_relative '../../judges/options'
|
30
31
|
require_relative '../../judges/impex'
|
31
|
-
require_relative '../../judges/elapsed'
|
32
32
|
|
33
33
|
# The +update+ command.
|
34
34
|
#
|
@@ -63,7 +63,7 @@ class Judges::Update
|
|
63
63
|
judges = Judges::Judges.new(dir, opts['lib'], @loog)
|
64
64
|
c = 0
|
65
65
|
churn = Judges::Churn.new(0, 0)
|
66
|
-
elapsed(@loog) do
|
66
|
+
elapsed(@loog, level: Logger::INFO) do
|
67
67
|
loop do
|
68
68
|
c += 1
|
69
69
|
if c > 1
|
@@ -105,11 +105,11 @@ class Judges::Update
|
|
105
105
|
def cycle(opts, judges, fb, options)
|
106
106
|
churn = Judges::Churn.new(0, 0)
|
107
107
|
global = {}
|
108
|
-
elapsed(@loog) do
|
108
|
+
elapsed(@loog, level: Logger::INFO) do
|
109
109
|
done =
|
110
110
|
judges.each_with_index do |p, i|
|
111
111
|
@loog.info("\n👉 Running #{p.name} (##{i}) at #{p.dir.to_rel}...")
|
112
|
-
elapsed(@loog) do
|
112
|
+
elapsed(@loog, level: Logger::INFO) do
|
113
113
|
c = one_judge(fb, p, global, options)
|
114
114
|
churn += c
|
115
115
|
throw :"👍 The judge #{p.name} modified #{c} facts out of #{fb.size}"
|
data/lib/judges/impex.rb
CHANGED
@@ -22,9 +22,9 @@
|
|
22
22
|
|
23
23
|
require 'factbase'
|
24
24
|
require 'fileutils'
|
25
|
+
require 'elapsed'
|
25
26
|
require_relative '../judges'
|
26
27
|
require_relative '../judges/to_rel'
|
27
|
-
require_relative '../judges/elapsed'
|
28
28
|
|
29
29
|
# Import/Export of factbases.
|
30
30
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
@@ -39,7 +39,7 @@ class Judges::Impex
|
|
39
39
|
def import(strict: true)
|
40
40
|
fb = Factbase.new
|
41
41
|
if File.exist?(@file)
|
42
|
-
elapsed(@loog) do
|
42
|
+
elapsed(@loog, level: Logger::INFO) do
|
43
43
|
fb.import(File.binread(@file))
|
44
44
|
throw :"The factbase imported from #{@file.to_rel} (#{File.size(@file)} bytes, #{fb.size} facts)"
|
45
45
|
end
|
@@ -52,14 +52,14 @@ class Judges::Impex
|
|
52
52
|
|
53
53
|
def import_to(fb)
|
54
54
|
raise "The factbase is absent at #{@file.to_rel}" unless File.exist?(@file)
|
55
|
-
elapsed(@loog) do
|
55
|
+
elapsed(@loog, level: Logger::INFO) do
|
56
56
|
fb.import(File.binread(@file))
|
57
57
|
throw :"The factbase loaded from #{@file.to_rel} (#{File.size(@file)} bytes, #{fb.size} facts)"
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
61
|
def export(fb)
|
62
|
-
elapsed(@loog) do
|
62
|
+
elapsed(@loog, level: Logger::INFO) do
|
63
63
|
FileUtils.mkdir_p(File.dirname(@file))
|
64
64
|
File.binwrite(@file, fb.export)
|
65
65
|
throw :"Factbase exported to #{@file.to_rel} (#{File.size(@file)} bytes, #{fb.size} facts)"
|
data/lib/judges/judge.rb
CHANGED
@@ -20,9 +20,9 @@
|
|
20
20
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
21
|
# SOFTWARE.
|
22
22
|
|
23
|
+
require 'elapsed'
|
23
24
|
require_relative '../judges'
|
24
25
|
require_relative '../judges/to_rel'
|
25
|
-
require_relative '../judges/elapsed'
|
26
26
|
|
27
27
|
# A single judge.
|
28
28
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
@@ -56,7 +56,7 @@ class Judges::Judge
|
|
56
56
|
end
|
57
57
|
s = File.join(@dir, script)
|
58
58
|
raise "Can't load '#{s}'" unless File.exist?(s)
|
59
|
-
elapsed(@loog) do
|
59
|
+
elapsed(@loog, intro: "#{$judge} finished", level: Logger::INFO) do
|
60
60
|
load(s, true)
|
61
61
|
ensure
|
62
62
|
$fb = $judge = $options = $loog = nil
|
data/lib/judges.rb
CHANGED
data/test/commands/test_join.rb
CHANGED
@@ -42,12 +42,14 @@ class TestJoin < Minitest::Test
|
|
42
42
|
fb2 = Factbase.new
|
43
43
|
fb2.insert.foo_bar = 42
|
44
44
|
File.binwrite(slave, fb2.export)
|
45
|
-
|
45
|
+
loog = Loog::Buffer.new
|
46
|
+
Judges::Join.new(loog).run({}, [master, slave])
|
46
47
|
fb = Factbase.new
|
47
48
|
fb.import(File.binread(master))
|
48
49
|
xml = Nokogiri::XML.parse(Factbase::ToXML.new(fb).xml)
|
49
50
|
assert(!xml.xpath('/fb/f[zz="5"]').empty?, xml)
|
50
51
|
assert(!xml.xpath('/fb/f[foo_bar="42"]').empty?, xml)
|
52
|
+
assert(loog.to_s.include?('Two factbases joined'), loog.to_s)
|
51
53
|
end
|
52
54
|
end
|
53
55
|
end
|
data/test/commands/test_print.rb
CHANGED
@@ -23,9 +23,12 @@
|
|
23
23
|
require 'minitest/autorun'
|
24
24
|
require 'loog'
|
25
25
|
require 'factbase'
|
26
|
+
require 'nokogiri'
|
26
27
|
require 'yaml'
|
27
28
|
require 'fileutils'
|
28
29
|
require 'securerandom'
|
30
|
+
require 'w3c_validators'
|
31
|
+
require 'webmock/minitest'
|
29
32
|
require_relative '../../lib/judges'
|
30
33
|
require_relative '../../lib/judges/commands/print'
|
31
34
|
|
@@ -70,6 +73,21 @@ class TestPrint < Minitest::Test
|
|
70
73
|
[f, html]
|
71
74
|
)
|
72
75
|
end
|
76
|
+
doc = File.read(html)
|
77
|
+
xml =
|
78
|
+
begin
|
79
|
+
Nokogiri::XML.parse(doc) do |c|
|
80
|
+
c.norecover
|
81
|
+
c.strict
|
82
|
+
end
|
83
|
+
rescue StandardError => e
|
84
|
+
raise "#{doc}\n\n#{e}"
|
85
|
+
end
|
86
|
+
assert(xml.errors.empty?, xml)
|
87
|
+
assert(!xml.xpath('/html').empty?, xml)
|
88
|
+
WebMock.enable_net_connect!
|
89
|
+
v = W3CValidators::NuValidator.new.validate_file(html)
|
90
|
+
assert(v.errors.empty?, "#{doc}\n\n#{v.errors.join('; ')}")
|
73
91
|
end
|
74
92
|
|
75
93
|
def test_print_all_formats
|
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: judges
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.26.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: backtrace
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: baza.rb
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
@@ -52,18 +52,32 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: elapsed
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: factbase
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- - "
|
73
|
+
- - ">"
|
60
74
|
- !ruby/object:Gem::Version
|
61
75
|
version: '0'
|
62
76
|
type: :runtime
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- - "
|
80
|
+
- - ">"
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
@@ -84,28 +98,28 @@ dependencies:
|
|
84
98
|
name: iri
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
|
-
- - "
|
101
|
+
- - ">"
|
88
102
|
- !ruby/object:Gem::Version
|
89
103
|
version: '0'
|
90
104
|
type: :runtime
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
|
-
- - "
|
108
|
+
- - ">"
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: loog
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
|
-
- - "
|
115
|
+
- - ">"
|
102
116
|
- !ruby/object:Gem::Version
|
103
117
|
version: '0'
|
104
118
|
type: :runtime
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
|
-
- - "
|
122
|
+
- - ">"
|
109
123
|
- !ruby/object:Gem::Version
|
110
124
|
version: '0'
|
111
125
|
- !ruby/object:Gem::Dependency
|
@@ -140,42 +154,42 @@ dependencies:
|
|
140
154
|
name: others
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
142
156
|
requirements:
|
143
|
-
- - "
|
157
|
+
- - ">"
|
144
158
|
- !ruby/object:Gem::Version
|
145
159
|
version: '0'
|
146
160
|
type: :runtime
|
147
161
|
prerelease: false
|
148
162
|
version_requirements: !ruby/object:Gem::Requirement
|
149
163
|
requirements:
|
150
|
-
- - "
|
164
|
+
- - ">"
|
151
165
|
- !ruby/object:Gem::Version
|
152
166
|
version: '0'
|
153
167
|
- !ruby/object:Gem::Dependency
|
154
168
|
name: retries
|
155
169
|
requirement: !ruby/object:Gem::Requirement
|
156
170
|
requirements:
|
157
|
-
- - "
|
171
|
+
- - ">"
|
158
172
|
- !ruby/object:Gem::Version
|
159
173
|
version: '0'
|
160
174
|
type: :runtime
|
161
175
|
prerelease: false
|
162
176
|
version_requirements: !ruby/object:Gem::Requirement
|
163
177
|
requirements:
|
164
|
-
- - "
|
178
|
+
- - ">"
|
165
179
|
- !ruby/object:Gem::Version
|
166
180
|
version: '0'
|
167
181
|
- !ruby/object:Gem::Dependency
|
168
182
|
name: tago
|
169
183
|
requirement: !ruby/object:Gem::Requirement
|
170
184
|
requirements:
|
171
|
-
- - "
|
185
|
+
- - ">"
|
172
186
|
- !ruby/object:Gem::Version
|
173
187
|
version: '0'
|
174
188
|
type: :runtime
|
175
189
|
prerelease: false
|
176
190
|
version_requirements: !ruby/object:Gem::Requirement
|
177
191
|
requirements:
|
178
|
-
- - "
|
192
|
+
- - ">"
|
179
193
|
- !ruby/object:Gem::Version
|
180
194
|
version: '0'
|
181
195
|
- !ruby/object:Gem::Dependency
|
@@ -257,7 +271,6 @@ files:
|
|
257
271
|
- lib/judges/commands/test.rb
|
258
272
|
- lib/judges/commands/trim.rb
|
259
273
|
- lib/judges/commands/update.rb
|
260
|
-
- lib/judges/elapsed.rb
|
261
274
|
- lib/judges/impex.rb
|
262
275
|
- lib/judges/judge.rb
|
263
276
|
- lib/judges/judges.rb
|
data/lib/judges/elapsed.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright (c) 2024 Yegor Bugayenko
|
4
|
-
#
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
10
|
-
# furnished to do so, subject to the following conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
13
|
-
# copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
# SOFTWARE.
|
22
|
-
|
23
|
-
require 'tago'
|
24
|
-
|
25
|
-
def elapsed(loog)
|
26
|
-
start = Time.now
|
27
|
-
begin
|
28
|
-
yield
|
29
|
-
rescue UncaughtThrowError => e
|
30
|
-
tag = e.tag
|
31
|
-
throw e unless tag.is_a?(Symbol)
|
32
|
-
loog.info("#{tag} in #{start.ago}")
|
33
|
-
end
|
34
|
-
end
|