judges 0.23.0 → 0.25.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +23 -19
- data/README.md +5 -0
- data/assets/index.xsl +2 -2
- data/bin/judges +1 -1
- data/features/test.feature +15 -0
- data/judges.gemspec +1 -1
- data/lib/judges/commands/print.rb +1 -1
- data/lib/judges/commands/pull.rb +2 -2
- data/lib/judges/commands/push.rb +2 -2
- data/lib/judges/commands/test.rb +12 -1
- data/lib/judges.rb +1 -1
- data/test/commands/test_eval.rb +1 -0
- data/test/commands/test_import.rb +1 -0
- data/test/commands/test_test.rb +30 -0
- data/test/commands/test_update.rb +1 -0
- data/test/test_judge.rb +12 -0
- 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: 864078e89f5d4c966698d554864af0c76867423811bd8e8888c935873cf2040e
|
4
|
+
data.tar.gz: 28ba277b76e781eee992fd0eb49af944576329d9d761bc40a496e97dcbece222
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abd995369192cce4656db009c16126908d3246387a405726027a47d2bab09f8e9f4edbb8f66f44c0593b9db8ad8b8da05b1e489fc8310785f7100932807a7949
|
7
|
+
data.tar.gz: 4156be82ef0bf1d1061efa41054f21dbab4c2114eeb356da6e0a54b530a9745a0246c942e0139e179485d442bdbbf544db150bc65c0d1ccda12ef8a60720680d
|
data/Gemfile.lock
CHANGED
@@ -19,39 +19,41 @@ PATH
|
|
19
19
|
GEM
|
20
20
|
remote: https://rubygems.org/
|
21
21
|
specs:
|
22
|
-
actionpack (7.
|
23
|
-
actionview (= 7.
|
24
|
-
activesupport (= 7.
|
22
|
+
actionpack (7.2.0)
|
23
|
+
actionview (= 7.2.0)
|
24
|
+
activesupport (= 7.2.0)
|
25
25
|
nokogiri (>= 1.8.5)
|
26
26
|
racc
|
27
|
-
rack (>= 2.2.4)
|
27
|
+
rack (>= 2.2.4, < 3.2)
|
28
28
|
rack-session (>= 1.0.1)
|
29
29
|
rack-test (>= 0.6.3)
|
30
30
|
rails-dom-testing (~> 2.2)
|
31
31
|
rails-html-sanitizer (~> 1.6)
|
32
|
-
|
33
|
-
|
32
|
+
useragent (~> 0.16)
|
33
|
+
actionview (7.2.0)
|
34
|
+
activesupport (= 7.2.0)
|
34
35
|
builder (~> 3.1)
|
35
36
|
erubi (~> 1.11)
|
36
37
|
rails-dom-testing (~> 2.2)
|
37
38
|
rails-html-sanitizer (~> 1.6)
|
38
|
-
activesupport (7.
|
39
|
+
activesupport (7.2.0)
|
39
40
|
base64
|
40
41
|
bigdecimal
|
41
|
-
concurrent-ruby (~> 1.0, >= 1.
|
42
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
42
43
|
connection_pool (>= 2.2.5)
|
43
44
|
drb
|
44
45
|
i18n (>= 1.6, < 2)
|
46
|
+
logger (>= 1.4.2)
|
45
47
|
minitest (>= 5.1)
|
46
|
-
|
47
|
-
tzinfo (~> 2.0)
|
48
|
+
securerandom (>= 0.3)
|
49
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
48
50
|
addressable (2.8.7)
|
49
51
|
public_suffix (>= 2.0.2, < 7.0)
|
50
52
|
ansi (1.5.0)
|
51
53
|
ast (2.4.2)
|
52
54
|
backtrace (0.4.0)
|
53
55
|
base64 (0.2.0)
|
54
|
-
baza.rb (0.0.
|
56
|
+
baza.rb (0.0.4)
|
55
57
|
backtrace (> 0)
|
56
58
|
faraday (> 0)
|
57
59
|
faraday-http-cache (> 0)
|
@@ -60,10 +62,11 @@ GEM
|
|
60
62
|
iri (> 0)
|
61
63
|
loog (> 0)
|
62
64
|
retries (~> 0)
|
65
|
+
tago (~> 0)
|
63
66
|
typhoeus (~> 1.3)
|
64
67
|
bigdecimal (3.1.8)
|
65
68
|
builder (3.3.0)
|
66
|
-
concurrent-ruby (1.3.
|
69
|
+
concurrent-ruby (1.3.4)
|
67
70
|
connection_pool (2.4.1)
|
68
71
|
crack (1.0.0)
|
69
72
|
bigdecimal
|
@@ -154,7 +157,6 @@ GEM
|
|
154
157
|
moments (0.3.0)
|
155
158
|
multi_test (1.1.0)
|
156
159
|
multipart-post (2.4.1)
|
157
|
-
mutex_m (0.2.0)
|
158
160
|
net-http (0.4.1)
|
159
161
|
uri
|
160
162
|
net-ping (2.0.8)
|
@@ -173,7 +175,7 @@ GEM
|
|
173
175
|
nokogiri (1.16.7-x86_64-linux)
|
174
176
|
racc (~> 1.4)
|
175
177
|
others (0.0.3)
|
176
|
-
parallel (1.26.
|
178
|
+
parallel (1.26.2)
|
177
179
|
parser (3.3.4.2)
|
178
180
|
ast (~> 2.4.1)
|
179
181
|
racc
|
@@ -196,10 +198,10 @@ GEM
|
|
196
198
|
rails-html-sanitizer (1.6.0)
|
197
199
|
loofah (~> 2.21)
|
198
200
|
nokogiri (~> 1.14)
|
199
|
-
railties (7.
|
200
|
-
actionpack (= 7.
|
201
|
-
activesupport (= 7.
|
202
|
-
irb
|
201
|
+
railties (7.2.0)
|
202
|
+
actionpack (= 7.2.0)
|
203
|
+
activesupport (= 7.2.0)
|
204
|
+
irb (~> 1.13)
|
203
205
|
rackup (>= 1.0.0)
|
204
206
|
rake (>= 12.2)
|
205
207
|
thor (~> 1.0, >= 1.2.2)
|
@@ -213,7 +215,7 @@ GEM
|
|
213
215
|
reline (0.5.9)
|
214
216
|
io-console (~> 0.5)
|
215
217
|
retries (0.0.5)
|
216
|
-
rexml (3.3.
|
218
|
+
rexml (3.3.5)
|
217
219
|
strscan
|
218
220
|
rspec-core (3.13.0)
|
219
221
|
rspec-support (~> 3.13.0)
|
@@ -251,6 +253,7 @@ GEM
|
|
251
253
|
rubocop-rspec (3.0.4)
|
252
254
|
rubocop (~> 1.61)
|
253
255
|
ruby-progressbar (1.13.0)
|
256
|
+
securerandom (0.3.1)
|
254
257
|
simplecov (0.22.0)
|
255
258
|
docile (~> 1.1)
|
256
259
|
simplecov-html (~> 0.11)
|
@@ -272,6 +275,7 @@ GEM
|
|
272
275
|
concurrent-ruby (~> 1.0)
|
273
276
|
unicode-display_width (2.5.0)
|
274
277
|
uri (0.13.0)
|
278
|
+
useragent (0.16.10)
|
275
279
|
webmock (3.23.1)
|
276
280
|
addressable (>= 2.8.0)
|
277
281
|
crack (>= 0.3.2)
|
data/README.md
CHANGED
@@ -48,6 +48,8 @@ options:
|
|
48
48
|
max: 100
|
49
49
|
expected:
|
50
50
|
- /fb[count(f)=1]
|
51
|
+
expected_failure:
|
52
|
+
- 'file not found'
|
51
53
|
after:
|
52
54
|
- first.rb
|
53
55
|
- second.rb
|
@@ -72,6 +74,9 @@ The `after` (default: `[]`) is a list of relative file names
|
|
72
74
|
of Ruby scripts that are executed after the judge
|
73
75
|
(`$fb` and `$loog` are passed into them).
|
74
76
|
|
77
|
+
The `expected_failure (default: `[]`) is a list of strings that must
|
78
|
+
be present in the message of the exception being raised.
|
79
|
+
|
75
80
|
## How to contribute
|
76
81
|
|
77
82
|
Read
|
data/assets/index.xsl
CHANGED
@@ -162,13 +162,13 @@ SOFTWARE.
|
|
162
162
|
<xsl:param name="cols"/>
|
163
163
|
<xsl:choose>
|
164
164
|
<xsl:when test="string-length($cols) > 0">
|
165
|
-
<col style="
|
165
|
+
<col style=""/>
|
166
166
|
<xsl:call-template name="col">
|
167
167
|
<xsl:with-param name="cols" select="substring-after($cols, ',')"/>
|
168
168
|
</xsl:call-template>
|
169
169
|
</xsl:when>
|
170
170
|
<xsl:otherwise>
|
171
|
-
<col style=""/>
|
171
|
+
<col style="width: 50%;"/>
|
172
172
|
</xsl:otherwise>
|
173
173
|
</xsl:choose>
|
174
174
|
</xsl:template>
|
data/bin/judges
CHANGED
@@ -118,7 +118,7 @@ class JudgesGLI extend GLI::App
|
|
118
118
|
c.desc 'Comma separated list of columns to show in HTML output (no spaces!)'
|
119
119
|
c.flag([:columns], default_value: 'when,what')
|
120
120
|
c.desc 'Comma separated list of hidden columns, not to be rendered (no spaces!)'
|
121
|
-
c.flag([:hidden], default_value: '_id,_time,_version')
|
121
|
+
c.flag([:hidden], default_value: '_id,_time,_version,_job')
|
122
122
|
c.desc 'Print even if target file already exists and is older than the factbase'
|
123
123
|
c.switch([:force], default_value: false)
|
124
124
|
run_it(c, 'print')
|
data/features/test.feature
CHANGED
@@ -163,3 +163,18 @@ Feature: Test
|
|
163
163
|
"""
|
164
164
|
Then I run bin/judges with "test mine"
|
165
165
|
And Exit code is zero
|
166
|
+
|
167
|
+
Scenario: Test with exception
|
168
|
+
Given I make a temp directory
|
169
|
+
Then I have a "mine/foo/foo.rb" file with content:
|
170
|
+
"""
|
171
|
+
raise 'this is a joke'
|
172
|
+
"""
|
173
|
+
Then I have a "mine/foo/simple.yml" file with content:
|
174
|
+
"""
|
175
|
+
---
|
176
|
+
expected_failure:
|
177
|
+
- a joke
|
178
|
+
"""
|
179
|
+
Then I run bin/judges with "test mine"
|
180
|
+
And Exit code is zero
|
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.25.0'
|
30
30
|
s.license = 'MIT'
|
31
31
|
s.summary = 'Command-Line Tool for a Factbase'
|
32
32
|
s.description =
|
@@ -95,7 +95,7 @@ class Judges::Print
|
|
95
95
|
'title' => opts['title'],
|
96
96
|
'date' => Time.now.utc.iso8601,
|
97
97
|
'columns' => opts['columns'] || 'when,what,who',
|
98
|
-
'hidden' => opts['hidden'] || '_id,_version,_time',
|
98
|
+
'hidden' => opts['hidden'] || '_id,_version,_time,_job',
|
99
99
|
'version' => Judges::VERSION
|
100
100
|
)
|
101
101
|
)
|
data/lib/judges/commands/pull.rb
CHANGED
@@ -22,7 +22,7 @@
|
|
22
22
|
|
23
23
|
require 'typhoeus'
|
24
24
|
require 'iri'
|
25
|
-
require 'baza'
|
25
|
+
require 'baza-rb'
|
26
26
|
require_relative '../../judges'
|
27
27
|
require_relative '../../judges/impex'
|
28
28
|
|
@@ -42,7 +42,7 @@ class Judges::Pull
|
|
42
42
|
def run(opts, args)
|
43
43
|
raise 'Exactly two arguments required' unless args.size == 2
|
44
44
|
fb = Factbase.new
|
45
|
-
baza =
|
45
|
+
baza = BazaRb.new(
|
46
46
|
opts['host'], opts['port'].to_i, opts['token'],
|
47
47
|
ssl: opts['ssl'],
|
48
48
|
timeout: (opts['timeout'] || 30).to_i,
|
data/lib/judges/commands/push.rb
CHANGED
@@ -22,7 +22,7 @@
|
|
22
22
|
|
23
23
|
require 'typhoeus'
|
24
24
|
require 'iri'
|
25
|
-
require 'baza'
|
25
|
+
require 'baza-rb'
|
26
26
|
require_relative '../../judges'
|
27
27
|
require_relative '../../judges/impex'
|
28
28
|
|
@@ -43,7 +43,7 @@ class Judges::Push
|
|
43
43
|
raise 'Exactly two arguments required' unless args.size == 2
|
44
44
|
name = args[0]
|
45
45
|
fb = Judges::Impex.new(@loog, args[1]).import
|
46
|
-
baza =
|
46
|
+
baza = BazaRb.new(
|
47
47
|
opts['host'], opts['port'].to_i, opts['token'],
|
48
48
|
ssl: opts['ssl'],
|
49
49
|
timeout: (opts['timeout'] || 30).to_i,
|
data/lib/judges/commands/test.rb
CHANGED
@@ -146,7 +146,18 @@ class Judges::Test
|
|
146
146
|
(1..runs).each do |r|
|
147
147
|
fbx = fb
|
148
148
|
fbx = Factbase::Looged.new(fb, @loog) if opts['log']
|
149
|
-
|
149
|
+
expected_failure = yaml['expected_failure']
|
150
|
+
begin
|
151
|
+
judge.run(fbx, {}, {}, options)
|
152
|
+
raise 'Exception expected but not raised' if expected_failure
|
153
|
+
# rubocop:disable Lint/RescueException
|
154
|
+
rescue Exception => e
|
155
|
+
# rubocop:enable Lint/RescueException
|
156
|
+
raise e unless expected_failure
|
157
|
+
if expected_failure.is_a?(Array) && expected_failure.none? { |s| e.message.include?(s) }
|
158
|
+
raise "Exception #{e.class} raised with #{e.message.inspect}, but this is not what was expected"
|
159
|
+
end
|
160
|
+
end
|
150
161
|
next unless assert
|
151
162
|
assert(judge, tname, fb, yaml) if r == runs || opts['assert_once'].is_a?(FalseClass)
|
152
163
|
end
|
data/lib/judges.rb
CHANGED
data/test/commands/test_eval.rb
CHANGED
data/test/commands/test_test.rb
CHANGED
@@ -22,6 +22,7 @@
|
|
22
22
|
|
23
23
|
require 'minitest/autorun'
|
24
24
|
require 'loog'
|
25
|
+
require_relative '../test__helper'
|
25
26
|
require_relative '../../lib/judges'
|
26
27
|
require_relative '../../lib/judges/commands/test'
|
27
28
|
|
@@ -143,4 +144,33 @@ class TestTest < Minitest::Test
|
|
143
144
|
Judges::Test.new(Loog::NULL).run({}, [d])
|
144
145
|
end
|
145
146
|
end
|
147
|
+
|
148
|
+
def test_with_expected_failure
|
149
|
+
Dir.mktmpdir do |d|
|
150
|
+
save_it(File.join(d, 'foo/foo.rb'), 'raise "this is intentional";')
|
151
|
+
save_it(
|
152
|
+
File.join(d, 'foo/x.yml'),
|
153
|
+
<<-YAML
|
154
|
+
input: []
|
155
|
+
expected_failure:
|
156
|
+
- intentional
|
157
|
+
YAML
|
158
|
+
)
|
159
|
+
Judges::Test.new(Loog::NULL).run({}, [d])
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
def test_with_expected_failure_no_string
|
164
|
+
Dir.mktmpdir do |d|
|
165
|
+
save_it(File.join(d, 'foo/foo.rb'), 'raise "this is intentional";')
|
166
|
+
save_it(
|
167
|
+
File.join(d, 'foo/x.yml'),
|
168
|
+
<<-YAML
|
169
|
+
input: []
|
170
|
+
expected_failure: true
|
171
|
+
YAML
|
172
|
+
)
|
173
|
+
Judges::Test.new(Loog::VERBOSE).run({}, [d])
|
174
|
+
end
|
175
|
+
end
|
146
176
|
end
|
data/test/test_judge.rb
CHANGED
@@ -24,6 +24,7 @@ require 'minitest/autorun'
|
|
24
24
|
require 'tmpdir'
|
25
25
|
require 'loog'
|
26
26
|
require 'factbase'
|
27
|
+
require_relative 'test__helper'
|
27
28
|
require_relative '../lib/judges'
|
28
29
|
require_relative '../lib/judges/judge'
|
29
30
|
|
@@ -105,4 +106,15 @@ class TestJudge < Minitest::Test
|
|
105
106
|
end
|
106
107
|
end
|
107
108
|
end
|
109
|
+
|
110
|
+
def test_with_standard_error
|
111
|
+
assert_raises do
|
112
|
+
Dir.mktmpdir do |d|
|
113
|
+
dir = File.join(d, 'judges')
|
114
|
+
save_it(File.join(dir, "#{File.basename(d)}.rb"), 'raise "intentional"')
|
115
|
+
judge = Judges::Judge.new(dir, lib, Loog::NULL)
|
116
|
+
judge.run(Factbase.new, {}, {}, {})
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
108
120
|
end
|
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.25.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-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: backtrace
|