judges 0.7.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +1 -1
- data/Gemfile +1 -1
- data/Gemfile.lock +16 -20
- data/bin/judges +5 -0
- data/features/update.feature +1 -1
- data/judges.gemspec +3 -1
- data/lib/judges/commands/test.rb +3 -1
- data/lib/judges/commands/update.rb +8 -7
- data/lib/judges/elapsed.rb +3 -1
- data/lib/judges.rb +1 -1
- data/test/commands/test_print.rb +1 -1
- metadata +30 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29aaf4f403a8df4007afa115bfbf0afd09f42ab8ad493536599944e84ed2b82e
|
4
|
+
data.tar.gz: 5c5dc615c168c150c908589f0f775144d4117003129a07515dd252f2ba622c22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 642b71de17e43f5000b052dca656a3d374288f021f3fc1e7b75a7a095a50c9084ff3874e9c03bc954df8feb9eeac5482d5aaab35b869db6e879d2204a30e6427
|
7
|
+
data.tar.gz: 146de657cb25b3e5ab88cf2444b6876c2dabc3be82eba3525a3c4115ede82dc366da5a51c6e9c32ea97aa3af57e6aab514756033d9e1cd3f9ad28b7ad23f99f9
|
data/.github/workflows/rake.yml
CHANGED
data/Gemfile
CHANGED
@@ -30,7 +30,7 @@ gem 'rake', '13.2.1', require: false
|
|
30
30
|
gem 'rspec-rails', '6.1.2', require: false
|
31
31
|
gem 'rubocop', '1.64.1', require: false
|
32
32
|
gem 'rubocop-performance', '1.21.0', require: false
|
33
|
-
gem 'rubocop-rspec', '
|
33
|
+
gem 'rubocop-rspec', '3.0.1', require: false
|
34
34
|
gem 'simplecov', '0.22.0', require: false
|
35
35
|
gem 'simplecov-cobertura', '2.1.0', require: false
|
36
36
|
gem 'webmock', '3.23.1', require: false
|
data/Gemfile.lock
CHANGED
@@ -8,8 +8,10 @@ PATH
|
|
8
8
|
gli (~> 2.21)
|
9
9
|
iri (~> 0.8)
|
10
10
|
loog (~> 0.2)
|
11
|
+
moments (~> 0.3)
|
11
12
|
nokogiri (~> 1.10)
|
12
13
|
retries (~> 0.0)
|
14
|
+
tago (~> 0.0)
|
13
15
|
typhoeus (~> 1.3)
|
14
16
|
|
15
17
|
GEM
|
@@ -85,10 +87,11 @@ GEM
|
|
85
87
|
erubi (1.12.0)
|
86
88
|
ethon (0.16.0)
|
87
89
|
ffi (>= 1.15.0)
|
88
|
-
factbase (0.0.
|
90
|
+
factbase (0.0.50)
|
89
91
|
json (~> 2.7)
|
90
92
|
loog (~> 0.2)
|
91
93
|
nokogiri (~> 1.10)
|
94
|
+
tago (~> 0.0)
|
92
95
|
yaml (~> 0.3)
|
93
96
|
ffi (1.17.0-aarch64-linux-gnu)
|
94
97
|
ffi (1.17.0-arm-linux-gnu)
|
@@ -114,6 +117,7 @@ GEM
|
|
114
117
|
loog (0.5.1)
|
115
118
|
mini_mime (1.1.5)
|
116
119
|
minitest (5.23.1)
|
120
|
+
moments (0.3.0)
|
117
121
|
multi_test (1.1.0)
|
118
122
|
mutex_m (0.2.0)
|
119
123
|
net-ping (2.0.8)
|
@@ -131,15 +135,15 @@ GEM
|
|
131
135
|
racc (~> 1.4)
|
132
136
|
nokogiri (1.16.5-x86_64-linux)
|
133
137
|
racc (~> 1.4)
|
134
|
-
parallel (1.
|
135
|
-
parser (3.3.
|
138
|
+
parallel (1.25.1)
|
139
|
+
parser (3.3.3.0)
|
136
140
|
ast (~> 2.4.1)
|
137
141
|
racc
|
138
142
|
psych (5.1.2)
|
139
143
|
stringio
|
140
144
|
public_suffix (5.0.5)
|
141
145
|
racc (1.8.0)
|
142
|
-
rack (3.
|
146
|
+
rack (3.1.3)
|
143
147
|
rack-session (2.0.0)
|
144
148
|
rack (>= 3.0.0)
|
145
149
|
rack-test (2.1.0)
|
@@ -167,11 +171,11 @@ GEM
|
|
167
171
|
rdoc (6.7.0)
|
168
172
|
psych (>= 4.0.0)
|
169
173
|
regexp_parser (2.9.2)
|
170
|
-
reline (0.5.
|
174
|
+
reline (0.5.9)
|
171
175
|
io-console (~> 0.5)
|
172
176
|
retries (0.0.5)
|
173
|
-
rexml (3.
|
174
|
-
strscan
|
177
|
+
rexml (3.3.0)
|
178
|
+
strscan
|
175
179
|
rspec-core (3.13.0)
|
176
180
|
rspec-support (~> 3.13.0)
|
177
181
|
rspec-expectations (3.13.0)
|
@@ -202,20 +206,11 @@ GEM
|
|
202
206
|
unicode-display_width (>= 2.4.0, < 3.0)
|
203
207
|
rubocop-ast (1.31.3)
|
204
208
|
parser (>= 3.3.1.0)
|
205
|
-
rubocop-capybara (2.20.0)
|
206
|
-
rubocop (~> 1.41)
|
207
|
-
rubocop-factory_bot (2.25.1)
|
208
|
-
rubocop (~> 1.41)
|
209
209
|
rubocop-performance (1.21.0)
|
210
210
|
rubocop (>= 1.48.1, < 2.0)
|
211
211
|
rubocop-ast (>= 1.31.1, < 2.0)
|
212
|
-
rubocop-rspec (
|
213
|
-
rubocop (~> 1.
|
214
|
-
rubocop-capybara (~> 2.17)
|
215
|
-
rubocop-factory_bot (~> 2.22)
|
216
|
-
rubocop-rspec_rails (~> 2.28)
|
217
|
-
rubocop-rspec_rails (2.28.3)
|
218
|
-
rubocop (~> 1.40)
|
212
|
+
rubocop-rspec (3.0.1)
|
213
|
+
rubocop (~> 1.61)
|
219
214
|
ruby-progressbar (1.13.0)
|
220
215
|
simplecov (0.22.0)
|
221
216
|
docile (~> 1.1)
|
@@ -228,8 +223,9 @@ GEM
|
|
228
223
|
simplecov_json_formatter (0.1.4)
|
229
224
|
stringio (3.1.0)
|
230
225
|
strscan (3.1.0)
|
231
|
-
sys-uname (1.
|
226
|
+
sys-uname (1.3.0)
|
232
227
|
ffi (~> 1.1)
|
228
|
+
tago (0.0.2)
|
233
229
|
thor (1.3.1)
|
234
230
|
typhoeus (1.4.1)
|
235
231
|
ethon (>= 0.9.0)
|
@@ -263,7 +259,7 @@ DEPENDENCIES
|
|
263
259
|
rspec-rails (= 6.1.2)
|
264
260
|
rubocop (= 1.64.1)
|
265
261
|
rubocop-performance (= 1.21.0)
|
266
|
-
rubocop-rspec (=
|
262
|
+
rubocop-rspec (= 3.0.1)
|
267
263
|
simplecov (= 0.22.0)
|
268
264
|
simplecov-cobertura (= 2.1.0)
|
269
265
|
webmock (= 3.23.1)
|
data/bin/judges
CHANGED
@@ -51,6 +51,7 @@ class App
|
|
51
51
|
loog = Loog::VERBOSE
|
52
52
|
end
|
53
53
|
loog.debug("judges #{Judges::VERSION}")
|
54
|
+
loog.debug("facbase #{Factbase::VERSION}")
|
54
55
|
true
|
55
56
|
end
|
56
57
|
|
@@ -64,6 +65,8 @@ class App
|
|
64
65
|
c.flag([:'max-cycles'], default_value: 8, type: Integer)
|
65
66
|
c.desc 'Stay quiet even if some judges fail'
|
66
67
|
c.switch([:q, :quiet], default_value: false)
|
68
|
+
c.desc 'Use default logging facility'
|
69
|
+
c.switch([:log], default_value: true)
|
67
70
|
c.action do |global, options, args|
|
68
71
|
require_relative '../lib/judges/commands/update'
|
69
72
|
Judges::Update.new(loog).run(options, args)
|
@@ -144,6 +147,8 @@ class App
|
|
144
147
|
c.flag([:lib])
|
145
148
|
c.desc 'Stay quiet even if some tests fail or simply no tests executed?'
|
146
149
|
c.switch([:quiet], default_value: false)
|
150
|
+
c.desc 'Use default logging facility'
|
151
|
+
c.switch([:log], default_value: true)
|
147
152
|
c.action do |global, options, args|
|
148
153
|
require_relative '../lib/judges/commands/test'
|
149
154
|
Judges::Test.new(loog).run(options, args)
|
data/features/update.feature
CHANGED
@@ -12,7 +12,7 @@ Feature: Update
|
|
12
12
|
Then Stdout contains "foo → "
|
13
13
|
Then Stdout contains "bar → "
|
14
14
|
Then Stdout contains "1 judge(s) processed"
|
15
|
-
Then Stdout contains "Update finished in 3 cycle(s),
|
15
|
+
Then Stdout contains "Update finished in 3 cycle(s), modified 3/0 fact(s)"
|
16
16
|
And Exit code is zero
|
17
17
|
|
18
18
|
Scenario: Simple run of a few judges, with a lib
|
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.9.0'
|
30
30
|
s.license = 'MIT'
|
31
31
|
s.summary = 'Command-Line Tool for a Factbase'
|
32
32
|
s.description =
|
@@ -48,8 +48,10 @@ Gem::Specification.new do |s|
|
|
48
48
|
s.add_runtime_dependency 'gli', '~>2.21'
|
49
49
|
s.add_runtime_dependency 'iri', '~>0.8'
|
50
50
|
s.add_runtime_dependency 'loog', '~>0.2'
|
51
|
+
s.add_runtime_dependency 'moments', '~>0.3'
|
51
52
|
s.add_runtime_dependency 'nokogiri', '~>1.10'
|
52
53
|
s.add_runtime_dependency 'retries', '~>0.0'
|
54
|
+
s.add_runtime_dependency 'tago', '~>0.0'
|
53
55
|
s.add_runtime_dependency 'typhoeus', '~>1.3'
|
54
56
|
s.metadata['rubygems_mfa_required'] = 'true'
|
55
57
|
end
|
data/lib/judges/commands/test.rb
CHANGED
@@ -123,7 +123,9 @@ class Judges::Test
|
|
123
123
|
end
|
124
124
|
options = Judges::Options.new(opts['option']) + Judges::Options.new(yaml['options'])
|
125
125
|
(1..(opts['runs'] || yaml['runs'] || 1)).each do
|
126
|
-
|
126
|
+
fbx = fb
|
127
|
+
fbx = Factbase::Looged.new(fb, @loog) if opts['log']
|
128
|
+
judge.run(fbx, {}, {}, options)
|
127
129
|
end
|
128
130
|
xpaths = yaml['expected']
|
129
131
|
return if xpaths.nil?
|
@@ -45,21 +45,22 @@ class Judges::Update
|
|
45
45
|
raise "The directory is absent: #{dir.to_rel}" unless File.exist?(dir)
|
46
46
|
impex = Judges::Impex.new(@loog, args[1])
|
47
47
|
fb = impex.import(strict: false)
|
48
|
-
fb = Factbase::Looged.new(fb, @loog)
|
49
|
-
before = fb.size
|
48
|
+
fb = Factbase::Looged.new(fb, @loog) if opts['log']
|
50
49
|
options = Judges::Options.new(opts['option'])
|
51
50
|
@loog.debug("The following options provided:\n\t#{options.to_s.gsub("\n", "\n\t")}")
|
52
51
|
judges = Judges::Judges.new(dir, opts['lib'], @loog)
|
53
52
|
c = 0
|
53
|
+
churn = Judges::Churn.new(0, 0)
|
54
54
|
elapsed(@loog) do
|
55
55
|
loop do
|
56
56
|
c += 1
|
57
57
|
if c > 1
|
58
58
|
@loog.info("\n\nStarting cycle ##{c}#{opts['max-cycles'] ? " (out of #{opts['max-cycles']})" : ''}...")
|
59
59
|
end
|
60
|
-
|
60
|
+
delta = cycle(opts, judges, fb, options)
|
61
|
+
churn += delta
|
61
62
|
impex.export(fb)
|
62
|
-
if
|
63
|
+
if delta.zero?
|
63
64
|
@loog.info("The update cycle ##{c} has made no changes to the factbase, let's stop")
|
64
65
|
break
|
65
66
|
end
|
@@ -67,9 +68,9 @@ class Judges::Update
|
|
67
68
|
@loog.info("Too many cycles already, as set by --max-cycles=#{opts['max-cycles']}, breaking")
|
68
69
|
break
|
69
70
|
end
|
70
|
-
@loog.info("
|
71
|
+
@loog.info("The cycle #{c} modified #{delta} fact(s)")
|
71
72
|
end
|
72
|
-
throw :"Update finished in #{c} cycle(s), #{
|
73
|
+
throw :"Update finished in #{c} cycle(s), modified #{churn} fact(s)"
|
73
74
|
end
|
74
75
|
end
|
75
76
|
|
@@ -87,7 +88,7 @@ class Judges::Update
|
|
87
88
|
elapsed(@loog) do
|
88
89
|
c = one_judge(fb, p, global, options)
|
89
90
|
churn += c
|
90
|
-
throw :"👍 The judge #{p.name} modified #{c} facts"
|
91
|
+
throw :"👍 The judge #{p.name} modified #{c.zero? ? 'no' : c} facts"
|
91
92
|
end
|
92
93
|
rescue StandardError, SyntaxError => e
|
93
94
|
@loog.warn(Backtrace.new(e))
|
data/lib/judges/elapsed.rb
CHANGED
@@ -20,6 +20,8 @@
|
|
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 'tago'
|
24
|
+
|
23
25
|
def elapsed(loog)
|
24
26
|
start = Time.now
|
25
27
|
begin
|
@@ -27,6 +29,6 @@ def elapsed(loog)
|
|
27
29
|
rescue UncaughtThrowError => e
|
28
30
|
tag = e.tag
|
29
31
|
throw e unless tag.is_a?(Symbol)
|
30
|
-
loog.info("#{tag} in #{
|
32
|
+
loog.info("#{tag} in #{start.ago}")
|
31
33
|
end
|
32
34
|
end
|
data/lib/judges.rb
CHANGED
data/test/commands/test_print.rb
CHANGED
@@ -41,7 +41,7 @@ class TestPrint < Minitest::Test
|
|
41
41
|
Judges::Print.new(Loog::NULL).run({ format: 'yaml', auto: true }, [f])
|
42
42
|
y = File.join(d, 'base.yaml')
|
43
43
|
assert(File.exist?(y))
|
44
|
-
assert_equal(1, YAML.load_file(y)
|
44
|
+
assert_equal(1, YAML.load_file(y).size)
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: judges
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.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-06-
|
11
|
+
date: 2024-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: backtrace
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0.2'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: moments
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.3'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.3'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: nokogiri
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,6 +136,20 @@ dependencies:
|
|
122
136
|
- - "~>"
|
123
137
|
- !ruby/object:Gem::Version
|
124
138
|
version: '0.0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: tago
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0.0'
|
146
|
+
type: :runtime
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0.0'
|
125
153
|
- !ruby/object:Gem::Dependency
|
126
154
|
name: typhoeus
|
127
155
|
requirement: !ruby/object:Gem::Requirement
|