judges 0.50.2 → 0.50.4

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: ff88f5e2be5355d3dc72031e45f94f867d65b9bdf6b68db390ab2d6b3025f99c
4
- data.tar.gz: ca6e80757356108ca07f95d2df5b860af3bdd917ac828cbbe55994f7c269d3cf
3
+ metadata.gz: 7b16e216f16363000cc2b83d5098ddeb511e1deb364fe25772afe97862939af4
4
+ data.tar.gz: 931370f4f6301296a8d39d8d21f84c7be5f2c15a1a714e4b4a222e5d55602ea2
5
5
  SHA512:
6
- metadata.gz: c0b4ce5483a8d2259c627316c5c92778303291ab10b2807353dd60d39e02fd7d271f5cae6b26194a01e24a066d37ab3fa246a2765629d6896246de8545a254d1
7
- data.tar.gz: 7ad950db0fabed3803375f822822fe70bdffc256d79885e963b57e307dbc9850c5d1071c44ff1da64bce9fdb08217d6b22be070d8a147d1bbc0bf115688785d4
6
+ metadata.gz: 4989f7f7fc1e3e126c0215cac984eb402a01ae08ac41e4257136055ed30bf061a424f5b0bec193e20410a5ed269991da2377af3f4cf6c468d2381b82c828ee81
7
+ data.tar.gz: 9a96ce56f0f466ed5ce4749cf640872d8c14b2eee46f622cb3d89968565204abbfdc1577223a05d400137ab0570e27e80900b3db48e07834cbe1725a3d86a8a4
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.2)
31
+ baza.rb (0.9.5)
32
32
  backtrace (~> 0.4)
33
33
  elapsed (~> 0.0)
34
34
  faraday (~> 2.13)
@@ -67,18 +67,16 @@ 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)
82
80
  ethon (0.16.0)
83
81
  ffi (>= 1.15.0)
84
82
  factbase (0.11.0)
@@ -97,11 +95,11 @@ GEM
97
95
  logger
98
96
  faraday-http-cache (2.5.1)
99
97
  faraday (>= 0.8)
100
- faraday-multipart (1.1.0)
98
+ faraday-multipart (1.1.1)
101
99
  multipart-post (~> 2.0)
102
- faraday-net_http (3.4.0)
100
+ faraday-net_http (3.4.1)
103
101
  net-http (>= 0.5.0)
104
- faraday-retry (2.3.1)
102
+ faraday-retry (2.3.2)
105
103
  faraday (~> 2.0)
106
104
  ffi (1.17.2-aarch64-linux-gnu)
107
105
  ffi (1.17.2-aarch64-linux-musl)
@@ -152,17 +150,16 @@ GEM
152
150
  racc (~> 1.4)
153
151
  nokogiri (1.18.8-x86_64-linux-musl)
154
152
  racc (~> 1.4)
153
+ online (0.0.1)
154
+ timeout (~> 0.4)
155
155
  os (1.1.4)
156
- ostruct (0.6.1)
157
- others (0.0.3)
156
+ ostruct (0.6.2)
157
+ others (0.1.1)
158
158
  parallel (1.27.0)
159
159
  parser (3.3.8.0)
160
160
  ast (~> 2.4.1)
161
161
  racc
162
162
  prism (1.4.0)
163
- psych (5.2.6)
164
- date
165
- stringio
166
163
  public_suffix (6.0.2)
167
164
  qbash (0.4.5)
168
165
  backtrace (> 0)
@@ -174,13 +171,10 @@ GEM
174
171
  rake (13.3.0)
175
172
  random-port (0.7.5)
176
173
  tago (> 0)
177
- rdoc (6.14.0)
178
- erb
179
- psych (>= 4.0.0)
180
174
  regexp_parser (2.10.0)
181
175
  retries (0.0.5)
182
176
  rexml (3.4.1)
183
- rubocop (1.76.1)
177
+ rubocop (1.77.0)
184
178
  json (~> 2.3)
185
179
  language_server-protocol (~> 3.17.0.2)
186
180
  lint_roller (~> 1.1.0)
@@ -188,7 +182,7 @@ GEM
188
182
  parser (>= 3.3.0.2)
189
183
  rainbow (>= 2.2.2, < 4.0)
190
184
  regexp_parser (>= 2.9.3, < 3.0)
191
- rubocop-ast (>= 1.45.0, < 2.0)
185
+ rubocop-ast (>= 1.45.1, < 2.0)
192
186
  ruby-progressbar (~> 1.7)
193
187
  unicode-display_width (>= 2.4.0, < 4.0)
194
188
  rubocop-ast (1.45.1)
@@ -205,9 +199,6 @@ GEM
205
199
  rubocop-rake (0.7.1)
206
200
  lint_roller (~> 1.1)
207
201
  rubocop (>= 1.72.1)
208
- rubocop-rspec (3.6.0)
209
- lint_roller (~> 1.1)
210
- rubocop (~> 1.72, >= 1.72.1)
211
202
  ruby-progressbar (1.13.0)
212
203
  simplecov (0.22.0)
213
204
  docile (~> 1.1)
@@ -218,7 +209,6 @@ GEM
218
209
  simplecov (~> 0.19)
219
210
  simplecov-html (0.13.1)
220
211
  simplecov_json_formatter (0.1.4)
221
- stringio (3.1.7)
222
212
  sys-uname (1.3.1)
223
213
  ffi (~> 1.1)
224
214
  tago (0.1.0)
@@ -252,23 +242,22 @@ PLATFORMS
252
242
  x86_64-linux-musl
253
243
 
254
244
  DEPENDENCIES
255
- base64 (> 0)
245
+ base64 (~> 0.0)
256
246
  cucumber (~> 10.0)
257
247
  judges!
258
248
  minitest (~> 5.25)
259
249
  minitest-reporters (~> 1.7)
260
250
  minitest-retry (~> 0.2)
261
251
  net-ping (~> 2.0)
262
- os (> 0)
263
- qbash (> 0)
252
+ online (~> 0.0)
253
+ os (~> 1.1)
254
+ qbash (~> 0.0)
264
255
  rake (~> 13.2)
265
256
  random-port (~> 0.0)
266
- rdoc (> 0)
267
257
  rubocop (~> 1.74)
268
- rubocop-minitest (> 0)
269
- rubocop-performance (> 0)
270
- rubocop-rake (> 0)
271
- rubocop-rspec (> 0)
258
+ rubocop-minitest (~> 0.0)
259
+ rubocop-performance (~> 1.25)
260
+ rubocop-rake (~> 0.0)
272
261
  simplecov (~> 0.22)
273
262
  simplecov-cobertura (~> 2.1)
274
263
  w3c_validators (~> 1.3)
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.2'
12
+ s.version = '0.50.4'
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.2' unless const_defined?(:VERSION)
11
+ VERSION = '0.50.4' 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.2
4
+ version: 0.50.4
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: