judges 0.8.0 → 0.10.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 +9 -17
- data/bin/judges +4 -1
- data/features/test.feature +23 -3
- data/features/update.feature +1 -1
- data/judges.gemspec +1 -1
- data/lib/judges/commands/test.rb +9 -2
- data/lib/judges/commands/update.rb +6 -5
- data/lib/judges.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a66536b050bc10aad0401eece9025c2cca7cc98862b18fd8fc31be03a390c8b9
|
4
|
+
data.tar.gz: 022e2a420efcfd08c7df9690f81dba7490fcbc1b9c16fe5991224140fa843d67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 928a033f2853602094977d119c30f0a64516f4548e4c776540b9861bcf1792b96100947d6d36d4e971468ce314434dd46c2e0e0ba033a11fed5fccb02f879928
|
7
|
+
data.tar.gz: 7a47a73a1627723225d93c98d1ba3391bb27c20322411ffe55dfc21f4ee176578fb42e8c62e47b1efa87faa1e5160df5a28fe52f046ecaf197458fa49208d6a7
|
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
@@ -87,10 +87,11 @@ GEM
|
|
87
87
|
erubi (1.12.0)
|
88
88
|
ethon (0.16.0)
|
89
89
|
ffi (>= 1.15.0)
|
90
|
-
factbase (0.0.
|
90
|
+
factbase (0.0.50)
|
91
91
|
json (~> 2.7)
|
92
92
|
loog (~> 0.2)
|
93
93
|
nokogiri (~> 1.10)
|
94
|
+
tago (~> 0.0)
|
94
95
|
yaml (~> 0.3)
|
95
96
|
ffi (1.17.0-aarch64-linux-gnu)
|
96
97
|
ffi (1.17.0-arm-linux-gnu)
|
@@ -135,14 +136,14 @@ GEM
|
|
135
136
|
nokogiri (1.16.5-x86_64-linux)
|
136
137
|
racc (~> 1.4)
|
137
138
|
parallel (1.25.1)
|
138
|
-
parser (3.3.
|
139
|
+
parser (3.3.3.0)
|
139
140
|
ast (~> 2.4.1)
|
140
141
|
racc
|
141
142
|
psych (5.1.2)
|
142
143
|
stringio
|
143
144
|
public_suffix (5.0.5)
|
144
145
|
racc (1.8.0)
|
145
|
-
rack (3.1.
|
146
|
+
rack (3.1.3)
|
146
147
|
rack-session (2.0.0)
|
147
148
|
rack (>= 3.0.0)
|
148
149
|
rack-test (2.1.0)
|
@@ -170,7 +171,7 @@ GEM
|
|
170
171
|
rdoc (6.7.0)
|
171
172
|
psych (>= 4.0.0)
|
172
173
|
regexp_parser (2.9.2)
|
173
|
-
reline (0.5.
|
174
|
+
reline (0.5.9)
|
174
175
|
io-console (~> 0.5)
|
175
176
|
retries (0.0.5)
|
176
177
|
rexml (3.3.0)
|
@@ -205,20 +206,11 @@ GEM
|
|
205
206
|
unicode-display_width (>= 2.4.0, < 3.0)
|
206
207
|
rubocop-ast (1.31.3)
|
207
208
|
parser (>= 3.3.1.0)
|
208
|
-
rubocop-capybara (2.21.0)
|
209
|
-
rubocop (~> 1.41)
|
210
|
-
rubocop-factory_bot (2.26.0)
|
211
|
-
rubocop (~> 1.41)
|
212
209
|
rubocop-performance (1.21.0)
|
213
210
|
rubocop (>= 1.48.1, < 2.0)
|
214
211
|
rubocop-ast (>= 1.31.1, < 2.0)
|
215
|
-
rubocop-rspec (
|
216
|
-
rubocop (~> 1.
|
217
|
-
rubocop-capybara (~> 2.17)
|
218
|
-
rubocop-factory_bot (~> 2.22)
|
219
|
-
rubocop-rspec_rails (~> 2.28)
|
220
|
-
rubocop-rspec_rails (2.29.0)
|
221
|
-
rubocop (~> 1.40)
|
212
|
+
rubocop-rspec (3.0.1)
|
213
|
+
rubocop (~> 1.61)
|
222
214
|
ruby-progressbar (1.13.0)
|
223
215
|
simplecov (0.22.0)
|
224
216
|
docile (~> 1.1)
|
@@ -233,7 +225,7 @@ GEM
|
|
233
225
|
strscan (3.1.0)
|
234
226
|
sys-uname (1.3.0)
|
235
227
|
ffi (~> 1.1)
|
236
|
-
tago (0.0.
|
228
|
+
tago (0.0.2)
|
237
229
|
thor (1.3.1)
|
238
230
|
typhoeus (1.4.1)
|
239
231
|
ethon (>= 0.9.0)
|
@@ -267,7 +259,7 @@ DEPENDENCIES
|
|
267
259
|
rspec-rails (= 6.1.2)
|
268
260
|
rubocop (= 1.64.1)
|
269
261
|
rubocop-performance (= 1.21.0)
|
270
|
-
rubocop-rspec (=
|
262
|
+
rubocop-rspec (= 3.0.1)
|
271
263
|
simplecov (= 0.22.0)
|
272
264
|
simplecov-cobertura (= 2.1.0)
|
273
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
|
|
@@ -141,11 +142,13 @@ class App
|
|
141
142
|
c.desc 'Name of the judge to run (directory name)'
|
142
143
|
c.flag([:judge], multiple: true)
|
143
144
|
c.desc 'How many times to run?'
|
144
|
-
c.flag([:runs], type: Integer
|
145
|
+
c.flag([:runs], type: Integer)
|
145
146
|
c.desc 'The location of a Ruby library (directory with .rb files to include)'
|
146
147
|
c.flag([:lib])
|
147
148
|
c.desc 'Stay quiet even if some tests fail or simply no tests executed?'
|
148
149
|
c.switch([:quiet], default_value: false)
|
150
|
+
c.desc 'Use default logging facility'
|
151
|
+
c.switch([:log], default_value: true)
|
149
152
|
c.action do |global, options, args|
|
150
153
|
require_relative '../lib/judges/commands/test'
|
151
154
|
Judges::Test.new(loog).run(options, args)
|
data/features/test.feature
CHANGED
@@ -47,7 +47,7 @@ Feature: Test
|
|
47
47
|
Then Stdout contains "All 1 judge(s) and 1 tests passed"
|
48
48
|
And Exit code is zero
|
49
49
|
|
50
|
-
Scenario: Simple test with
|
50
|
+
Scenario: Simple test with many runs
|
51
51
|
Given I make a temp directory
|
52
52
|
Then I have a "foo/simple.rb" file with content:
|
53
53
|
"""
|
@@ -57,10 +57,30 @@ Feature: Test
|
|
57
57
|
Then I have a "foo/good.yml" file with content:
|
58
58
|
"""
|
59
59
|
---
|
60
|
-
runs:
|
60
|
+
runs: 5
|
61
61
|
input: []
|
62
62
|
expected:
|
63
|
-
- /fb
|
63
|
+
- /fb[count(f)=5]
|
64
|
+
"""
|
65
|
+
Then I run bin/judges with "test ."
|
66
|
+
Then Stdout contains "All 1 judge(s) and 1 tests passed"
|
67
|
+
And Exit code is zero
|
68
|
+
|
69
|
+
Scenario: Simple test with many runs and many asserts
|
70
|
+
Given I make a temp directory
|
71
|
+
Then I have a "foo/simple.rb" file with content:
|
72
|
+
"""
|
73
|
+
n = $fb.insert
|
74
|
+
n.foo = $fb.size
|
75
|
+
"""
|
76
|
+
Then I have a "foo/good.yml" file with content:
|
77
|
+
"""
|
78
|
+
---
|
79
|
+
runs: 5
|
80
|
+
input: []
|
81
|
+
assert_once: false
|
82
|
+
expected:
|
83
|
+
- /fb/f[foo = 1]
|
64
84
|
"""
|
65
85
|
Then I run bin/judges with "test ."
|
66
86
|
Then Stdout contains "All 1 judge(s) and 1 tests passed"
|
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.10.0'
|
30
30
|
s.license = 'MIT'
|
31
31
|
s.summary = 'Command-Line Tool for a Factbase'
|
32
32
|
s.description =
|
data/lib/judges/commands/test.rb
CHANGED
@@ -122,9 +122,16 @@ class Judges::Test
|
|
122
122
|
end
|
123
123
|
end
|
124
124
|
options = Judges::Options.new(opts['option']) + Judges::Options.new(yaml['options'])
|
125
|
-
|
126
|
-
|
125
|
+
runs = opts['runs'] || yaml['runs'] || 1
|
126
|
+
(1..runs).each do |r|
|
127
|
+
fbx = fb
|
128
|
+
fbx = Factbase::Looged.new(fb, @loog) if opts['log']
|
129
|
+
judge.run(fbx, {}, {}, options)
|
130
|
+
assert(judge, tname, fb, yaml) if r == runs || opts['assert_once'].is_a?(FalseClass)
|
127
131
|
end
|
132
|
+
end
|
133
|
+
|
134
|
+
def assert(judge, tname, fb, yaml)
|
128
135
|
xpaths = yaml['expected']
|
129
136
|
return if xpaths.nil?
|
130
137
|
xml = Nokogiri::XML.parse(Factbase::ToXML.new(fb).xml)
|
@@ -46,20 +46,21 @@ class Judges::Update
|
|
46
46
|
impex = Judges::Impex.new(@loog, args[1])
|
47
47
|
fb = impex.import(strict: false)
|
48
48
|
fb = Factbase::Looged.new(fb, @loog) if opts['log']
|
49
|
-
before = fb.size
|
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
|
|
data/lib/judges.rb
CHANGED
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.10.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
|