judges 0.0.18 → 0.0.19
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/bin/judges +2 -2
- data/features/cli.feature +4 -5
- data/judges.gemspec +1 -1
- data/lib/judges/commands/update.rb +2 -2
- data/test/commands/test_update.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22748b35c785164e5fef5f8a6d013d92c380e2023d9806759339a11763f51554
|
4
|
+
data.tar.gz: 9245a7682189a256d5cd2b2779c7163189e751db721d0dd0eeb54e804bb0e7ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b8d102de3483627367d4f8705b5473324f469b9a9d7367bbdee224f3d1db6e37a8ed34bab345ef6930dd321f473781b69e314c53aab2e499c8f8f10916ef519
|
7
|
+
data.tar.gz: d564a60e8d813fb4b785b0e4c084012f360c920ced92138bdf0f247f3aa89e1e5ac86104f928129cc2cc24b1c705d3d7f59c2d25bd59f019a4958024e0dcaa06
|
data/bin/judges
CHANGED
@@ -29,7 +29,7 @@ require 'factbase'
|
|
29
29
|
Encoding.default_external = Encoding::UTF_8
|
30
30
|
Encoding.default_internal = Encoding::UTF_8
|
31
31
|
|
32
|
-
ver = '0.0.
|
32
|
+
ver = '0.0.19'
|
33
33
|
|
34
34
|
include GLI::App
|
35
35
|
|
@@ -59,7 +59,7 @@ command :update do |c|
|
|
59
59
|
c.desc 'Options to pass to every judge'
|
60
60
|
c.flag([:o, :option], multiple: true, arg_name: '<key=value>')
|
61
61
|
c.desc 'Maximum number of update cycles to run'
|
62
|
-
c.flag([:'max-cycles'], default_value: 8)
|
62
|
+
c.flag([:'max-cycles'], default_value: 8, type: Integer)
|
63
63
|
c.action do |global, options, args|
|
64
64
|
require_relative '../lib/judges/commands/update'
|
65
65
|
Judges::Update.new(loog).run(options, args)
|
data/features/cli.feature
CHANGED
@@ -14,15 +14,14 @@ Feature: Simple Run
|
|
14
14
|
Given I make a temp directory
|
15
15
|
Then I have a "simple/simple_judge.rb" file with content:
|
16
16
|
"""
|
17
|
-
$fb.
|
18
|
-
|
19
|
-
n.kind = 'yes!'
|
20
|
-
end
|
17
|
+
n = $fb.insert
|
18
|
+
n.kind = 'yes!'
|
21
19
|
"""
|
22
|
-
Then I run bin/judges with "--verbose update -o foo=1 -o bar=2 --max-cycles
|
20
|
+
Then I run bin/judges with "--verbose update -o foo=1 -o bar=2 --max-cycles 3 . simple.fb"
|
23
21
|
Then Stdout contains "foo → "
|
24
22
|
Then Stdout contains "bar → "
|
25
23
|
Then Stdout contains "1 judges processed"
|
24
|
+
Then Stdout contains "Update finished in 3 cycles"
|
26
25
|
And Exit code is zero
|
27
26
|
|
28
27
|
Scenario: Simple test of a few judges
|
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.19'
|
30
30
|
s.license = 'MIT'
|
31
31
|
s.summary = 'Command-Line Tool for a Factbase'
|
32
32
|
s.description = '
|
@@ -47,13 +47,13 @@ class Judges::Update
|
|
47
47
|
packs = Judges::Packs.new(dir, @loog)
|
48
48
|
c = 0
|
49
49
|
loop do
|
50
|
+
c += 1
|
50
51
|
diff = cycle(packs, fb, impex, options)
|
51
52
|
break if diff.zero?
|
52
|
-
if !opts['max-cycles'].nil? && c
|
53
|
+
if !opts['max-cycles'].nil? && c >= opts['max-cycles']
|
53
54
|
@loog.info('Too many cycles already, as set by --max-cycles, breaking')
|
54
55
|
break
|
55
56
|
end
|
56
|
-
c += 1
|
57
57
|
@loog.info("#{diff} modifications at the cycle ##{c}")
|
58
58
|
end
|
59
59
|
@loog.info("Update finished in #{c} cycles")
|
@@ -49,8 +49,8 @@ class TestUpdate < Minitest::Test
|
|
49
49
|
fb = Factbase.new
|
50
50
|
fb.insert.foo_bar = 42
|
51
51
|
File.binwrite(file, fb.export)
|
52
|
-
File.write(File.join(d, 'foo.rb'), '
|
53
|
-
Judges::Update.new(Loog::VERBOSE).run({}, [d, file])
|
52
|
+
File.write(File.join(d, 'foo.rb'), '$fb.insert.tt = 4')
|
53
|
+
Judges::Update.new(Loog::VERBOSE).run({ 'max-cycles' => 1 }, [d, file])
|
54
54
|
fb = Factbase.new
|
55
55
|
fb.import(File.binread(file))
|
56
56
|
xml = Nokogiri::XML.parse(fb.to_xml)
|