judges 0.25.2 → 0.26.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 793749ccbd3ca4e609283aa272ccb8d47c0b1c67f6c2dc10b0282844aff12715
4
- data.tar.gz: 8c02acf326f92a4819f6a4c8e76f956fa56a68623c0b9c1948ee87466b220566
3
+ metadata.gz: d63aeb8f8b74f82c29128b4a8106fa8b51def765011a1388040b1938f64b150c
4
+ data.tar.gz: 390ccdd6187927993548da9854ed8dfaa1eadb91e858e791f16d1a7f0c549774
5
5
  SHA512:
6
- metadata.gz: bb5f2d0b72d068eeb686f4458e0a1b2241eeb0a54ff5dbf64025170f6607fcf8c840d7bb9ba53c4b43762256d99ceb479e3311094c55db6e66ed30225362911c
7
- data.tar.gz: af19e76d102ff80655af90132aea9fa83d985e96a9c7ea5baab107d74baf6045efce82deb5df70277e0a3186a5bdddd303cb8288617d3df7de2a7d140af61b61
6
+ metadata.gz: 295de9b2be80178f94a719eae6cf0fefb37872b39a305899f543c795318f3dddc27a52af6ccca4faaf6ece019db004d725af33f27a893175b4f405d35ab9a3b7
7
+ data.tar.gz: a9bb032efbb194da0bbcbc34a5f7141f8a9eda7555ae9c157569cc3aeb4669bc90f8761390c13c31a58802d7e0c47a2bfa8340b5de4d557a2e538b6e4e9dcd97
data/Gemfile CHANGED
@@ -24,16 +24,17 @@ source 'https://rubygems.org'
24
24
  gemspec
25
25
 
26
26
  gem 'cucumber', '9.2.0', require: false
27
- gem 'minitest', '5.24.1', require: false
27
+ gem 'minitest', '5.25.1', require: false
28
28
  gem 'minitest-reporters', '1.7.1', require: false
29
29
  gem 'net-ping', '2.0.8', require: false
30
30
  gem 'rake', '13.2.1', require: false
31
31
  gem 'random-port', '~>0.0', require: false
32
- gem 'rspec-rails', '6.1.3', require: false
33
- gem 'rubocop', '1.65.1', require: false
32
+ gem 'rspec-rails', '7.0.1', require: false
33
+ gem 'rubocop', '1.66.0', require: false
34
34
  gem 'rubocop-performance', '1.21.1', require: false
35
35
  gem 'rubocop-rspec', '3.0.4', require: false
36
36
  gem 'simplecov', '0.22.0', require: false
37
37
  gem 'simplecov-cobertura', '2.1.0', require: false
38
+ gem 'w3c_validators', '1.3.7', require: false
38
39
  gem 'webmock', '3.23.1', require: false
39
40
  gem 'yard', '0.9.36', require: false
data/Gemfile.lock CHANGED
@@ -2,26 +2,27 @@ PATH
2
2
  remote: .
3
3
  specs:
4
4
  judges (0.0.0)
5
- backtrace (~> 0)
6
- baza.rb (~> 0)
5
+ backtrace (> 0)
6
+ baza.rb (> 0)
7
7
  concurrent-ruby (~> 1.2)
8
- factbase (~> 0)
8
+ elapsed (> 0)
9
+ factbase (> 0)
9
10
  gli (~> 2.21)
10
- iri (~> 0)
11
- loog (~> 0)
11
+ iri (> 0)
12
+ loog (> 0)
12
13
  moments (~> 0.3)
13
14
  nokogiri (~> 1.10)
14
- others (~> 0)
15
- retries (~> 0)
16
- tago (~> 0)
15
+ others (> 0)
16
+ retries (> 0)
17
+ tago (> 0)
17
18
  typhoeus (~> 1.3)
18
19
 
19
20
  GEM
20
21
  remote: https://rubygems.org/
21
22
  specs:
22
- actionpack (7.2.0)
23
- actionview (= 7.2.0)
24
- activesupport (= 7.2.0)
23
+ actionpack (7.2.1)
24
+ actionview (= 7.2.1)
25
+ activesupport (= 7.2.1)
25
26
  nokogiri (>= 1.8.5)
26
27
  racc
27
28
  rack (>= 2.2.4, < 3.2)
@@ -30,13 +31,13 @@ GEM
30
31
  rails-dom-testing (~> 2.2)
31
32
  rails-html-sanitizer (~> 1.6)
32
33
  useragent (~> 0.16)
33
- actionview (7.2.0)
34
- activesupport (= 7.2.0)
34
+ actionview (7.2.1)
35
+ activesupport (= 7.2.1)
35
36
  builder (~> 3.1)
36
37
  erubi (~> 1.11)
37
38
  rails-dom-testing (~> 2.2)
38
39
  rails-html-sanitizer (~> 1.6)
39
- activesupport (7.2.0)
40
+ activesupport (7.2.1)
40
41
  base64
41
42
  bigdecimal
42
43
  concurrent-ruby (~> 1.0, >= 1.3.1)
@@ -53,8 +54,9 @@ GEM
53
54
  ast (2.4.2)
54
55
  backtrace (0.4.0)
55
56
  base64 (0.2.0)
56
- baza.rb (0.0.4)
57
+ baza.rb (0.0.8)
57
58
  backtrace (> 0)
59
+ elapsed (> 0)
58
60
  faraday (> 0)
59
61
  faraday-http-cache (> 0)
60
62
  faraday-multipart (> 0)
@@ -101,6 +103,9 @@ GEM
101
103
  diff-lcs (1.5.1)
102
104
  docile (1.4.1)
103
105
  drb (2.2.1)
106
+ elapsed (0.0.1)
107
+ loog (> 0)
108
+ tago (> 0)
104
109
  erubi (1.13.0)
105
110
  ethon (0.16.0)
106
111
  ffi (>= 1.15.0)
@@ -113,14 +118,14 @@ GEM
113
118
  others (> 0)
114
119
  tago (> 0)
115
120
  yaml (~> 0.3)
116
- faraday (2.10.1)
117
- faraday-net_http (>= 2.0, < 3.2)
121
+ faraday (2.11.0)
122
+ faraday-net_http (>= 2.0, < 3.4)
118
123
  logger
119
124
  faraday-http-cache (2.5.1)
120
125
  faraday (>= 0.8)
121
126
  faraday-multipart (1.0.4)
122
127
  multipart-post (~> 2)
123
- faraday-net_http (3.1.1)
128
+ faraday-net_http (3.3.0)
124
129
  net-http
125
130
  faraday-retry (2.2.1)
126
131
  faraday (~> 2.0)
@@ -142,13 +147,13 @@ GEM
142
147
  iri (0.8.0)
143
148
  json (2.7.2)
144
149
  language_server-protocol (3.17.0.3)
145
- logger (1.6.0)
150
+ logger (1.6.1)
146
151
  loofah (2.22.0)
147
152
  crass (~> 1.0.2)
148
153
  nokogiri (>= 1.12.0)
149
154
  loog (0.6.0)
150
155
  mini_mime (1.1.5)
151
- minitest (5.24.1)
156
+ minitest (5.25.1)
152
157
  minitest-reporters (1.7.1)
153
158
  ansi
154
159
  builder
@@ -175,7 +180,7 @@ GEM
175
180
  nokogiri (1.16.7-x86_64-linux)
176
181
  racc (~> 1.4)
177
182
  others (0.0.3)
178
- parallel (1.26.2)
183
+ parallel (1.26.3)
179
184
  parser (3.3.4.2)
180
185
  ast (~> 2.4.1)
181
186
  racc
@@ -198,9 +203,9 @@ GEM
198
203
  rails-html-sanitizer (1.6.0)
199
204
  loofah (~> 2.21)
200
205
  nokogiri (~> 1.14)
201
- railties (7.2.0)
202
- actionpack (= 7.2.0)
203
- activesupport (= 7.2.0)
206
+ railties (7.2.1)
207
+ actionpack (= 7.2.1)
208
+ activesupport (= 7.2.1)
204
209
  irb (~> 1.13)
205
210
  rackup (>= 1.0.0)
206
211
  rake (>= 12.2)
@@ -215,37 +220,36 @@ GEM
215
220
  reline (0.5.9)
216
221
  io-console (~> 0.5)
217
222
  retries (0.0.5)
218
- rexml (3.3.5)
223
+ rexml (3.3.6)
219
224
  strscan
220
- rspec-core (3.13.0)
225
+ rspec-core (3.13.1)
221
226
  rspec-support (~> 3.13.0)
222
- rspec-expectations (3.13.1)
227
+ rspec-expectations (3.13.2)
223
228
  diff-lcs (>= 1.2.0, < 2.0)
224
229
  rspec-support (~> 3.13.0)
225
230
  rspec-mocks (3.13.1)
226
231
  diff-lcs (>= 1.2.0, < 2.0)
227
232
  rspec-support (~> 3.13.0)
228
- rspec-rails (6.1.3)
229
- actionpack (>= 6.1)
230
- activesupport (>= 6.1)
231
- railties (>= 6.1)
233
+ rspec-rails (7.0.1)
234
+ actionpack (>= 7.0)
235
+ activesupport (>= 7.0)
236
+ railties (>= 7.0)
232
237
  rspec-core (~> 3.13)
233
238
  rspec-expectations (~> 3.13)
234
239
  rspec-mocks (~> 3.13)
235
240
  rspec-support (~> 3.13)
236
241
  rspec-support (3.13.1)
237
- rubocop (1.65.1)
242
+ rubocop (1.66.0)
238
243
  json (~> 2.3)
239
244
  language_server-protocol (>= 3.17.0)
240
245
  parallel (~> 1.10)
241
246
  parser (>= 3.3.0.2)
242
247
  rainbow (>= 2.2.2, < 4.0)
243
248
  regexp_parser (>= 2.4, < 3.0)
244
- rexml (>= 3.2.5, < 4.0)
245
- rubocop-ast (>= 1.31.1, < 2.0)
249
+ rubocop-ast (>= 1.32.1, < 2.0)
246
250
  ruby-progressbar (~> 1.7)
247
251
  unicode-display_width (>= 2.4.0, < 3.0)
248
- rubocop-ast (1.32.0)
252
+ rubocop-ast (1.32.1)
249
253
  parser (>= 3.3.1.0)
250
254
  rubocop-performance (1.21.1)
251
255
  rubocop (>= 1.48.1, < 2.0)
@@ -268,14 +272,18 @@ GEM
268
272
  sys-uname (1.3.0)
269
273
  ffi (~> 1.1)
270
274
  tago (0.0.2)
271
- thor (1.3.1)
275
+ thor (1.3.2)
272
276
  typhoeus (1.4.1)
273
277
  ethon (>= 0.9.0)
274
278
  tzinfo (2.0.6)
275
279
  concurrent-ruby (~> 1.0)
276
280
  unicode-display_width (2.5.0)
277
- uri (0.13.0)
281
+ uri (0.13.1)
278
282
  useragent (0.16.10)
283
+ w3c_validators (1.3.7)
284
+ json (>= 1.8)
285
+ nokogiri (~> 1.6)
286
+ rexml (~> 3.2)
279
287
  webmock (3.23.1)
280
288
  addressable (>= 2.8.0)
281
289
  crack (>= 0.3.2)
@@ -283,7 +291,7 @@ GEM
283
291
  webrick (1.8.1)
284
292
  yaml (0.3.0)
285
293
  yard (0.9.36)
286
- zeitwerk (2.6.17)
294
+ zeitwerk (2.6.18)
287
295
 
288
296
  PLATFORMS
289
297
  aarch64-linux
@@ -297,17 +305,18 @@ PLATFORMS
297
305
  DEPENDENCIES
298
306
  cucumber (= 9.2.0)
299
307
  judges!
300
- minitest (= 5.24.1)
308
+ minitest (= 5.25.1)
301
309
  minitest-reporters (= 1.7.1)
302
310
  net-ping (= 2.0.8)
303
311
  rake (= 13.2.1)
304
312
  random-port (~> 0.0)
305
- rspec-rails (= 6.1.3)
306
- rubocop (= 1.65.1)
313
+ rspec-rails (= 7.0.1)
314
+ rubocop (= 1.66.0)
307
315
  rubocop-performance (= 1.21.1)
308
316
  rubocop-rspec (= 3.0.4)
309
317
  simplecov (= 0.22.0)
310
318
  simplecov-cobertura (= 2.1.0)
319
+ w3c_validators (= 1.3.7)
311
320
  webmock (= 3.23.1)
312
321
  yard (= 0.9.36)
313
322
 
data/assets/index.xsl CHANGED
@@ -23,7 +23,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
23
  SOFTWARE.
24
24
  -->
25
25
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
26
- <xsl:output method="xml" doctype-system="about:legacy-compat" encoding="UTF-8" indent="yes"/>
26
+ <xsl:output method="xml" omit-xml-declaration="yes" encoding="UTF-8" indent="yes"/>
27
27
  <xsl:param name="title"/>
28
28
  <xsl:param name="date"/>
29
29
  <xsl:param name="version"/>
@@ -36,9 +36,11 @@ SOFTWARE.
36
36
  </script>
37
37
  </xsl:template>
38
38
  <xsl:template match="/">
39
+ <xsl:text disable-output-escaping='yes'>&lt;!DOCTYPE html&gt;</xsl:text>
39
40
  <html>
40
41
  <head>
41
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
42
+ <meta charset="UTF-8"/>
43
+ <meta content="width=device-width, initial-scale=1.0" name="viewport"/>
42
44
  <title>
43
45
  <xsl:choose>
44
46
  <xsl:when test="$title = ''">
@@ -49,8 +51,6 @@ SOFTWARE.
49
51
  </xsl:otherwise>
50
52
  </xsl:choose>
51
53
  </title>
52
- <meta charset="UTF-8"/>
53
- <meta content="width=device-width, initial-scale=1.0" name="viewport"/>
54
54
  <link rel="icon" href="https://www.zerocracy.com/svg/logo.svg" type="image/svg"/>
55
55
  <link href="https://cdn.jsdelivr.net/gh/yegor256/tacit@gh-pages/tacit-css.min.css" rel="stylesheet"/>
56
56
  <link href="https://cdn.jsdelivr.net/gh/yegor256/drops@gh-pages/drops.min.css" rel="stylesheet"/>
@@ -125,9 +125,21 @@ SOFTWARE.
125
125
  <xsl:text> bytes, version </xsl:text>
126
126
  <xsl:value-of select="fb/@version"/>
127
127
  <xsl:text>.</xsl:text>
128
+ <br/>
129
+ <span id="current-time">Loading current time...</span>
128
130
  </p>
129
131
  </footer>
130
132
  </section>
133
+ <script type="text/javascript">
134
+ function updateTime() {
135
+ const now = new Date();
136
+ const isoTime = now.toISOString();
137
+ const timeElement = document.getElementById('current-time');
138
+ timeElement.textContent = `Current time: ${isoTime}`;
139
+ }
140
+ updateTime();
141
+ setInterval(updateTime, 1000);
142
+ </script>
131
143
  </body>
132
144
  </html>
133
145
  </xsl:template>
@@ -143,7 +155,7 @@ SOFTWARE.
143
155
  <xsl:call-template name="th">
144
156
  <xsl:with-param name="cols" select="$columns"/>
145
157
  </xsl:call-template>
146
- </th>
158
+ </tr>
147
159
  </thead>
148
160
  <tbody>
149
161
  <xsl:apply-templates select="f"/>
@@ -185,7 +197,7 @@ SOFTWARE.
185
197
  </xsl:when>
186
198
  <xsl:otherwise>
187
199
  <th>
188
- <xsl:text>&nbsp;</xsl:text>
200
+ <xsl:text> </xsl:text>
189
201
  </th>
190
202
  </xsl:otherwise>
191
203
  </xsl:choose>
@@ -259,4 +271,4 @@ SOFTWARE.
259
271
  </xsl:otherwise>
260
272
  </xsl:choose>
261
273
  </xsl:template>
262
- </xsl:stylesheet>
274
+ </xsl:stylesheet>
@@ -8,5 +8,5 @@ Feature: Join
8
8
  Then I run bin/judges with "update . first.fb"
9
9
  Then I run bin/judges with "update . second.fb"
10
10
  Then I run bin/judges with "join first.fb second.fb"
11
- Then Stdout contains "joined"
12
- And Exit code is zero
11
+ Then Exit code is zero
12
+ And Stdout contains "joined"
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.25.2'
29
+ s.version = '0.26.1'
30
30
  s.license = 'MIT'
31
31
  s.summary = 'Command-Line Tool for a Factbase'
32
32
  s.description =
@@ -42,18 +42,19 @@ Gem::Specification.new do |s|
42
42
  s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
43
43
  s.rdoc_options = ['--charset=UTF-8']
44
44
  s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
45
- s.add_dependency 'backtrace', '~>0'
46
- s.add_dependency 'baza.rb', '~>0'
45
+ s.add_dependency 'backtrace', '>0'
46
+ s.add_dependency 'baza.rb', '>0'
47
47
  s.add_dependency 'concurrent-ruby', '~>1.2'
48
- s.add_dependency 'factbase', '~>0'
48
+ s.add_dependency 'elapsed', '>0'
49
+ s.add_dependency 'factbase', '>0'
49
50
  s.add_dependency 'gli', '~>2.21'
50
- s.add_dependency 'iri', '~>0'
51
- s.add_dependency 'loog', '~>0'
51
+ s.add_dependency 'iri', '>0'
52
+ s.add_dependency 'loog', '>0'
52
53
  s.add_dependency 'moments', '~>0.3'
53
54
  s.add_dependency 'nokogiri', '~>1.10'
54
- s.add_dependency 'others', '~>0'
55
- s.add_dependency 'retries', '~>0'
56
- s.add_dependency 'tago', '~>0'
55
+ s.add_dependency 'others', '>0'
56
+ s.add_dependency 'retries', '>0'
57
+ s.add_dependency 'tago', '>0'
57
58
  s.add_dependency 'typhoeus', '~>1.3'
58
59
  s.metadata['rubygems_mfa_required'] = 'true'
59
60
  end
@@ -20,10 +20,10 @@
20
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  # SOFTWARE.
22
22
 
23
+ require 'elapsed'
23
24
  require 'factbase/looged'
24
25
  require_relative '../../judges'
25
26
  require_relative '../../judges/impex'
26
- require_relative '../../judges/elapsed'
27
27
 
28
28
  # The +eval+ command.
29
29
  #
@@ -41,7 +41,7 @@ class Judges::Eval
41
41
  def run(_opts, args)
42
42
  raise 'Exactly two arguments required' unless args.size == 2
43
43
  impex = Judges::Impex.new(@loog, args[0])
44
- elapsed(@loog) do
44
+ elapsed(@loog, level: Logger::INFO) do
45
45
  $fb = impex.import(strict: false)
46
46
  $fb = Factbase::Looged.new($fb, @loog)
47
47
  expr = args[1]
@@ -20,12 +20,12 @@
20
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  # SOFTWARE.
22
22
 
23
+ require 'elapsed'
23
24
  require 'time'
24
25
  require 'factbase/looged'
25
26
  require_relative '../../judges'
26
27
  require_relative '../../judges/impex'
27
28
  require_relative '../../judges/to_rel'
28
- require_relative '../../judges/elapsed'
29
29
 
30
30
  # The +import+ command.
31
31
  #
@@ -43,7 +43,7 @@ class Judges::Import
43
43
  def run(_opts, args)
44
44
  raise 'Exactly two arguments required' unless args.size == 2
45
45
  raise "File not found #{args[0].to_rel}" unless File.exist?(args[0])
46
- elapsed(@loog) do
46
+ elapsed(@loog, level: Logger::INFO) do
47
47
  yaml = YAML.load_file(args[0], permitted_classes: [Time])
48
48
  @loog.info("YAML loaded from #{args[0].to_rel} (#{yaml.size} facts)")
49
49
  impex = Judges::Impex.new(@loog, args[1])
@@ -20,9 +20,9 @@
20
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  # SOFTWARE.
22
22
 
23
+ require 'elapsed'
23
24
  require_relative '../../judges'
24
25
  require_relative '../../judges/impex'
25
- require_relative '../../judges/elapsed'
26
26
 
27
27
  # The +join+ command.
28
28
  #
@@ -41,7 +41,7 @@ class Judges::Join
41
41
  raise 'Exactly two arguments required' unless args.size == 2
42
42
  master = Judges::Impex.new(@loog, args[0])
43
43
  slave = Judges::Impex.new(@loog, args[1])
44
- elapsed(@loog) do
44
+ elapsed(@loog, level: Logger::INFO) do
45
45
  fb = master.import
46
46
  slave.import_to(fb)
47
47
  master.export(fb)
@@ -24,9 +24,9 @@ require 'time'
24
24
  require 'fileutils'
25
25
  require 'factbase'
26
26
  require 'nokogiri'
27
+ require 'elapsed'
27
28
  require_relative '../../judges'
28
29
  require_relative '../../judges/impex'
29
- require_relative '../../judges/elapsed'
30
30
 
31
31
  # The +print+ command.
32
32
  #
@@ -64,7 +64,7 @@ class Judges::Print
64
64
  end
65
65
  @loog.debug("The factbase #{f.to_rel} is younger than the target #{o.to_rel}, need to print")
66
66
  end
67
- elapsed(@loog) do
67
+ elapsed(@loog, level: Logger::INFO) do
68
68
  output =
69
69
  case fmt
70
70
  when 'yaml'
@@ -92,7 +92,7 @@ class Judges::Print
92
92
  xslt = Nokogiri::XSLT(File.read(File.join(__dir__, '../../../assets/index.xsl')))
93
93
  require 'factbase/to_xml'
94
94
  xml = Factbase::ToXML.new(fb).xml
95
- xslt.transform(
95
+ xslt.apply_to(
96
96
  Nokogiri::XML(xml),
97
97
  Nokogiri::XSLT.quote_params(
98
98
  'title' => opts['title'],
@@ -23,6 +23,7 @@
23
23
  require 'typhoeus'
24
24
  require 'iri'
25
25
  require 'baza-rb'
26
+ require 'elapsed'
26
27
  require_relative '../../judges'
27
28
  require_relative '../../judges/impex'
28
29
 
@@ -53,7 +54,7 @@ class Judges::Pull
53
54
  retries: (opts['retries'] || 3).to_i
54
55
  )
55
56
  name = args[0]
56
- elapsed(@loog) do
57
+ elapsed(@loog, level: Logger::INFO) do
57
58
  if baza.name_exists?(name)
58
59
  baza.lock(name, opts['owner'])
59
60
  begin
@@ -23,6 +23,7 @@
23
23
  require 'typhoeus'
24
24
  require 'iri'
25
25
  require 'baza-rb'
26
+ require 'elapsed'
26
27
  require_relative '../../judges'
27
28
  require_relative '../../judges/impex'
28
29
 
@@ -52,9 +53,9 @@ class Judges::Push
52
53
  timeout: (opts['timeout'] || 30).to_i,
53
54
  loog: @loog,
54
55
  retries: (opts['retries'] || 3).to_i,
55
- compression: opts.fetch('zip', true)
56
+ compress: opts.fetch('zip', true)
56
57
  )
57
- elapsed(@loog) do
58
+ elapsed(@loog, level: Logger::INFO) do
58
59
  baza.lock(name, opts['owner'])
59
60
  begin
60
61
  id = baza.push(name, fb.export, opts['meta'] || [])
@@ -25,12 +25,12 @@ require 'factbase'
25
25
  require 'backtrace'
26
26
  require 'factbase/looged'
27
27
  require 'factbase/to_xml'
28
+ require 'elapsed'
28
29
  require_relative '../../judges'
29
30
  require_relative '../../judges/to_rel'
30
31
  require_relative '../../judges/judges'
31
32
  require_relative '../../judges/options'
32
33
  require_relative '../../judges/categories'
33
- require_relative '../../judges/elapsed'
34
34
 
35
35
  # The +test+ command.
36
36
  #
@@ -57,7 +57,7 @@ class Judges::Test
57
57
  tests = 0
58
58
  visible = []
59
59
  judges = Judges::Judges.new(dir, opts['lib'], @loog)
60
- elapsed(@loog) do
60
+ elapsed(@loog, level: Logger::INFO) do
61
61
  judges.each_with_index do |judge, i|
62
62
  visible << judge.name
63
63
  next unless include?(opts, judge.name)
@@ -21,9 +21,9 @@
21
21
  # SOFTWARE.
22
22
 
23
23
  require 'time'
24
+ require 'elapsed'
24
25
  require_relative '../../judges'
25
26
  require_relative '../../judges/impex'
26
- require_relative '../../judges/elapsed'
27
27
 
28
28
  # The +trim+ command.
29
29
  #
@@ -45,7 +45,7 @@ class Judges::Trim
45
45
  raise 'Exactly one argument required' unless args.size == 1
46
46
  impex = Judges::Impex.new(@loog, args[0])
47
47
  fb = impex.import
48
- elapsed(@loog) do
48
+ elapsed(@loog, level: Logger::INFO) do
49
49
  deleted = fb.query(opts['query']).delete!
50
50
  throw :'No facts deleted' if deleted.zero?
51
51
  impex.export(fb)
@@ -22,13 +22,13 @@
22
22
 
23
23
  require 'backtrace'
24
24
  require 'factbase/looged'
25
+ require 'elapsed'
25
26
  require_relative '../../judges'
26
27
  require_relative '../../judges/to_rel'
27
28
  require_relative '../../judges/judges'
28
29
  require_relative '../../judges/churn'
29
30
  require_relative '../../judges/options'
30
31
  require_relative '../../judges/impex'
31
- require_relative '../../judges/elapsed'
32
32
 
33
33
  # The +update+ command.
34
34
  #
@@ -63,7 +63,7 @@ class Judges::Update
63
63
  judges = Judges::Judges.new(dir, opts['lib'], @loog)
64
64
  c = 0
65
65
  churn = Judges::Churn.new(0, 0)
66
- elapsed(@loog) do
66
+ elapsed(@loog, level: Logger::INFO) do
67
67
  loop do
68
68
  c += 1
69
69
  if c > 1
@@ -105,11 +105,11 @@ class Judges::Update
105
105
  def cycle(opts, judges, fb, options)
106
106
  churn = Judges::Churn.new(0, 0)
107
107
  global = {}
108
- elapsed(@loog) do
108
+ elapsed(@loog, level: Logger::INFO) do
109
109
  done =
110
110
  judges.each_with_index do |p, i|
111
111
  @loog.info("\n👉 Running #{p.name} (##{i}) at #{p.dir.to_rel}...")
112
- elapsed(@loog) do
112
+ elapsed(@loog, level: Logger::INFO) do
113
113
  c = one_judge(fb, p, global, options)
114
114
  churn += c
115
115
  throw :"👍 The judge #{p.name} modified #{c} facts out of #{fb.size}"
data/lib/judges/impex.rb CHANGED
@@ -22,9 +22,9 @@
22
22
 
23
23
  require 'factbase'
24
24
  require 'fileutils'
25
+ require 'elapsed'
25
26
  require_relative '../judges'
26
27
  require_relative '../judges/to_rel'
27
- require_relative '../judges/elapsed'
28
28
 
29
29
  # Import/Export of factbases.
30
30
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
@@ -39,7 +39,7 @@ class Judges::Impex
39
39
  def import(strict: true)
40
40
  fb = Factbase.new
41
41
  if File.exist?(@file)
42
- elapsed(@loog) do
42
+ elapsed(@loog, level: Logger::INFO) do
43
43
  fb.import(File.binread(@file))
44
44
  throw :"The factbase imported from #{@file.to_rel} (#{File.size(@file)} bytes, #{fb.size} facts)"
45
45
  end
@@ -52,14 +52,14 @@ class Judges::Impex
52
52
 
53
53
  def import_to(fb)
54
54
  raise "The factbase is absent at #{@file.to_rel}" unless File.exist?(@file)
55
- elapsed(@loog) do
55
+ elapsed(@loog, level: Logger::INFO) do
56
56
  fb.import(File.binread(@file))
57
57
  throw :"The factbase loaded from #{@file.to_rel} (#{File.size(@file)} bytes, #{fb.size} facts)"
58
58
  end
59
59
  end
60
60
 
61
61
  def export(fb)
62
- elapsed(@loog) do
62
+ elapsed(@loog, level: Logger::INFO) do
63
63
  FileUtils.mkdir_p(File.dirname(@file))
64
64
  File.binwrite(@file, fb.export)
65
65
  throw :"Factbase exported to #{@file.to_rel} (#{File.size(@file)} bytes, #{fb.size} facts)"
data/lib/judges/judge.rb CHANGED
@@ -20,9 +20,9 @@
20
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  # SOFTWARE.
22
22
 
23
+ require 'elapsed'
23
24
  require_relative '../judges'
24
25
  require_relative '../judges/to_rel'
25
- require_relative '../judges/elapsed'
26
26
 
27
27
  # A single judge.
28
28
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
@@ -56,7 +56,7 @@ class Judges::Judge
56
56
  end
57
57
  s = File.join(@dir, script)
58
58
  raise "Can't load '#{s}'" unless File.exist?(s)
59
- elapsed(@loog) do
59
+ elapsed(@loog, intro: "#{$judge} finished", level: Logger::INFO) do
60
60
  load(s, true)
61
61
  ensure
62
62
  $fb = $judge = $options = $loog = nil
data/lib/judges.rb CHANGED
@@ -25,5 +25,5 @@
25
25
  # Copyright:: Copyright (c) 2024 Yegor Bugayenko
26
26
  # License:: MIT
27
27
  module Judges
28
- VERSION = '0.25.2'
28
+ VERSION = '0.26.1'
29
29
  end
@@ -42,12 +42,14 @@ class TestJoin < Minitest::Test
42
42
  fb2 = Factbase.new
43
43
  fb2.insert.foo_bar = 42
44
44
  File.binwrite(slave, fb2.export)
45
- Judges::Join.new(Loog::NULL).run({}, [master, slave])
45
+ loog = Loog::Buffer.new
46
+ Judges::Join.new(loog).run({}, [master, slave])
46
47
  fb = Factbase.new
47
48
  fb.import(File.binread(master))
48
49
  xml = Nokogiri::XML.parse(Factbase::ToXML.new(fb).xml)
49
50
  assert(!xml.xpath('/fb/f[zz="5"]').empty?, xml)
50
51
  assert(!xml.xpath('/fb/f[foo_bar="42"]').empty?, xml)
52
+ assert(loog.to_s.include?('Two factbases joined'), loog.to_s)
51
53
  end
52
54
  end
53
55
  end
@@ -23,9 +23,12 @@
23
23
  require 'minitest/autorun'
24
24
  require 'loog'
25
25
  require 'factbase'
26
+ require 'nokogiri'
26
27
  require 'yaml'
27
28
  require 'fileutils'
28
29
  require 'securerandom'
30
+ require 'w3c_validators'
31
+ require 'webmock/minitest'
29
32
  require_relative '../../lib/judges'
30
33
  require_relative '../../lib/judges/commands/print'
31
34
 
@@ -70,6 +73,21 @@ class TestPrint < Minitest::Test
70
73
  [f, html]
71
74
  )
72
75
  end
76
+ doc = File.read(html)
77
+ xml =
78
+ begin
79
+ Nokogiri::XML.parse(doc) do |c|
80
+ c.norecover
81
+ c.strict
82
+ end
83
+ rescue StandardError => e
84
+ raise "#{doc}\n\n#{e}"
85
+ end
86
+ assert(xml.errors.empty?, xml)
87
+ assert(!xml.xpath('/html').empty?, xml)
88
+ WebMock.enable_net_connect!
89
+ v = W3CValidators::NuValidator.new.validate_file(html)
90
+ assert(v.errors.empty?, "#{doc}\n\n#{v.errors.join('; ')}")
73
91
  end
74
92
 
75
93
  def test_print_all_formats
@@ -53,6 +53,17 @@ class TestPush < Minitest::Test
53
53
  },
54
54
  ['foo', file]
55
55
  )
56
+ Judges::Push.new(Loog::NULL).run(
57
+ {
58
+ 'token' => '000',
59
+ 'host' => 'example.org',
60
+ 'port' => 443,
61
+ 'ssl' => true,
62
+ 'owner' => 'none',
63
+ 'zip' => false
64
+ },
65
+ ['foo', file]
66
+ )
56
67
  end
57
68
  end
58
69
 
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: judges
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.25.2
4
+ version: 0.26.1
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-14 00:00:00.000000000 Z
11
+ date: 2024-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backtrace
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: baza.rb
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
@@ -52,18 +52,32 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.2'
55
+ - !ruby/object:Gem::Dependency
56
+ name: elapsed
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">"
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">"
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: factbase
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - "~>"
73
+ - - ">"
60
74
  - !ruby/object:Gem::Version
61
75
  version: '0'
62
76
  type: :runtime
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - "~>"
80
+ - - ">"
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0'
69
83
  - !ruby/object:Gem::Dependency
@@ -84,28 +98,28 @@ dependencies:
84
98
  name: iri
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
- - - "~>"
101
+ - - ">"
88
102
  - !ruby/object:Gem::Version
89
103
  version: '0'
90
104
  type: :runtime
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
- - - "~>"
108
+ - - ">"
95
109
  - !ruby/object:Gem::Version
96
110
  version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: loog
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
- - - "~>"
115
+ - - ">"
102
116
  - !ruby/object:Gem::Version
103
117
  version: '0'
104
118
  type: :runtime
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
- - - "~>"
122
+ - - ">"
109
123
  - !ruby/object:Gem::Version
110
124
  version: '0'
111
125
  - !ruby/object:Gem::Dependency
@@ -140,42 +154,42 @@ dependencies:
140
154
  name: others
141
155
  requirement: !ruby/object:Gem::Requirement
142
156
  requirements:
143
- - - "~>"
157
+ - - ">"
144
158
  - !ruby/object:Gem::Version
145
159
  version: '0'
146
160
  type: :runtime
147
161
  prerelease: false
148
162
  version_requirements: !ruby/object:Gem::Requirement
149
163
  requirements:
150
- - - "~>"
164
+ - - ">"
151
165
  - !ruby/object:Gem::Version
152
166
  version: '0'
153
167
  - !ruby/object:Gem::Dependency
154
168
  name: retries
155
169
  requirement: !ruby/object:Gem::Requirement
156
170
  requirements:
157
- - - "~>"
171
+ - - ">"
158
172
  - !ruby/object:Gem::Version
159
173
  version: '0'
160
174
  type: :runtime
161
175
  prerelease: false
162
176
  version_requirements: !ruby/object:Gem::Requirement
163
177
  requirements:
164
- - - "~>"
178
+ - - ">"
165
179
  - !ruby/object:Gem::Version
166
180
  version: '0'
167
181
  - !ruby/object:Gem::Dependency
168
182
  name: tago
169
183
  requirement: !ruby/object:Gem::Requirement
170
184
  requirements:
171
- - - "~>"
185
+ - - ">"
172
186
  - !ruby/object:Gem::Version
173
187
  version: '0'
174
188
  type: :runtime
175
189
  prerelease: false
176
190
  version_requirements: !ruby/object:Gem::Requirement
177
191
  requirements:
178
- - - "~>"
192
+ - - ">"
179
193
  - !ruby/object:Gem::Version
180
194
  version: '0'
181
195
  - !ruby/object:Gem::Dependency
@@ -257,7 +271,6 @@ files:
257
271
  - lib/judges/commands/test.rb
258
272
  - lib/judges/commands/trim.rb
259
273
  - lib/judges/commands/update.rb
260
- - lib/judges/elapsed.rb
261
274
  - lib/judges/impex.rb
262
275
  - lib/judges/judge.rb
263
276
  - lib/judges/judges.rb
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Copyright (c) 2024 Yegor Bugayenko
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the 'Software'), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
22
-
23
- require 'tago'
24
-
25
- def elapsed(loog)
26
- start = Time.now
27
- begin
28
- yield
29
- rescue UncaughtThrowError => e
30
- tag = e.tag
31
- throw e unless tag.is_a?(Symbol)
32
- loog.info("#{tag} in #{start.ago}")
33
- end
34
- end