judges 0.0.27 → 0.0.29
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/Gemfile.lock +2 -2
- data/bin/judges +9 -1
- data/features/import.feature +17 -0
- data/features/update.feature +2 -2
- data/judges.gemspec +2 -2
- data/lib/judges/commands/import.rb +55 -0
- data/lib/judges/commands/test.rb +5 -3
- data/lib/judges/commands/trim.rb +4 -2
- data/lib/judges/commands/update.rb +7 -4
- data/test/commands/test_eval.rb +1 -1
- data/test/commands/test_import.rb +57 -0
- data/test/commands/test_join.rb +1 -1
- data/test/commands/test_print.rb +1 -1
- data/test/commands/test_trim.rb +1 -1
- data/test/commands/test_update.rb +3 -3
- data/test/fb/test_if_absent.rb +2 -2
- data/test/test_impex.rb +2 -2
- data/test/test_pack.rb +4 -4
- data/test/test_packs.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4506ff0fe002c7bd8077f203ba8a0af5b9d5b9b788e1d42370c6f990d4b9479
|
4
|
+
data.tar.gz: 8cf313cdaa8a859ffe1c286107c767aac93a0196420152c57337dd05d0ed4881
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f19785b0268c7dce59b6d9478137e2e2e1172ebc03fd803b576d0c1d155eecadea11d38ecaa258f8ecefef031e183807660dee7b0f7aede0c875a42f101ae62d
|
7
|
+
data.tar.gz: 433e49e718acd4b17ba9efdbce605181ca2b6cd88a7a36601bf71dc926f07185f652d57e1005750b28fe2c98467f05c1b93ddd93dee4461dd40f28a58a209097
|
data/Gemfile.lock
CHANGED
@@ -3,7 +3,7 @@ PATH
|
|
3
3
|
specs:
|
4
4
|
judges (0.0.0)
|
5
5
|
backtrace (~> 0.3)
|
6
|
-
factbase (~> 0.0.
|
6
|
+
factbase (~> 0.0.28)
|
7
7
|
gli (~> 2.21)
|
8
8
|
loog (~> 0.2)
|
9
9
|
nokogiri (~> 1.10)
|
@@ -74,7 +74,7 @@ GEM
|
|
74
74
|
docile (1.4.0)
|
75
75
|
drb (2.2.1)
|
76
76
|
erubi (1.12.0)
|
77
|
-
factbase (0.0.
|
77
|
+
factbase (0.0.28)
|
78
78
|
json (~> 2.7)
|
79
79
|
loog (~> 0.2)
|
80
80
|
nokogiri (~> 1.10)
|
data/bin/judges
CHANGED
@@ -32,7 +32,7 @@ Encoding.default_internal = Encoding::UTF_8
|
|
32
32
|
class App
|
33
33
|
extend GLI::App
|
34
34
|
|
35
|
-
ver = '0.0.
|
35
|
+
ver = '0.0.29'
|
36
36
|
|
37
37
|
loog = Loog::REGULAR
|
38
38
|
|
@@ -87,6 +87,14 @@ class App
|
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
90
|
+
desc 'Import YAML into a factbase'
|
91
|
+
command :import do |c|
|
92
|
+
c.action do |global, options, args|
|
93
|
+
require_relative '../lib/judges/commands/import'
|
94
|
+
Judges::Import.new(loog).run(options, args)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
90
98
|
desc 'Remove the facts that are too old'
|
91
99
|
command :trim do |c|
|
92
100
|
c.desc 'Only the facts that match the expression are deleted'
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Feature: Import
|
2
|
+
I want to import YAML into a factbase
|
3
|
+
|
4
|
+
Scenario: Simple import of a small YAML
|
5
|
+
Given I make a temp directory
|
6
|
+
Then I have a "simple.yaml" file with content:
|
7
|
+
"""
|
8
|
+
-
|
9
|
+
foo: 42
|
10
|
+
bar: 2024-03-04T22:22:22Z
|
11
|
+
t: Hello, world!
|
12
|
+
-
|
13
|
+
z: 3.14
|
14
|
+
"""
|
15
|
+
Then I run bin/judges with "--verbose import simple.yaml simple.fb"
|
16
|
+
Then Stdout contains "Import finished"
|
17
|
+
And Exit code is zero
|
data/features/update.feature
CHANGED
@@ -12,7 +12,7 @@ Feature: Update
|
|
12
12
|
Then Stdout contains "foo → "
|
13
13
|
Then Stdout contains "bar → "
|
14
14
|
Then Stdout contains "1 judge(s) processed"
|
15
|
-
Then Stdout contains "Update finished
|
15
|
+
Then Stdout contains "Update finished: 3 cycles"
|
16
16
|
And Exit code is zero
|
17
17
|
|
18
18
|
Scenario: Simple run of a few judges, with a lib
|
@@ -28,5 +28,5 @@ Feature: Update
|
|
28
28
|
"""
|
29
29
|
Then I run bin/judges with "update --lib mylib --max-cycles 1 mypacks simple.fb"
|
30
30
|
Then Stdout contains "1 judge(s) processed"
|
31
|
-
Then Stdout contains "Update finished
|
31
|
+
Then Stdout contains "Update finished: 1 cycles"
|
32
32
|
And Exit code is zero
|
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.0.
|
29
|
+
s.version = '0.0.29'
|
30
30
|
s.license = 'MIT'
|
31
31
|
s.summary = 'Command-Line Tool for a Factbase'
|
32
32
|
s.description = '
|
@@ -42,7 +42,7 @@ Gem::Specification.new do |s|
|
|
42
42
|
s.rdoc_options = ['--charset=UTF-8']
|
43
43
|
s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
|
44
44
|
s.add_runtime_dependency 'backtrace', '~> 0.3'
|
45
|
-
s.add_runtime_dependency 'factbase', '~>0.0.
|
45
|
+
s.add_runtime_dependency 'factbase', '~>0.0.28'
|
46
46
|
s.add_runtime_dependency 'gli', '~>2.21'
|
47
47
|
s.add_runtime_dependency 'loog', '~>0.2'
|
48
48
|
s.add_runtime_dependency 'nokogiri', '~> 1.10'
|
@@ -0,0 +1,55 @@
|
|
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 'time'
|
24
|
+
require 'factbase/looged'
|
25
|
+
require_relative '../../judges'
|
26
|
+
require_relative '../../judges/impex'
|
27
|
+
require_relative '../../judges/to_rel'
|
28
|
+
|
29
|
+
# Import.
|
30
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
31
|
+
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
32
|
+
# License:: MIT
|
33
|
+
class Judges::Import
|
34
|
+
def initialize(loog)
|
35
|
+
@loog = loog
|
36
|
+
end
|
37
|
+
|
38
|
+
def run(_opts, args)
|
39
|
+
raise 'Exactly two arguments required' unless args.size == 2
|
40
|
+
raise "File not found #{args[0].to_rel}" unless File.exist?(args[0])
|
41
|
+
start = Time.now
|
42
|
+
yaml = YAML.load_file(args[0], permitted_classes: [Time])
|
43
|
+
impex = Judges::Impex.new(@loog, args[1])
|
44
|
+
fb = impex.import(strict: false)
|
45
|
+
fb = Factbase::Looged.new(fb, @loog)
|
46
|
+
yaml.each do |i|
|
47
|
+
f = fb.insert
|
48
|
+
i.each do |p, v|
|
49
|
+
f.send("#{p}=", v)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
impex.export(fb)
|
53
|
+
@loog.info("Import finished in #{format('%.02f', Time.now - start)}s")
|
54
|
+
end
|
55
|
+
end
|
data/lib/judges/commands/test.rb
CHANGED
@@ -46,6 +46,7 @@ class Judges::Test
|
|
46
46
|
errors = []
|
47
47
|
done = 0
|
48
48
|
global = {}
|
49
|
+
start = Time.now
|
49
50
|
Judges::Packs.new(dir, opts['lib'], @loog).each_with_index do |p, i|
|
50
51
|
local = {}
|
51
52
|
next unless include?(opts, p.name)
|
@@ -62,13 +63,14 @@ class Judges::Test
|
|
62
63
|
end
|
63
64
|
done += 1
|
64
65
|
end
|
66
|
+
lapse = "in #{format('%.02f', Time.now - start)}s"
|
65
67
|
if done.zero?
|
66
68
|
raise 'No judges tested :(' unless opts['quiet']
|
67
|
-
@loog.warn("\n👍 No judges tested")
|
69
|
+
@loog.warn("\n👍 No judges tested #{lapse}")
|
68
70
|
elsif errors.empty?
|
69
|
-
@loog.info("\n👍 All #{done} judge(s) tested successfully")
|
71
|
+
@loog.info("\n👍 All #{done} judge(s) tested successfully #{lapse}")
|
70
72
|
else
|
71
|
-
@loog.info("\n❌ #{done} judge(s) tested, #{errors.size} of them failed")
|
73
|
+
@loog.info("\n❌ #{done} judge(s) tested, #{errors.size} of them failed #{lapse}")
|
72
74
|
raise "#{errors.size} tests failed" unless opts['quiet']
|
73
75
|
end
|
74
76
|
end
|
data/lib/judges/commands/trim.rb
CHANGED
@@ -46,11 +46,13 @@ class Judges::Trim
|
|
46
46
|
else
|
47
47
|
raise 'Specify either --days or --query' unless opts['days'].nil?
|
48
48
|
end
|
49
|
+
start = Time.now
|
49
50
|
deleted = fb.query(query).delete!
|
51
|
+
lapse = "in #{format('%.02f', Time.now - start)}s"
|
50
52
|
if deleted.zero?
|
51
|
-
@loog.info(
|
53
|
+
@loog.info("No facts deleted #{lapse}")
|
52
54
|
else
|
53
|
-
@loog.info("🗑 #{deleted} fact(s) deleted")
|
55
|
+
@loog.info("🗑 #{deleted} fact(s) deleted #{lapse}")
|
54
56
|
impex.export(fb)
|
55
57
|
end
|
56
58
|
end
|
@@ -48,6 +48,7 @@ class Judges::Update
|
|
48
48
|
@loog.debug("The following options provided:\n\t#{options.to_s.gsub("\n", "\n\t")}")
|
49
49
|
packs = Judges::Packs.new(dir, opts['lib'], @loog)
|
50
50
|
c = 0
|
51
|
+
start = Time.now
|
51
52
|
loop do
|
52
53
|
c += 1
|
53
54
|
diff = cycle(opts, packs, fb, options)
|
@@ -57,11 +58,13 @@ class Judges::Update
|
|
57
58
|
@loog.info('Too many cycles already, as set by --max-cycles, breaking')
|
58
59
|
break
|
59
60
|
end
|
60
|
-
@loog.info(
|
61
|
-
#{diff
|
62
|
-
|
61
|
+
@loog.info(
|
62
|
+
"By #{diff} facts the factbase " \
|
63
|
+
"#{diff.positive? ? 'increased' : 'decreased'} " \
|
64
|
+
"its size at the cycle ##{c}"
|
65
|
+
)
|
63
66
|
end
|
64
|
-
@loog.info("Update finished
|
67
|
+
@loog.info("Update finished: #{c} cycles in #{format('%.02f', Time.now - start)}s")
|
65
68
|
end
|
66
69
|
|
67
70
|
private
|
data/test/commands/test_eval.rb
CHANGED
@@ -35,7 +35,7 @@ class TestEval < Minitest::Test
|
|
35
35
|
def test_build_factbase_from_scratch
|
36
36
|
Dir.mktmpdir do |d|
|
37
37
|
file = File.join(d, 'base.fb')
|
38
|
-
Judges::Eval.new(Loog::
|
38
|
+
Judges::Eval.new(Loog::NULL).run({}, [file, '$fb.insert.foo = 42'])
|
39
39
|
fb = Factbase.new
|
40
40
|
fb.import(File.binread(file))
|
41
41
|
xml = Nokogiri::XML.parse(Factbase::ToXML.new(fb).xml)
|
@@ -0,0 +1,57 @@
|
|
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 'minitest/autorun'
|
24
|
+
require 'loog'
|
25
|
+
require 'nokogiri'
|
26
|
+
require 'factbase/to_xml'
|
27
|
+
require_relative '../../lib/judges'
|
28
|
+
require_relative '../../lib/judges/commands/import'
|
29
|
+
|
30
|
+
# Test.
|
31
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
32
|
+
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
33
|
+
# License:: MIT
|
34
|
+
class TestImport < Minitest::Test
|
35
|
+
def test_import_from_yaml
|
36
|
+
Dir.mktmpdir do |d|
|
37
|
+
file = File.join(d, 'base.fb')
|
38
|
+
yaml = File.join(d, 'input.yml')
|
39
|
+
File.write(
|
40
|
+
yaml,
|
41
|
+
<<-YAML
|
42
|
+
-
|
43
|
+
foo: 42
|
44
|
+
bar: 2024-03-04T22:22:22Z
|
45
|
+
t: Hello, world!
|
46
|
+
-
|
47
|
+
z: 3.14
|
48
|
+
YAML
|
49
|
+
)
|
50
|
+
Judges::Import.new(Loog::NULL).run({}, [yaml, file])
|
51
|
+
fb = Factbase.new
|
52
|
+
fb.import(File.binread(file))
|
53
|
+
xml = Nokogiri::XML.parse(Factbase::ToXML.new(fb).xml)
|
54
|
+
assert(!xml.xpath('/fb[count(f)=2]').empty?, xml)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/test/commands/test_join.rb
CHANGED
@@ -42,7 +42,7 @@ 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::
|
45
|
+
Judges::Join.new(Loog::NULL).run({}, [master, slave])
|
46
46
|
fb = Factbase.new
|
47
47
|
fb.import(File.binread(master))
|
48
48
|
xml = Nokogiri::XML.parse(Factbase::ToXML.new(fb).xml)
|
data/test/commands/test_print.rb
CHANGED
@@ -38,7 +38,7 @@ class TestPrint < Minitest::Test
|
|
38
38
|
fb = Factbase.new
|
39
39
|
fb.insert
|
40
40
|
File.binwrite(f, fb.export)
|
41
|
-
Judges::Print.new(Loog::
|
41
|
+
Judges::Print.new(Loog::NULL).run({ format: 'yaml', auto: true }, [f])
|
42
42
|
y = File.join(d, 'base.yaml')
|
43
43
|
assert(File.exist?(y))
|
44
44
|
assert_equal(1, YAML.load_file(y)['facts'].size)
|
data/test/commands/test_trim.rb
CHANGED
@@ -39,7 +39,7 @@ class TestTrim < Minitest::Test
|
|
39
39
|
before.insert.time = Time.now + 1
|
40
40
|
before.insert.time = Time.now - (100 * 24 * 60 * 60)
|
41
41
|
File.binwrite(file, before.export)
|
42
|
-
Judges::Trim.new(Loog::
|
42
|
+
Judges::Trim.new(Loog::NULL).run({ 'days' => 10 }, [file])
|
43
43
|
after = Factbase.new
|
44
44
|
after.import(File.binread(file))
|
45
45
|
assert_equal(1, after.size)
|
@@ -36,7 +36,7 @@ class TestUpdate < Minitest::Test
|
|
36
36
|
Dir.mktmpdir do |d|
|
37
37
|
File.write(File.join(d, 'foo.rb'), 'return if $fb.size > 2; $fb.insert.zzz = $options.foo_bar + 1')
|
38
38
|
file = File.join(d, 'base.fb')
|
39
|
-
Judges::Update.new(Loog::
|
39
|
+
Judges::Update.new(Loog::NULL).run({ 'option' => ['foo_bar=42'] }, [d, file])
|
40
40
|
fb = Factbase.new
|
41
41
|
fb.import(File.binread(file))
|
42
42
|
xml = Nokogiri::XML.parse(Factbase::ToXML.new(fb).xml)
|
@@ -51,7 +51,7 @@ class TestUpdate < Minitest::Test
|
|
51
51
|
fb.insert.foo_bar = 42
|
52
52
|
File.binwrite(file, fb.export)
|
53
53
|
File.write(File.join(d, 'foo.rb'), '$fb.insert.tt = 4')
|
54
|
-
Judges::Update.new(Loog::
|
54
|
+
Judges::Update.new(Loog::NULL).run({ 'max-cycles' => 1 }, [d, file])
|
55
55
|
fb = Factbase.new
|
56
56
|
fb.import(File.binread(file))
|
57
57
|
xml = Nokogiri::XML.parse(Factbase::ToXML.new(fb).xml)
|
@@ -64,7 +64,7 @@ class TestUpdate < Minitest::Test
|
|
64
64
|
Dir.mktmpdir do |d|
|
65
65
|
File.write(File.join(d, 'foo.rb'), 'this is a broken Ruby script')
|
66
66
|
file = File.join(d, 'base.fb')
|
67
|
-
Judges::Update.new(Loog::
|
67
|
+
Judges::Update.new(Loog::NULL).run({ 'quiet' => true }, [d, file])
|
68
68
|
end
|
69
69
|
end
|
70
70
|
end
|
data/test/fb/test_if_absent.rb
CHANGED
@@ -80,13 +80,13 @@ class TestIfAbsent < Minitest::Test
|
|
80
80
|
def test_complex_injects
|
81
81
|
fb = Factbase.new
|
82
82
|
f1 = fb.insert
|
83
|
-
f1.foo = 'hello,
|
83
|
+
f1.foo = 'hello, dude!'
|
84
84
|
f1.abc = 42
|
85
85
|
t = Time.now
|
86
86
|
f1.z = t
|
87
87
|
f1.bar = 3.14
|
88
88
|
n = if_absent(fb) do |f|
|
89
|
-
f.foo =
|
89
|
+
f.foo = "hello, \\\"dude\\\" \\' \\' ( \n\n ) (!"
|
90
90
|
f.abc = 42
|
91
91
|
f.z = t + 1
|
92
92
|
f.bar = 3.15
|
data/test/test_impex.rb
CHANGED
@@ -34,7 +34,7 @@ class TestImpex < Minitest::Test
|
|
34
34
|
def test_basic
|
35
35
|
Dir.mktmpdir do |d|
|
36
36
|
f = File.join(d, 'foo.rb')
|
37
|
-
impex = Judges::Impex.new(Loog::
|
37
|
+
impex = Judges::Impex.new(Loog::NULL, f)
|
38
38
|
impex.import(strict: false)
|
39
39
|
impex.export(Factbase.new)
|
40
40
|
end
|
@@ -43,7 +43,7 @@ class TestImpex < Minitest::Test
|
|
43
43
|
def test_strict_import
|
44
44
|
Dir.mktmpdir do |d|
|
45
45
|
f = File.join(d, 'x.rb')
|
46
|
-
impex = Judges::Impex.new(Loog::
|
46
|
+
impex = Judges::Impex.new(Loog::NULL, f)
|
47
47
|
impex.import(strict: false)
|
48
48
|
impex.export(Factbase.new)
|
49
49
|
impex.import
|
data/test/test_pack.rb
CHANGED
@@ -35,7 +35,7 @@ class TestPack < Minitest::Test
|
|
35
35
|
def test_basic_run
|
36
36
|
Dir.mktmpdir do |d|
|
37
37
|
File.write(File.join(d, 'foo.rb'), '$fb.insert')
|
38
|
-
pack = Judges::Pack.new(d, nil, Loog::
|
38
|
+
pack = Judges::Pack.new(d, nil, Loog::NULL)
|
39
39
|
fb = Factbase.new
|
40
40
|
pack.run(fb, {}, {}, {})
|
41
41
|
assert_equal(1, fb.size)
|
@@ -45,7 +45,7 @@ class TestPack < Minitest::Test
|
|
45
45
|
def test_run_isolated
|
46
46
|
Dir.mktmpdir do |d|
|
47
47
|
File.write(File.join(d, 'bar.rb'), '$fb.insert')
|
48
|
-
pack = Judges::Pack.new(d, nil, Loog::
|
48
|
+
pack = Judges::Pack.new(d, nil, Loog::NULL)
|
49
49
|
fb1 = Factbase.new
|
50
50
|
pack.run(fb1, {}, {}, {})
|
51
51
|
assert_equal(1, fb1.size)
|
@@ -58,7 +58,7 @@ class TestPack < Minitest::Test
|
|
58
58
|
def test_with_supplemenary_functions
|
59
59
|
Dir.mktmpdir do |d|
|
60
60
|
File.write(File.join(d, 'x.rb'), 'once($fb).insert')
|
61
|
-
pack = Judges::Pack.new(d, nil, Loog::
|
61
|
+
pack = Judges::Pack.new(d, nil, Loog::NULL)
|
62
62
|
pack.run(Factbase.new, {}, {}, {})
|
63
63
|
end
|
64
64
|
end
|
@@ -101,7 +101,7 @@ class TestPack < Minitest::Test
|
|
101
101
|
lib = File.join(d, 'lib')
|
102
102
|
FileUtils.mkdir_p(lib)
|
103
103
|
File.write(File.join(lib, 'y.rb'), '$foo = 42')
|
104
|
-
pack = Judges::Pack.new(dir, lib, Loog::
|
104
|
+
pack = Judges::Pack.new(dir, lib, Loog::NULL)
|
105
105
|
fb = Factbase.new
|
106
106
|
pack.run(fb, {}, {}, {})
|
107
107
|
assert_equal(42, fb.query('()').each.to_a.first.bar)
|
data/test/test_packs.rb
CHANGED
@@ -36,7 +36,7 @@ class TestPacks < Minitest::Test
|
|
36
36
|
File.write(File.join(d, 'foo.rb'), 'hey')
|
37
37
|
File.write(File.join(d, 'something.yml'), "---\nfoo: 42")
|
38
38
|
found = 0
|
39
|
-
Judges::Packs.new(d, nil, Loog::
|
39
|
+
Judges::Packs.new(d, nil, Loog::NULL).each do |p|
|
40
40
|
assert_equal('foo.rb', p.script)
|
41
41
|
found += 1
|
42
42
|
assert_equal('something.yml', File.basename(p.tests.first))
|
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.0.
|
4
|
+
version: 0.0.29
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.0.
|
33
|
+
version: 0.0.28
|
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
|
-
version: 0.0.
|
40
|
+
version: 0.0.28
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: gli
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -113,6 +113,7 @@ files:
|
|
113
113
|
- Rakefile
|
114
114
|
- bin/judges
|
115
115
|
- features/gem_package.feature
|
116
|
+
- features/import.feature
|
116
117
|
- features/inspect.feature
|
117
118
|
- features/join.feature
|
118
119
|
- features/misc.feature
|
@@ -129,6 +130,7 @@ files:
|
|
129
130
|
- judges.gemspec
|
130
131
|
- lib/judges.rb
|
131
132
|
- lib/judges/commands/eval.rb
|
133
|
+
- lib/judges/commands/import.rb
|
132
134
|
- lib/judges/commands/inspect.rb
|
133
135
|
- lib/judges/commands/join.rb
|
134
136
|
- lib/judges/commands/print.rb
|
@@ -144,6 +146,7 @@ files:
|
|
144
146
|
- lib/judges/to_rel.rb
|
145
147
|
- renovate.json
|
146
148
|
- test/commands/test_eval.rb
|
149
|
+
- test/commands/test_import.rb
|
147
150
|
- test/commands/test_inspect.rb
|
148
151
|
- test/commands/test_join.rb
|
149
152
|
- test/commands/test_print.rb
|