judges 0.42.0 → 0.43.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 +4 -4
- data/.github/workflows/eslint.yml +2 -3
- data/.github/workflows/markdown-lint.yml +1 -1
- data/.github/workflows/typos.yml +19 -0
- data/.gitignore +3 -2
- data/Gemfile.lock +14 -11
- data/README.md +3 -3
- data/REUSE.toml +7 -7
- data/assets/index.js +3 -3
- data/bin/judges +47 -45
- data/features/import.feature +1 -1
- data/features/test.feature +2 -2
- data/features/update.feature +5 -5
- data/judges.gemspec +1 -1
- data/lib/judges/commands/eval.rb +7 -1
- data/lib/judges/commands/import.rb +7 -1
- data/lib/judges/commands/inspect.rb +7 -1
- data/lib/judges/commands/join.rb +7 -1
- data/lib/judges/commands/print.rb +6 -3
- data/lib/judges/commands/pull.rb +7 -4
- data/lib/judges/commands/push.rb +5 -2
- data/lib/judges/commands/test.rb +8 -5
- data/lib/judges/commands/trim.rb +6 -3
- data/lib/judges/commands/update.rb +14 -4
- data/lib/judges/impex.rb +11 -0
- data/lib/judges/judge.rb +1 -1
- data/lib/judges/judges.rb +16 -5
- data/lib/judges/options.rb +7 -0
- data/lib/judges/to_rel.rb +1 -0
- data/lib/judges.rb +1 -1
- data/package-lock.json +413 -409
- data/package.json +3 -2
- data/test/commands/test_update.rb +15 -0
- data/test/test__helper.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9872185eca6e28654c9ee3395817985e8762408d022d961e189cbfcfab7c2ac8
|
4
|
+
data.tar.gz: 0c83c8a61f2661a17f8473469920b7e7c493be4d30e8f2f1bca7f3afaf6e6049
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76d8a0e542efee6b6e444857b4e1dbe3ff40ddb482f3f109e1170a8f9281021d5ff1952ac74d53aad513aaf3e87441f39080ec6c6adda0300c06566d37b85b9c
|
7
|
+
data.tar.gz: 6222dc327c05ee568395feb6c0b05ba37a5a152ac7d4d51b2be71b7be0262617ac82160491e13b90330729b10e6104e11fd3f50ce3ff8ea3ed47598057a4b9a5
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
2
|
+
# SPDX-License-Identifier: MIT
|
3
|
+
---
|
4
|
+
# yamllint disable rule:line-length
|
5
|
+
name: typos
|
6
|
+
'on':
|
7
|
+
push:
|
8
|
+
branches:
|
9
|
+
- master
|
10
|
+
pull_request:
|
11
|
+
branches:
|
12
|
+
- master
|
13
|
+
jobs:
|
14
|
+
typos:
|
15
|
+
timeout-minutes: 15
|
16
|
+
runs-on: ubuntu-24.04
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v4
|
19
|
+
- uses: crate-ci/typos@v1.32.0
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -73,14 +73,15 @@ GEM
|
|
73
73
|
cucumber-tag-expressions (6.1.2)
|
74
74
|
date (3.4.1)
|
75
75
|
decoor (0.0.1)
|
76
|
-
diff-lcs (1.6.
|
76
|
+
diff-lcs (1.6.2)
|
77
77
|
docile (1.4.1)
|
78
78
|
elapsed (0.0.1)
|
79
79
|
loog (> 0)
|
80
80
|
tago (> 0)
|
81
|
+
erb (5.0.1)
|
81
82
|
ethon (0.16.0)
|
82
83
|
ffi (>= 1.15.0)
|
83
|
-
factbase (0.10.
|
84
|
+
factbase (0.10.2)
|
84
85
|
backtrace (~> 0.4)
|
85
86
|
decoor (~> 0.0)
|
86
87
|
json (~> 2.7)
|
@@ -111,15 +112,16 @@ GEM
|
|
111
112
|
ffi (1.17.2-x86_64-linux-gnu)
|
112
113
|
gli (2.22.2)
|
113
114
|
ostruct
|
114
|
-
hashdiff (1.
|
115
|
+
hashdiff (1.2.0)
|
115
116
|
iri (0.10.0)
|
116
|
-
json (2.
|
117
|
-
language_server-protocol (3.17.0.
|
117
|
+
json (2.12.0)
|
118
|
+
language_server-protocol (3.17.0.5)
|
118
119
|
lint_roller (1.1.0)
|
119
120
|
logger (1.7.0)
|
120
|
-
loog (0.6.
|
121
|
+
loog (0.6.1)
|
122
|
+
logger (~> 1.0)
|
121
123
|
mini_mime (1.1.5)
|
122
|
-
mini_portile2 (2.8.
|
124
|
+
mini_portile2 (2.8.9)
|
123
125
|
minitest (5.25.5)
|
124
126
|
minitest-reporters (1.7.1)
|
125
127
|
ansi
|
@@ -157,11 +159,11 @@ GEM
|
|
157
159
|
ast (~> 2.4.1)
|
158
160
|
racc
|
159
161
|
prism (1.4.0)
|
160
|
-
psych (5.2.
|
162
|
+
psych (5.2.6)
|
161
163
|
date
|
162
164
|
stringio
|
163
165
|
public_suffix (6.0.2)
|
164
|
-
qbash (0.4.
|
166
|
+
qbash (0.4.5)
|
165
167
|
backtrace (> 0)
|
166
168
|
elapsed (> 0)
|
167
169
|
loog (> 0)
|
@@ -171,12 +173,13 @@ GEM
|
|
171
173
|
rake (13.2.1)
|
172
174
|
random-port (0.7.5)
|
173
175
|
tago (> 0)
|
174
|
-
rdoc (6.
|
176
|
+
rdoc (6.14.0)
|
177
|
+
erb
|
175
178
|
psych (>= 4.0.0)
|
176
179
|
regexp_parser (2.10.0)
|
177
180
|
retries (0.0.5)
|
178
181
|
rexml (3.4.1)
|
179
|
-
rubocop (1.75.
|
182
|
+
rubocop (1.75.6)
|
180
183
|
json (~> 2.3)
|
181
184
|
language_server-protocol (~> 3.17.0.2)
|
182
185
|
lint_roller (~> 1.1.0)
|
data/README.md
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
[](https://github.com/yegor256/judges/blob/master/LICENSE.txt)
|
13
13
|
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fyegor256%2Fjudges?ref=badge_shield&issueType=license)
|
14
14
|
|
15
|
-
A command line tool and a Ruby gem for running so
|
15
|
+
A command line tool and a Ruby gem for running so-called judges against a
|
16
16
|
[factbase](https://github.com/yegor256/factbase).
|
17
17
|
|
18
18
|
Every "judge" is a directory with a single `.rb` file and a number
|
@@ -64,10 +64,10 @@ via the command line `--option` flag of the `update` command; and `expected` is
|
|
64
64
|
an array of XPath expressions that must be present in the XML of the Factbase
|
65
65
|
when the test is finished.
|
66
66
|
|
67
|
-
The `category` (default: `[]`) may have one or an array of categories,
|
67
|
+
The `category` (default: `[]`) may have one category or an array of categories,
|
68
68
|
which then may be turned on via the `--category` command line flag.
|
69
69
|
|
70
|
-
The `repeat` (default: `1`) makes `input` to be repeated multiple times
|
70
|
+
The `repeat` (default: `1`) makes the `input` to be repeated multiple times
|
71
71
|
(mostly useful for speed measuring on big data inputs).
|
72
72
|
|
73
73
|
The `runs` (default: `1`) is the number of times the `.rb` script should
|
data/REUSE.toml
CHANGED
@@ -4,10 +4,17 @@
|
|
4
4
|
version = 1
|
5
5
|
[[annotations]]
|
6
6
|
path = [
|
7
|
+
".DS_Store",
|
8
|
+
".gitattributes",
|
9
|
+
".gitignore",
|
10
|
+
".pdd",
|
7
11
|
"**.json",
|
8
12
|
"**.md",
|
9
13
|
"**.png",
|
10
14
|
"**.txt",
|
15
|
+
"**/.DS_Store",
|
16
|
+
"**/.gitignore",
|
17
|
+
"**/.pdd",
|
11
18
|
"**/*.csv",
|
12
19
|
"**/*.jpg",
|
13
20
|
"**/*.json",
|
@@ -17,15 +24,8 @@ path = [
|
|
17
24
|
"**/*.svg",
|
18
25
|
"**/*.txt",
|
19
26
|
"**/*.vm",
|
20
|
-
"**/.DS_Store",
|
21
|
-
"**/.gitignore",
|
22
|
-
"**/.pdd",
|
23
27
|
"**/CNAME",
|
24
28
|
"**/Gemfile.lock",
|
25
|
-
".DS_Store",
|
26
|
-
".gitattributes",
|
27
|
-
".gitignore",
|
28
|
-
".pdd",
|
29
29
|
"Gemfile.lock",
|
30
30
|
"README.md",
|
31
31
|
"renovate.json",
|
data/assets/index.js
CHANGED
data/bin/judges
CHANGED
@@ -23,7 +23,7 @@ class JudgesGLI extend GLI::App
|
|
23
23
|
start = Time.now
|
24
24
|
@@loog.debug("Running '#{ruby}' command...")
|
25
25
|
Object.const_get("Judges::#{ruby.capitalize}").new(@@loog).run(options, args)
|
26
|
-
@@loog.debug("Command '#{ruby}'
|
26
|
+
@@loog.debug("Command '#{ruby}' completed in #{start.ago}")
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
@@ -37,9 +37,9 @@ class JudgesGLI extend GLI::App
|
|
37
37
|
|
38
38
|
subcommand_option_handling(:normal)
|
39
39
|
|
40
|
-
desc '
|
40
|
+
desc 'Enable verbose mode with maximum logging'
|
41
41
|
switch([:v, :verbose])
|
42
|
-
desc '
|
42
|
+
desc 'Specify Factbase version to use'
|
43
43
|
flag([:factbase], type: String)
|
44
44
|
|
45
45
|
pre do |global, command, options, args|
|
@@ -61,36 +61,38 @@ class JudgesGLI extend GLI::App
|
|
61
61
|
true
|
62
62
|
end
|
63
63
|
|
64
|
-
desc 'Update the factbase by
|
64
|
+
desc 'Update the factbase by executing all judges sequentially'
|
65
65
|
command :update do |c|
|
66
|
-
c.desc 'Options to pass to
|
66
|
+
c.desc 'Options to pass to each judge'
|
67
67
|
c.flag([:o, :option], multiple: true, arg_name: '<key=value>')
|
68
|
-
c.desc 'File
|
68
|
+
c.desc 'File containing options, one key=value pair per line'
|
69
69
|
c.flag([:'options-file'])
|
70
70
|
c.desc 'Name of the judge to run (directory name)'
|
71
71
|
c.flag([:judge], multiple: true)
|
72
|
-
c.desc '
|
72
|
+
c.desc 'Location of a Ruby library (directory with .rb files to include)'
|
73
73
|
c.flag([:lib])
|
74
|
-
c.desc 'Shuffle
|
74
|
+
c.desc 'Shuffle judges, except those starting with the specified prefix'
|
75
75
|
c.flag([:shuffle], default_value: '')
|
76
|
-
c.desc '
|
76
|
+
c.desc 'Prioritize a judge to run before all others'
|
77
77
|
c.flag([:boost], multiple: true)
|
78
|
-
c.desc 'Maximum time in seconds
|
78
|
+
c.desc 'Maximum time in seconds for the entire update cycle'
|
79
79
|
c.flag([:lifetime], default_value: 300, type: Integer)
|
80
|
-
c.desc 'Maximum time in seconds
|
80
|
+
c.desc 'Maximum time in seconds for each judge (forcefully terminates if exceeded)'
|
81
81
|
c.flag([:timeout], default_value: 30, type: Integer)
|
82
82
|
c.desc 'Maximum number of update cycles to run'
|
83
83
|
c.flag([:'max-cycles'], default_value: 8, type: Integer)
|
84
|
-
c.desc '
|
84
|
+
c.desc 'Suppress errors even when judges fail'
|
85
85
|
c.switch([:q, :quiet], default_value: false)
|
86
|
-
c.desc '
|
86
|
+
c.desc 'Stop processing immediately after the first error'
|
87
|
+
c.switch([:'fail-fast'], default_value: false)
|
88
|
+
c.desc 'Add a summary fact to the factbase'
|
87
89
|
c.switch([:summary], default_value: false)
|
88
90
|
c.desc 'Use default logging facility'
|
89
91
|
c.switch([:log], default_value: true)
|
90
92
|
run_it(c, 'update')
|
91
93
|
end
|
92
94
|
|
93
|
-
desc 'Evaluate a single Ruby expression
|
95
|
+
desc 'Evaluate a single Ruby expression against the factbase'
|
94
96
|
command :eval do |c|
|
95
97
|
c.desc 'Use default logging facility'
|
96
98
|
c.switch([:log], default_value: true)
|
@@ -109,40 +111,40 @@ class JudgesGLI extend GLI::App
|
|
109
111
|
run_it(c, 'import')
|
110
112
|
end
|
111
113
|
|
112
|
-
desc 'Remove
|
114
|
+
desc 'Remove outdated facts from the factbase'
|
113
115
|
command :trim do |c|
|
114
|
-
c.desc '
|
116
|
+
c.desc 'Delete only facts matching the specified expression'
|
115
117
|
c.flag([:query], default_value: '(never)')
|
116
118
|
run_it(c, 'trim')
|
117
119
|
end
|
118
120
|
|
119
|
-
desc '
|
121
|
+
desc 'Convert the factbase to a human-readable format (YAML, JSON, etc.)'
|
120
122
|
command :print do |c|
|
121
123
|
c.desc 'Output format (xml, json, or yaml)'
|
122
124
|
c.flag([:format], default_value: 'yaml')
|
123
|
-
c.desc '
|
125
|
+
c.desc 'Automatically generate the output filename'
|
124
126
|
c.switch([:auto], default_value: false)
|
125
|
-
c.desc '
|
127
|
+
c.desc 'Document title to use'
|
126
128
|
c.flag([:title], default_value: 'summary')
|
127
|
-
c.desc '
|
129
|
+
c.desc 'Print only facts matching the specified expression'
|
128
130
|
c.flag([:query], default_value: '(always)')
|
129
|
-
c.desc 'Comma
|
131
|
+
c.desc 'Comma-separated list of columns to display in HTML output (no spaces)'
|
130
132
|
c.flag([:columns], default_value: 'when,what')
|
131
|
-
c.desc 'Comma
|
133
|
+
c.desc 'Comma-separated list of columns to hide from rendering (no spaces)'
|
132
134
|
c.flag([:hidden], default_value: '_id,_time,_version,_job')
|
133
|
-
c.desc '
|
135
|
+
c.desc 'Force printing even if the target file exists and is older than the factbase'
|
134
136
|
c.switch([:force], default_value: false)
|
135
137
|
run_it(c, 'print')
|
136
138
|
end
|
137
139
|
|
138
|
-
desc 'Inspect the factbase and
|
140
|
+
desc 'Inspect the factbase and display all available metadata'
|
139
141
|
command :inspect do |c|
|
140
142
|
run_it(c, 'inspect')
|
141
143
|
end
|
142
144
|
|
143
145
|
desc 'Run automated tests for all judges'
|
144
146
|
command :test do |c|
|
145
|
-
c.desc 'Options to pass to
|
147
|
+
c.desc 'Options to pass to each judge (may be overridden by YAML)'
|
146
148
|
c.flag([:o, :option], multiple: true, arg_name: '<key=value>')
|
147
149
|
c.desc 'Categories of tests to disable'
|
148
150
|
c.flag([:disable], multiple: true)
|
@@ -150,57 +152,57 @@ class JudgesGLI extend GLI::App
|
|
150
152
|
c.flag([:enable], multiple: true)
|
151
153
|
c.desc 'Name of the judge to run (directory name)'
|
152
154
|
c.flag([:judge], multiple: true)
|
153
|
-
c.desc '
|
155
|
+
c.desc 'Number of times to run the tests'
|
154
156
|
c.flag([:runs], type: Integer)
|
155
|
-
c.desc '
|
157
|
+
c.desc 'Location of a Ruby library (directory with .rb files to include)'
|
156
158
|
c.flag([:lib])
|
157
|
-
c.desc '
|
159
|
+
c.desc 'Suppress output even if tests fail or none are executed'
|
158
160
|
c.switch([:quiet], default_value: false)
|
159
161
|
c.desc 'Use default logging facility'
|
160
162
|
c.switch([:log], default_value: true)
|
161
163
|
run_it(c, 'test')
|
162
164
|
end
|
163
165
|
|
164
|
-
desc 'Push the factbase to the server and unlock it
|
166
|
+
desc 'Push the factbase to the server and unlock it remotely'
|
165
167
|
command :push do |c|
|
166
168
|
c.desc 'Authentication token'
|
167
169
|
c.flag([:token])
|
168
|
-
c.desc '
|
170
|
+
c.desc 'Server IP/hostname'
|
169
171
|
c.flag([:host], default_value: 'api.zerocracy.com')
|
170
|
-
c.desc '
|
172
|
+
c.desc 'Server TCP port number'
|
171
173
|
c.flag([:port], default_value: 443, type: Integer)
|
172
|
-
c.desc 'Connection and read
|
174
|
+
c.desc 'Connection and read timeout in seconds'
|
173
175
|
c.flag([:timeout], default_value: 30, type: Integer)
|
174
|
-
c.desc '
|
176
|
+
c.desc 'Enable SSL connection'
|
175
177
|
c.switch([:ssl], default_value: true)
|
176
|
-
c.desc '
|
178
|
+
c.desc 'Unique identifier for lock/unlock operations'
|
177
179
|
c.flag([:owner], default_value: 'default', type: String)
|
178
|
-
c.desc '
|
180
|
+
c.desc 'Additional metadata for the upload (key:value format)'
|
179
181
|
c.flag([:meta], type: String, multiple: true)
|
180
|
-
c.desc '
|
182
|
+
c.desc 'Number of retry attempts'
|
181
183
|
c.flag([:retries], type: Integer, default_value: 3)
|
182
|
-
c.desc '
|
184
|
+
c.desc 'Enable package compression'
|
183
185
|
c.switch([:zip], default_value: true)
|
184
186
|
run_it(c, 'push')
|
185
187
|
end
|
186
188
|
|
187
|
-
desc 'Pull the factbase from the server and lock it
|
189
|
+
desc 'Pull the factbase from the server and lock it remotely'
|
188
190
|
command :pull do |c|
|
189
191
|
c.desc 'Authentication token'
|
190
192
|
c.flag([:token])
|
191
|
-
c.desc '
|
193
|
+
c.desc 'Maximum wait time in seconds'
|
192
194
|
c.flag([:wait], default_value: 10 * 60, arg_name: '<seconds>', type: Integer)
|
193
|
-
c.desc '
|
195
|
+
c.desc 'Server IP/hostname'
|
194
196
|
c.flag([:host], default_value: 'api.zerocracy.com')
|
195
|
-
c.desc '
|
197
|
+
c.desc 'Server TCP port number'
|
196
198
|
c.flag([:port], default_value: 443, type: Integer)
|
197
|
-
c.desc 'Connection and read
|
199
|
+
c.desc 'Connection and read timeout in seconds'
|
198
200
|
c.flag([:timeout], default_value: 30, type: Integer)
|
199
|
-
c.desc '
|
201
|
+
c.desc 'Enable SSL connection'
|
200
202
|
c.switch([:ssl], default_value: true)
|
201
|
-
c.desc '
|
203
|
+
c.desc 'Unique identifier for lock/unlock operations'
|
202
204
|
c.flag([:owner], default_value: 'default', type: String)
|
203
|
-
c.desc '
|
205
|
+
c.desc 'Number of retry attempts'
|
204
206
|
c.flag([:retries], type: Integer, default_value: 3)
|
205
207
|
run_it(c, 'pull')
|
206
208
|
end
|
data/features/import.feature
CHANGED
data/features/test.feature
CHANGED
@@ -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.10.
|
19
|
+
When I run bin/judges with "--factbase 0.10.2 --verbose test --judge guess ./fixtures"
|
20
20
|
Then Exit code is zero
|
21
|
-
And Stdout contains "Factbase version to be used: '0.10.
|
21
|
+
And Stdout contains "Factbase version to be used: '0.10.2'"
|
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/features/update.feature
CHANGED
@@ -15,7 +15,7 @@ Feature: Update
|
|
15
15
|
Then Stdout contains "FOO → "
|
16
16
|
Then Stdout contains "BAR → "
|
17
17
|
Then Stdout contains "1 judge(s) processed"
|
18
|
-
Then Stdout contains "Update
|
18
|
+
Then Stdout contains "Update completed in 3 cycle(s), did 3i/0d/3a"
|
19
19
|
And Exit code is zero
|
20
20
|
|
21
21
|
Scenario: Generate a summary fact, with errors
|
@@ -39,7 +39,7 @@ Feature: Update
|
|
39
39
|
"""
|
40
40
|
Then I run bin/judges with "--verbose update --quiet --lifetime 1 --max-cycles 5 . simple.fb"
|
41
41
|
Then Stdout contains "The 'simple' judge skipped, no time left"
|
42
|
-
Then Stdout contains "Update
|
42
|
+
Then Stdout contains "Update completed in 2 cycle(s), did 1i/0d/0a"
|
43
43
|
And Exit code is zero
|
44
44
|
|
45
45
|
Scenario: Use options from a file
|
@@ -57,7 +57,7 @@ Feature: Update
|
|
57
57
|
Then Stdout contains "A1 → "
|
58
58
|
Then Stdout contains "A2 → "
|
59
59
|
Then Stdout contains "1 judge(s) processed"
|
60
|
-
Then Stdout contains "Update
|
60
|
+
Then Stdout contains "Update completed"
|
61
61
|
And Exit code is zero
|
62
62
|
|
63
63
|
Scenario: Simple run with a timeout for a judge
|
@@ -71,7 +71,7 @@ Feature: Update
|
|
71
71
|
Then Stdout contains "execution expired"
|
72
72
|
Then Stdout contains "judge timed out after"
|
73
73
|
Then Stdout contains "1 judge(s) processed"
|
74
|
-
Then Stdout contains "Update
|
74
|
+
Then Stdout contains "Update completed in 1 cycle(s), did 0i/0d/0a"
|
75
75
|
And Exit code is zero
|
76
76
|
|
77
77
|
Scenario: Simple run of a few judges, with a lib
|
@@ -87,7 +87,7 @@ Feature: Update
|
|
87
87
|
"""
|
88
88
|
Then I run bin/judges with "update --lib mylib --max-cycles 1 mine simple.fb"
|
89
89
|
Then Stdout contains "1 judge(s) processed"
|
90
|
-
Then Stdout contains "Update
|
90
|
+
Then Stdout contains "Update completed in 1 cycle(s)"
|
91
91
|
And Exit code is zero
|
92
92
|
|
93
93
|
Scenario: The update fails when a bug in a judge
|
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.
|
12
|
+
s.version = '0.43.0'
|
13
13
|
s.license = 'MIT'
|
14
14
|
s.summary = 'Command-Line Tool for a Factbase'
|
15
15
|
s.description =
|
data/lib/judges/commands/eval.rb
CHANGED
@@ -16,10 +16,16 @@ require_relative '../../judges/impex'
|
|
16
16
|
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
17
17
|
# License:: MIT
|
18
18
|
class Judges::Eval
|
19
|
+
# Initialize.
|
20
|
+
# @param [Loog] loog Logging facility
|
19
21
|
def initialize(loog)
|
20
22
|
@loog = loog
|
21
23
|
end
|
22
24
|
|
25
|
+
# Run the eval command (called by the +bin/judges+ script).
|
26
|
+
# @param [Hash] opts Command line options (start with '--')
|
27
|
+
# @param [Array] args List of command line arguments
|
28
|
+
# @raise [RuntimeError] If not exactly two arguments provided
|
23
29
|
def run(opts, args)
|
24
30
|
raise 'Exactly two arguments required' unless args.size == 2
|
25
31
|
impex = Judges::Impex.new(@loog, args[0])
|
@@ -34,7 +40,7 @@ class Judges::Eval
|
|
34
40
|
eval(expr)
|
35
41
|
# rubocop:enable Security/Eval
|
36
42
|
impex.export($fb)
|
37
|
-
throw :'Evaluated successfully'
|
43
|
+
throw :'👍 Evaluated successfully'
|
38
44
|
end
|
39
45
|
end
|
40
46
|
end
|
@@ -18,10 +18,16 @@ require_relative '../../judges/to_rel'
|
|
18
18
|
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
19
19
|
# License:: MIT
|
20
20
|
class Judges::Import
|
21
|
+
# Initialize.
|
22
|
+
# @param [Loog] loog Logging facility
|
21
23
|
def initialize(loog)
|
22
24
|
@loog = loog
|
23
25
|
end
|
24
26
|
|
27
|
+
# Run the import command (called by the +bin/judges+ script).
|
28
|
+
# @param [Hash] opts Command line options (start with '--')
|
29
|
+
# @param [Array] args List of command line arguments
|
30
|
+
# @raise [RuntimeError] If not exactly two arguments provided or file not found
|
25
31
|
def run(opts, args)
|
26
32
|
raise 'Exactly two arguments required' unless args.size == 2
|
27
33
|
raise "File not found #{args[0].to_rel}" unless File.exist?(args[0])
|
@@ -41,7 +47,7 @@ class Judges::Import
|
|
41
47
|
end
|
42
48
|
end
|
43
49
|
impex.export(fb)
|
44
|
-
throw :"Import of #{yaml.size} facts
|
50
|
+
throw :"👍 Import of #{yaml.size} facts completed"
|
45
51
|
end
|
46
52
|
end
|
47
53
|
end
|
@@ -15,12 +15,18 @@ require_relative '../../judges/impex'
|
|
15
15
|
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
16
16
|
# License:: MIT
|
17
17
|
class Judges::Inspect
|
18
|
+
# Initialize.
|
19
|
+
# @param [Loog] loog Logging facility
|
18
20
|
def initialize(loog)
|
19
21
|
@loog = loog
|
20
22
|
end
|
21
23
|
|
24
|
+
# Run the inspect command (called by the +bin/judges+ script).
|
25
|
+
# @param [Hash] _opts Command line options (not used)
|
26
|
+
# @param [Array] args List of command line arguments
|
27
|
+
# @raise [RuntimeError] If no arguments provided
|
22
28
|
def run(_opts, args)
|
23
|
-
raise 'At
|
29
|
+
raise 'At least one argument required' if args.empty?
|
24
30
|
fb = Judges::Impex.new(@loog, args[0]).import
|
25
31
|
@loog.info("Facts: #{fb.size}")
|
26
32
|
end
|
data/lib/judges/commands/join.rb
CHANGED
@@ -16,10 +16,16 @@ require_relative '../../judges/impex'
|
|
16
16
|
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
17
17
|
# License:: MIT
|
18
18
|
class Judges::Join
|
19
|
+
# Initialize.
|
20
|
+
# @param [Loog] loog Logging facility
|
19
21
|
def initialize(loog)
|
20
22
|
@loog = loog
|
21
23
|
end
|
22
24
|
|
25
|
+
# Run the join command (called by the +bin/judges+ script).
|
26
|
+
# @param [Hash] _opts Command line options (not used)
|
27
|
+
# @param [Array] args List of command line arguments
|
28
|
+
# @raise [RuntimeError] If not exactly two arguments provided
|
23
29
|
def run(_opts, args)
|
24
30
|
raise 'Exactly two arguments required' unless args.size == 2
|
25
31
|
master = Judges::Impex.new(@loog, args[0])
|
@@ -28,7 +34,7 @@ class Judges::Join
|
|
28
34
|
fb = master.import
|
29
35
|
slave.import_to(fb)
|
30
36
|
master.export(fb)
|
31
|
-
throw :'Two factbases joined'
|
37
|
+
throw :'👍 Two factbases joined successfully'
|
32
38
|
end
|
33
39
|
end
|
34
40
|
end
|
@@ -23,15 +23,18 @@ require_relative '../../judges/impex'
|
|
23
23
|
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
24
24
|
# License:: MIT
|
25
25
|
class Judges::Print
|
26
|
+
# Initialize.
|
27
|
+
# @param [Loog] loog Logging facility
|
26
28
|
def initialize(loog)
|
27
29
|
@loog = loog
|
28
30
|
end
|
29
31
|
|
30
|
-
# Run
|
32
|
+
# Run the print command (called by the +bin/judges+ script).
|
31
33
|
# @param [Hash] opts Command line options (start with '--')
|
32
34
|
# @param [Array] args List of command line arguments
|
35
|
+
# @raise [RuntimeError] If no arguments provided
|
33
36
|
def run(opts, args)
|
34
|
-
raise 'At
|
37
|
+
raise 'At least one argument required' if args.empty?
|
35
38
|
f = args[0]
|
36
39
|
fb = Judges::Impex.new(@loog, f).import
|
37
40
|
fb.query("(not #{opts['query']})").delete! unless opts['query'].nil?
|
@@ -68,7 +71,7 @@ class Judges::Print
|
|
68
71
|
raise "Unknown format '#{fmt}'"
|
69
72
|
end
|
70
73
|
File.binwrite(o, output)
|
71
|
-
throw :"Factbase printed to #{o.to_rel} (#{File.size(o)} bytes)"
|
74
|
+
throw :"👍 Factbase printed to #{o.to_rel} (#{File.size(o)} bytes)"
|
72
75
|
end
|
73
76
|
end
|
74
77
|
|
data/lib/judges/commands/pull.rb
CHANGED
@@ -19,13 +19,16 @@ require_relative '../../judges/impex'
|
|
19
19
|
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
20
20
|
# License:: MIT
|
21
21
|
class Judges::Pull
|
22
|
+
# Initialize.
|
23
|
+
# @param [Loog] loog Logging facility
|
22
24
|
def initialize(loog)
|
23
25
|
@loog = loog
|
24
26
|
end
|
25
27
|
|
26
|
-
# Run
|
28
|
+
# Run the pull command (called by the +bin/judges+ script).
|
27
29
|
# @param [Hash] opts Command line options (start with '--')
|
28
30
|
# @param [Array] args List of command line arguments
|
31
|
+
# @raise [RuntimeError] If not exactly two arguments provided
|
29
32
|
def run(opts, args)
|
30
33
|
raise 'Exactly two arguments required' unless args.size == 2
|
31
34
|
fb = Factbase.new
|
@@ -52,9 +55,9 @@ class Judges::Pull
|
|
52
55
|
baza.unlock(name, opts['owner'])
|
53
56
|
raise e
|
54
57
|
end
|
55
|
-
throw :"Pulled #{fb.size} facts by
|
58
|
+
throw :"👍 Pulled #{fb.size} facts by name '#{name}'"
|
56
59
|
else
|
57
|
-
throw :"
|
60
|
+
throw :"⚠️ Nothing to pull - name '#{name}' not found on server"
|
58
61
|
end
|
59
62
|
end
|
60
63
|
end
|
@@ -67,7 +70,7 @@ class Judges::Pull
|
|
67
70
|
loop do
|
68
71
|
break if baza.finished?(id)
|
69
72
|
sleep 1
|
70
|
-
raise "Time is over, the job ##{id} ('#{name}') is still not
|
73
|
+
raise "Time is over, the job ##{id} ('#{name}') is still not completed" if Time.now - start > limit
|
71
74
|
lapsed = Time.now - start
|
72
75
|
@loog.debug("Still waiting for the job ##{id} ('#{name}') to finish... (#{format('%.2f', lapsed)}s already)")
|
73
76
|
end
|