judges 0.47.0 → 0.48.0

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: 104c3aa90435ddf336588ca607ae35e029fbe1e8a03ac4a2efc0f9377be46f49
4
- data.tar.gz: e3d467f54ff1df3f5f4c07b1f1545bbd8543bd00af58bea82e4f9160c00885ec
3
+ metadata.gz: 939f948ca702a406b8a92ef2b4a8e222a802dacdde67694fdb0ae875d781637e
4
+ data.tar.gz: d197222ead3037463310bcf9ec470e498a20ffc7ffb76c891859783fc4886fd4
5
5
  SHA512:
6
- metadata.gz: 8b3d6c28de5880acb591607a3c2cc02d1c8cd1f1963df54c989d7719bc3dcd44963a711f9260bcde7c40c45937a80e485f6ff37a3dcff4932a618a94e9fa4e55
7
- data.tar.gz: a92d912ba0a01291ed6b990d59f26ec6ac2e5d90ab0d5b92a6dad5e26ca7d9e3f412d79017c1db1effcbd18177376b87354d61f815aca14aeeb0ad87de73c96c
6
+ metadata.gz: 533a6b4653caee694910d61e1a8704af571e9fcaf3340c7e4487a85e0a55cc5a25b9161bb2e0eef8ab8184237ab91b4067c027cfe29cb2a871868a674473c7ef
7
+ data.tar.gz: 8132e47e206bac2bdaeec650e0f86cd177445131cabd85cfe4146ca237b97eae7e83dd836f3cdd8a8e79bb879098804b1017a6ddfde8045b66f48b8b73fb2587
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.6.0)
31
+ baza.rb (0.8.0)
32
32
  backtrace (~> 0.4)
33
33
  elapsed (~> 0.0)
34
34
  faraday (~> 2.13)
@@ -180,7 +180,7 @@ GEM
180
180
  regexp_parser (2.10.0)
181
181
  retries (0.0.5)
182
182
  rexml (3.4.1)
183
- rubocop (1.76.0)
183
+ rubocop (1.76.1)
184
184
  json (~> 2.3)
185
185
  language_server-protocol (~> 3.17.0.2)
186
186
  lint_roller (~> 1.1.0)
@@ -191,7 +191,7 @@ GEM
191
191
  rubocop-ast (>= 1.45.0, < 2.0)
192
192
  ruby-progressbar (~> 1.7)
193
193
  unicode-display_width (>= 2.4.0, < 4.0)
194
- rubocop-ast (1.45.0)
194
+ rubocop-ast (1.45.1)
195
195
  parser (>= 3.3.7.2)
196
196
  prism (~> 1.4)
197
197
  rubocop-minitest (0.38.1)
@@ -51,14 +51,20 @@ Feature: Update
51
51
 
52
52
  Scenario: Skips the judge on lifetime running out
53
53
  Given I make a temp directory
54
- Then I have a "simple/simple.rb" file with content:
54
+ Then I have a "first/first.rb" file with content:
55
55
  """
56
56
  n = $fb.insert
57
+ n.type = 'first'
57
58
  sleep 1
58
59
  """
60
+ Then I have a "second/second.rb" file with content:
61
+ """
62
+ n = $fb.insert
63
+ n.type = 'second'
64
+ """
59
65
  Then I run bin/judges with "--verbose update --quiet --lifetime 1 --max-cycles 5 . simple.fb"
60
- Then Stdout contains "The 'simple' judge skipped, no time left"
61
- Then Stdout contains "Update completed in 2 cycle(s), did 1i/0d/0a"
66
+ Then Stdout contains "The 'second' judge skipped, no time left"
67
+ Then Stdout contains "Update completed in 1 cycle(s), did 1i/0d/1a"
62
68
  And Exit code is zero
63
69
 
64
70
  Scenario: Use options from a file
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.47.0'
12
+ s.version = '0.48.0'
13
13
  s.license = 'MIT'
14
14
  s.summary = 'Command-Line Tool for a Factbase'
15
15
  s.description =
@@ -79,6 +79,11 @@ class Judges::Update
79
79
  loop do
80
80
  c += 1
81
81
  if c > 1
82
+ if opts['lifetime'] && Time.now - @start > opts['lifetime']
83
+ @loog.info("Not starting cycle ##{c}, no time left")
84
+ c -= 1
85
+ break
86
+ end
82
87
  @loog.info("\nStarting cycle ##{c}#{" (out of #{opts['max-cycles']})" if opts['max-cycles']}...")
83
88
  end
84
89
  delta = cycle(opts, judges, fb, options, start, errors)
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.47.0' unless const_defined?(:VERSION)
11
+ VERSION = '0.48.0' unless const_defined?(:VERSION)
12
12
  end
@@ -79,6 +79,35 @@ class TestPrint < Minitest::Test
79
79
  assert_empty(v.errors, "#{doc}\n\n#{v.errors.join('; ')}")
80
80
  end
81
81
 
82
+ def test_html_table_has_colgroup
83
+ WebMock.disable_net_connect!
84
+ stub_request(:get, 'https://yegor256.github.io/judges/assets/index.css').to_return(body: 'nothing')
85
+ stub_request(:get, 'https://yegor256.github.io/judges/assets/index.js').to_return(body: 'nothing')
86
+ fb = Factbase.new
87
+ f = fb.insert
88
+ f.what = 'test issue'
89
+ f.when = Time.now
90
+ f.ticket = 42
91
+ html = File.join(__dir__, '../../temp/colgroup_test.html')
92
+ FileUtils.rm_f(html)
93
+ Dir.mktmpdir do |d|
94
+ factbase_file = File.join(d, 'base.fb')
95
+ File.binwrite(factbase_file, fb.export)
96
+ Judges::Print.new(Loog::NULL).run(
97
+ { 'format' => 'html', 'columns' => 'what,when,ticket' },
98
+ [factbase_file, html]
99
+ )
100
+ end
101
+ doc = Nokogiri::HTML(File.read(html))
102
+ table = doc.at_css('table#facts')
103
+ refute_nil(table, 'Table with id="facts" should exist')
104
+ colgroup = table.at_css('colgroup')
105
+ refute_nil(colgroup, 'Table should have a colgroup element')
106
+ cols = colgroup.css('col')
107
+ assert_equal(4, cols.size, 'Should have 4 col elements (3 for columns + 1 for extra)')
108
+ assert_equal('w50', cols.last['class'], 'Last col should have class="w50"')
109
+ end
110
+
82
111
  def test_print_all_formats
83
112
  WebMock.disable_net_connect!
84
113
  stub_request(:get, 'https://yegor256.github.io/judges/assets/index.css').to_return(body: 'nothing')
@@ -26,6 +26,9 @@ class TestUpload < Minitest::Test
26
26
  stub_request(:post, 'https://example.org/durables/place').to_return(
27
27
  status: 302, headers: { 'X-Zerocracy-DurableId' => '42' }
28
28
  )
29
+ stub_request(:get, %r{https://example.org/durables/42/lock}).to_return(status: 302)
30
+ stub_request(:put, %r{https://example.org/durables/42}).to_return(status: 200)
31
+ stub_request(:get, %r{https://example.org/durables/42/unlock}).to_return(status: 302)
29
32
  Dir.mktmpdir do |d|
30
33
  file = File.join(d, 'upload.txt')
31
34
  File.write(file, content)
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.47.0
4
+ version: 0.48.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko