judges 0.50.3 → 0.50.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 406c43145a35b43f5839144058a00a97358a4c4e5c2564712951268e5e28449f
4
- data.tar.gz: f3c96beccc95ba98cb836cc18258332c65b98e7eb9faf9b21d0a5d7d46e2ba81
3
+ metadata.gz: '069b7acef208251d415f08fcbbcc970fbaad97cb2e1733a78429ef646f218cd9'
4
+ data.tar.gz: 30127407e14ff804e8c9e660d94baec68b2ce7ba2eec0b9a7159c5935ddcee29
5
5
  SHA512:
6
- metadata.gz: b736c344d5158b1db322fd77ba1a671c5e121d8ee3a1e7a85ac2cf388ed0288dc8bc402912994ae403a52ac607e0f3375f8edd5ae1961f8df43729d7af7d18d6
7
- data.tar.gz: ea1a7c05cd2b81aa69e3264072a6ece3a5afee96e4737de521f500e74c94eccb1c6340320bee043c879274eee0eb4a7dd634069e5687232886208071d2ea57fb
6
+ metadata.gz: 36e0d637ba3916d819b78096ddccf07b645ba8e455950f65c192c3e0aa34ea7345f869fa04266a88b30afacf9cec05a1c411f2610e8b415a753e2225afc44d5f
7
+ data.tar.gz: c02b8c03bb38d441ee2be2933d5387ef104d03e96885a508f3024919d76000d572cc984c93bcdf65b416743750384028e305f453a8dce4a46be2d3710a380555
data/.rubocop.yml CHANGED
@@ -11,7 +11,6 @@ AllCops:
11
11
  SuggestExtensions: false
12
12
  NewCops: enable
13
13
  plugins:
14
- - rubocop-rspec
15
14
  - rubocop-minitest
16
15
  - rubocop-performance
17
16
  - rubocop-rake
data/Gemfile CHANGED
@@ -6,22 +6,21 @@
6
6
  source 'https://rubygems.org'
7
7
  gemspec
8
8
 
9
- gem 'base64', '>0'
9
+ gem 'base64', '~>0.0'
10
10
  gem 'cucumber', '~>10.0', require: false
11
11
  gem 'minitest', '~>5.25', require: false
12
12
  gem 'minitest-reporters', '~>1.7', require: false
13
13
  gem 'minitest-retry', '~>0.2', require: false
14
14
  gem 'net-ping', '~>2.0', require: false
15
- gem 'os', '>0', require: false
16
- gem 'qbash', '>0', require: false
15
+ gem 'online', '~>0.0', require: false
16
+ gem 'os', '~>1.1', require: false
17
+ gem 'qbash', '~>0.0', require: false
17
18
  gem 'rake', '~>13.2', require: false
18
19
  gem 'random-port', '~>0.0', require: false
19
- gem 'rdoc', '>0', require: false
20
20
  gem 'rubocop', '~>1.74', require: false
21
- gem 'rubocop-minitest', '>0', require: false
22
- gem 'rubocop-performance', '>0', require: false
23
- gem 'rubocop-rake', '>0', require: false
24
- gem 'rubocop-rspec', '>0', require: false
21
+ gem 'rubocop-minitest', '~>0.0', require: false
22
+ gem 'rubocop-performance', '~>1.25', require: false
23
+ gem 'rubocop-rake', '~>0.0', require: false
25
24
  gem 'simplecov', '~>0.22', require: false
26
25
  gem 'simplecov-cobertura', '~>2.1', require: false
27
26
  gem 'w3c_validators', '~>1.3', require: false
data/Gemfile.lock CHANGED
@@ -28,7 +28,7 @@ GEM
28
28
  ast (2.4.3)
29
29
  backtrace (0.4.1)
30
30
  base64 (0.3.0)
31
- baza.rb (0.9.4)
31
+ baza.rb (0.9.5)
32
32
  backtrace (~> 0.4)
33
33
  elapsed (~> 0.0)
34
34
  faraday (~> 2.13)
@@ -67,23 +67,23 @@ GEM
67
67
  bigdecimal
68
68
  cucumber-gherkin (30.0.4)
69
69
  cucumber-messages (> 25, < 28)
70
- cucumber-html-formatter (21.10.1)
70
+ cucumber-html-formatter (21.12.0)
71
71
  cucumber-messages (> 19, < 28)
72
72
  cucumber-messages (27.2.0)
73
73
  cucumber-tag-expressions (6.1.2)
74
- date (3.4.1)
75
74
  decoor (0.0.1)
76
75
  diff-lcs (1.6.2)
77
76
  docile (1.4.1)
78
77
  elapsed (0.0.1)
79
78
  loog (> 0)
80
79
  tago (> 0)
81
- erb (5.0.1)
80
+ ellipsized (0.3.0)
82
81
  ethon (0.16.0)
83
82
  ffi (>= 1.15.0)
84
- factbase (0.11.0)
83
+ factbase (0.11.1)
85
84
  backtrace (~> 0.4)
86
85
  decoor (~> 0.0)
86
+ ellipsized (~> 0.3)
87
87
  json (~> 2.7)
88
88
  logger (~> 1.0)
89
89
  loog (~> 0.6)
@@ -97,11 +97,11 @@ GEM
97
97
  logger
98
98
  faraday-http-cache (2.5.1)
99
99
  faraday (>= 0.8)
100
- faraday-multipart (1.1.0)
100
+ faraday-multipart (1.1.1)
101
101
  multipart-post (~> 2.0)
102
102
  faraday-net_http (3.4.1)
103
103
  net-http (>= 0.5.0)
104
- faraday-retry (2.3.1)
104
+ faraday-retry (2.3.2)
105
105
  faraday (~> 2.0)
106
106
  ffi (1.17.2-aarch64-linux-gnu)
107
107
  ffi (1.17.2-aarch64-linux-musl)
@@ -152,17 +152,16 @@ GEM
152
152
  racc (~> 1.4)
153
153
  nokogiri (1.18.8-x86_64-linux-musl)
154
154
  racc (~> 1.4)
155
+ online (0.0.1)
156
+ timeout (~> 0.4)
155
157
  os (1.1.4)
156
- ostruct (0.6.1)
157
- others (0.0.3)
158
+ ostruct (0.6.2)
159
+ others (0.1.1)
158
160
  parallel (1.27.0)
159
161
  parser (3.3.8.0)
160
162
  ast (~> 2.4.1)
161
163
  racc
162
164
  prism (1.4.0)
163
- psych (5.2.6)
164
- date
165
- stringio
166
165
  public_suffix (6.0.2)
167
166
  qbash (0.4.5)
168
167
  backtrace (> 0)
@@ -174,13 +173,10 @@ GEM
174
173
  rake (13.3.0)
175
174
  random-port (0.7.5)
176
175
  tago (> 0)
177
- rdoc (6.14.0)
178
- erb
179
- psych (>= 4.0.0)
180
176
  regexp_parser (2.10.0)
181
177
  retries (0.0.5)
182
178
  rexml (3.4.1)
183
- rubocop (1.76.1)
179
+ rubocop (1.77.0)
184
180
  json (~> 2.3)
185
181
  language_server-protocol (~> 3.17.0.2)
186
182
  lint_roller (~> 1.1.0)
@@ -188,7 +184,7 @@ GEM
188
184
  parser (>= 3.3.0.2)
189
185
  rainbow (>= 2.2.2, < 4.0)
190
186
  regexp_parser (>= 2.9.3, < 3.0)
191
- rubocop-ast (>= 1.45.0, < 2.0)
187
+ rubocop-ast (>= 1.45.1, < 2.0)
192
188
  ruby-progressbar (~> 1.7)
193
189
  unicode-display_width (>= 2.4.0, < 4.0)
194
190
  rubocop-ast (1.45.1)
@@ -205,9 +201,6 @@ GEM
205
201
  rubocop-rake (0.7.1)
206
202
  lint_roller (~> 1.1)
207
203
  rubocop (>= 1.72.1)
208
- rubocop-rspec (3.6.0)
209
- lint_roller (~> 1.1)
210
- rubocop (~> 1.72, >= 1.72.1)
211
204
  ruby-progressbar (1.13.0)
212
205
  simplecov (0.22.0)
213
206
  docile (~> 1.1)
@@ -218,7 +211,6 @@ GEM
218
211
  simplecov (~> 0.19)
219
212
  simplecov-html (0.13.1)
220
213
  simplecov_json_formatter (0.1.4)
221
- stringio (3.1.7)
222
214
  sys-uname (1.3.1)
223
215
  ffi (~> 1.1)
224
216
  tago (0.1.0)
@@ -252,23 +244,22 @@ PLATFORMS
252
244
  x86_64-linux-musl
253
245
 
254
246
  DEPENDENCIES
255
- base64 (> 0)
247
+ base64 (~> 0.0)
256
248
  cucumber (~> 10.0)
257
249
  judges!
258
250
  minitest (~> 5.25)
259
251
  minitest-reporters (~> 1.7)
260
252
  minitest-retry (~> 0.2)
261
253
  net-ping (~> 2.0)
262
- os (> 0)
263
- qbash (> 0)
254
+ online (~> 0.0)
255
+ os (~> 1.1)
256
+ qbash (~> 0.0)
264
257
  rake (~> 13.2)
265
258
  random-port (~> 0.0)
266
- rdoc (> 0)
267
259
  rubocop (~> 1.74)
268
- rubocop-minitest (> 0)
269
- rubocop-performance (> 0)
270
- rubocop-rake (> 0)
271
- rubocop-rspec (> 0)
260
+ rubocop-minitest (~> 0.0)
261
+ rubocop-performance (~> 1.25)
262
+ rubocop-rake (~> 0.0)
272
263
  simplecov (~> 0.22)
273
264
  simplecov-cobertura (~> 2.1)
274
265
  w3c_validators (~> 1.3)
@@ -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.11.0 --verbose test --judge guess ./fixtures"
19
+ When I run bin/judges with "--factbase 0.11.1 --verbose test --judge guess ./fixtures"
20
20
  Then Exit code is zero
21
- And Stdout contains "Factbase version to be used: '0.11.0'"
21
+ And Stdout contains "Factbase version to be used: '0.11.1'"
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/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.50.3'
12
+ s.version = '0.50.5'
13
13
  s.license = 'MIT'
14
14
  s.summary = 'Command-Line Tool for a Factbase'
15
15
  s.description =
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
  'for a set of judges.'
21
21
  s.authors = ['Yegor Bugayenko']
22
22
  s.email = 'yegor256@gmail.com'
23
- s.homepage = 'http://github.com/yegor256/judges'
23
+ s.homepage = 'https://github.com/yegor256/judges'
24
24
  s.files = `git ls-files`.split($RS)
25
25
  s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
26
26
  s.rdoc_options = ['--charset=UTF-8']
@@ -47,40 +47,43 @@ class Judges::Test
47
47
  judges.each_with_index do |judge, i|
48
48
  visible << judge.name
49
49
  next unless include?(opts, judge.name)
50
- @loog.info("\n👉 Testing #{judge.script} (##{i}) in #{judge.dir.to_rel}...")
50
+ @loog.info("👉 Testing #{judge.script} (##{i}) in #{judge.dir.to_rel}...")
51
+ buf = Loog::Buffer.new
52
+ judge = judge.with_loog(buf)
51
53
  judge.tests.each do |f|
52
54
  tname = File.basename(f).gsub(/\.yml$/, '')
53
55
  visible << " #{judge.name}/#{tname}"
54
56
  next unless include?(opts, judge.name, tname)
55
57
  yaml = YAML.load_file(f, permitted_classes: [Time])
56
58
  if yaml['skip']
57
- @loog.info("Skipped #{f.to_rel}")
59
+ buf.info("Skipped #{f.to_rel}")
58
60
  next
59
61
  end
60
62
  unless Judges::Categories.new(opts['enable'], opts['disable']).ok?(yaml['category'])
61
- @loog.info("Skipped #{f.to_rel} because of its category")
63
+ buf.info("Skipped #{f.to_rel} because of its category")
62
64
  next
63
65
  end
64
- @loog.info("🛠️ Testing #{f.to_rel}:")
66
+ buf.info("🛠️ Testing #{f.to_rel}:")
65
67
  start = Time.now
66
68
  badge = "#{judge.name}/#{tname}"
67
69
  begin
68
70
  fb = Factbase.new
69
71
  prepare(fb, yaml)
70
72
  yaml['before']&.each do |n|
71
- j = judges.get(n)
72
- @loog.info("Running #{j.script} judge as a pre-condition...")
73
+ j = judges.get(n).with_loog(buf)
74
+ buf.info("Running #{j.script} judge as a pre-condition...")
73
75
  test_one(fb, opts, j, n, yaml, assert: false)
74
76
  end
75
77
  test_one(fb, opts, judge, tname, yaml)
76
78
  yaml['after']&.each do |rb|
77
- @loog.info("Running #{rb} assertion script...")
79
+ buf.info("Running #{rb} assertion script...")
78
80
  $fb = fb
79
- $loog = @loog
81
+ $loog = buf
80
82
  load(File.join(judge.dir, rb), true)
81
83
  end
82
84
  tests += 1
83
85
  rescue StandardError => e
86
+ @loog.info(buf.to_s)
84
87
  @loog.warn(Backtrace.new(e))
85
88
  errors << badge
86
89
  end
data/lib/judges/judge.rb CHANGED
@@ -35,6 +35,14 @@ class Judges::Judge
35
35
  name
36
36
  end
37
37
 
38
+ # A new judge, with a different log.
39
+ #
40
+ # @param [Loog] loog New log
41
+ # @return [Judges::Judge] Similar judge, but log is different
42
+ def with_loog(loog)
43
+ Judges::Judge.new(@dir, @lib, loog, start: @start)
44
+ end
45
+
38
46
  # Executes the judge script with the provided factbase and configuration.
39
47
  #
40
48
  # This method sets up the execution environment by creating global variables,
data/lib/judges.rb CHANGED
@@ -8,5 +8,5 @@
8
8
  # Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
9
9
  # License:: MIT
10
10
  module Judges
11
- VERSION = '0.50.3' unless const_defined?(:VERSION)
11
+ VERSION = '0.50.5' unless const_defined?(:VERSION)
12
12
  end
@@ -6,8 +6,8 @@
6
6
  require 'factbase'
7
7
  require 'fileutils'
8
8
  require 'loog'
9
- require 'net/ping'
10
9
  require 'nokogiri'
10
+ require 'online'
11
11
  require 'securerandom'
12
12
  require 'w3c_validators'
13
13
  require 'webmock/minitest'
@@ -73,8 +73,8 @@ class TestPrint < Minitest::Test
73
73
  end
74
74
  assert_empty(xml.errors, xml)
75
75
  refute_empty(xml.xpath('/html'), xml)
76
- skip('We are offline') unless we_are_online
77
76
  WebMock.enable_net_connect!
77
+ skip('We are offline') unless online?
78
78
  v = W3CValidators::NuValidator.new.validate_file(html)
79
79
  assert_empty(v.errors, "#{doc}\n\n#{v.errors.join('; ')}")
80
80
  end
@@ -139,10 +139,4 @@ class TestPrint < Minitest::Test
139
139
  assert_equal(mtime, File.mtime(y))
140
140
  end
141
141
  end
142
-
143
- private
144
-
145
- def we_are_online
146
- Net::Ping::External.new('8.8.8.8').ping?
147
- end
148
142
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: judges
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.50.3
4
+ version: 0.50.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
@@ -338,7 +338,7 @@ files:
338
338
  - test/test_judges.rb
339
339
  - test/test_options.rb
340
340
  - test/test_to_rel.rb
341
- homepage: http://github.com/yegor256/judges
341
+ homepage: https://github.com/yegor256/judges
342
342
  licenses:
343
343
  - MIT
344
344
  metadata: