judges 0.0.23 → 0.0.24

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: 15c96f4af35d626de3ae2f9de6d510550b2307a014b0a76148219f8a04091907
4
- data.tar.gz: 19e2b425671a4a711b1c0ebf62b1ad17c25d13c355aeef050a48c030b22a47a0
3
+ metadata.gz: ed5fca9c346d6f092bde73a242e8b347f2abba9f7330767db25edca3d1df1dd3
4
+ data.tar.gz: cbb70db60a4dc7c953cfa6feea4d5955a27f76cf34b3c5403423e8e3b804db84
5
5
  SHA512:
6
- metadata.gz: fe53d0e31dcd30a125d8130fbb46ed1f13709a13f642c8e19db9ae74ef4aeb1485ea374ede9f1abe1f0f1308331fc98f507c532a97803a75b96c8fbf4a6f79b3
7
- data.tar.gz: 36a8369665200eb177572803b555c4948ccfe1f96cc2ed695c9c104bcb8cf89ca11204224ddf2549ad5fa5f7ff7082069edd87e1aa94ac1acca7be22df54f1a7
6
+ metadata.gz: c6d4dffa49971e1dc77788263b005d843223bf96faba1cb67333b773f411fdd9b6920577f1edaab9ae9e6fcb7191c37febc2b1ae0ee55d6fa272f45f36242aa2
7
+ data.tar.gz: a0cde0d189d3ae6bf15da5252fb03dc530103de68adeb2379dc048a2354987bb5371863352640a64cc04663db5b4c099ff7ae474f793ce4ff7f6589f5f0b4da5
data/Gemfile CHANGED
@@ -24,7 +24,7 @@ source 'https://rubygems.org'
24
24
  gemspec
25
25
 
26
26
  gem 'cucumber', '9.2.0', require: false
27
- gem 'minitest', '5.22.3', require: false
27
+ gem 'minitest', '5.23.0', require: false
28
28
  gem 'rake', '13.2.1', require: false
29
29
  gem 'rspec-rails', '6.1.2', require: false
30
30
  gem 'rubocop', '1.63.5', require: false
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.23'
35
+ ver = '0.0.24'
36
36
 
37
37
  loog = Loog::REGULAR
38
38
 
@@ -59,6 +59,8 @@ class App
59
59
  command :update do |c|
60
60
  c.desc 'Options to pass to every judge'
61
61
  c.flag([:o, :option], multiple: true, arg_name: '<key=value>')
62
+ c.desc 'The location of a Ruby library (directory with .rb files to include)'
63
+ c.flag([:lib])
62
64
  c.desc 'Maximum number of update cycles to run'
63
65
  c.flag([:'max-cycles'], default_value: 8, type: Integer)
64
66
  c.desc 'Stay quiet even if some judges fail'
@@ -111,6 +113,8 @@ class App
111
113
  command :test do |c|
112
114
  c.desc 'Name of the test pack to run'
113
115
  c.flag([:pack], multiple: true)
116
+ c.desc 'The location of a Ruby library (directory with .rb files to include)'
117
+ c.flag([:lib])
114
118
  c.desc 'Stay quiet even if some tests fail or simply no tests executed?'
115
119
  c.switch([:quiet], default_value: false)
116
120
  c.action do |global, options, args|
@@ -0,0 +1,16 @@
1
+ Feature: Inspect
2
+ I want to inspect a factbase
3
+
4
+ Scenario: Simple inspect of a small factbase
5
+ Given I make a temp directory
6
+ Then I have a "simple/simple_judge.rb" file with content:
7
+ """
8
+ return if $fb.size > 2
9
+ n = $fb.insert
10
+ n.kind = 'yes!'
11
+ """
12
+ Then I run bin/judges with "update . simple.fb"
13
+ Then I run bin/judges with "inspect simple.fb"
14
+ Then Stdout contains "Facts: 3"
15
+ And Exit code is zero
16
+
@@ -0,0 +1,11 @@
1
+ Feature: Misc
2
+ I want to get some meta info
3
+
4
+ Scenario: Help can be printed
5
+ When I run bin/judges with "-h"
6
+ Then Exit code is zero
7
+ And Stdout contains "--help"
8
+
9
+ Scenario: Version can be printed
10
+ When I run bin/judges with "--version"
11
+ Then Exit code is zero
@@ -0,0 +1,41 @@
1
+ Feature: Print
2
+ I want to print a factbase
3
+
4
+ Scenario: Simple print of a small factbase, to YAML
5
+ Given I make a temp directory
6
+ Then I have a "simple/simple_judge.rb" file with content:
7
+ """
8
+ return if $fb.size > 2
9
+ n = $fb.insert
10
+ n.kind = 'yes!'
11
+ """
12
+ Then I run bin/judges with "update . simple.fb"
13
+ Then I run bin/judges with "print --format=yaml simple.fb simple.yml"
14
+ Then Stdout contains "printed"
15
+ And Exit code is zero
16
+
17
+ Scenario: Simple print of a small factbase, to JSON
18
+ Given I make a temp directory
19
+ Then I have a "simple/simple_judge.rb" file with content:
20
+ """
21
+ return if $fb.size > 2
22
+ n = $fb.insert
23
+ n.kind = 'yes!'
24
+ """
25
+ Then I run bin/judges with "update . simple.fb"
26
+ Then I run bin/judges with "print --format=json simple.fb simple.json"
27
+ Then Stdout contains "printed"
28
+ And Exit code is zero
29
+
30
+ Scenario: Simple print of a small factbase, to XML
31
+ Given I make a temp directory
32
+ Then I have a "simple/simple_judge.rb" file with content:
33
+ """
34
+ return if $fb.size > 2
35
+ n = $fb.insert
36
+ n.kind = 'yes!'
37
+ """
38
+ Then I run bin/judges with "update . simple.fb"
39
+ Then I run bin/judges with "print --format=xml --auto simple.fb"
40
+ Then Stdout contains "printed"
41
+ And Exit code is zero
@@ -0,0 +1,32 @@
1
+ Feature: Test
2
+ I want to test a few judges
3
+
4
+ Scenario: Simple test of a few judges
5
+ Given I run bin/judges with "test ./fixtures"
6
+ Then Stdout contains "👉 Testing"
7
+ Then Stdout contains "judge(s) tested successfully"
8
+ And Exit code is zero
9
+
10
+ Scenario: Simple test of just one pack
11
+ Given I run bin/judges with "test --pack reward_for_good_bug ./fixtures"
12
+ Then Stdout contains "judge(s) tested successfully"
13
+ And Exit code is zero
14
+
15
+ Scenario: Simple test of no packs
16
+ Given I run bin/judges with "test --pack absent_for_sure ./fixtures"
17
+ Then Exit code is not zero
18
+
19
+ Scenario: Simple test of a few judges, with a lib
20
+ Given I make a temp directory
21
+ Then I have a "mypacks/mypack/simple_judge.rb" file with content:
22
+ """
23
+ n = $fb.insert
24
+ n.foo = $foo
25
+ """
26
+ Then I have a "mylib/foo.rb" file with content:
27
+ """
28
+ $foo = 42
29
+ """
30
+ Then I run bin/judges with "test --lib mylib mypacks"
31
+ Then Stdout contains "All 1 judge(s) tested successfully"
32
+ And Exit code is zero
@@ -0,0 +1,14 @@
1
+ Feature: Trim
2
+ I want to trim a factbase
3
+
4
+ Scenario: Simple trimming of a factbase
5
+ Given I make a temp directory
6
+ Then I have a "simple/simple_judge.rb" file with content:
7
+ """
8
+ return if $fb.size > 2
9
+ $fb.insert.time = Time.now - 100 * 60 * 60 * 24
10
+ """
11
+ Then I run bin/judges with "--verbose update . simple.fb"
12
+ Given I run bin/judges with "trim --days 5 simple.fb"
13
+ Then Stdout contains "3 fact(s) deleted"
14
+ And Exit code is zero
@@ -0,0 +1,32 @@
1
+ Feature: Update
2
+ I want to run a few judges over a factbase
3
+
4
+ Scenario: Simple run of a few judges
5
+ Given I make a temp directory
6
+ Then I have a "simple/simple_judge.rb" file with content:
7
+ """
8
+ n = $fb.insert
9
+ n.kind = 'yes!'
10
+ """
11
+ Then I run bin/judges with "--verbose update --quiet -o foo=1 -o bar=2 --max-cycles 3 . simple.fb"
12
+ Then Stdout contains "foo → "
13
+ Then Stdout contains "bar → "
14
+ Then Stdout contains "1 judge(s) processed"
15
+ Then Stdout contains "Update finished in 3 cycles"
16
+ And Exit code is zero
17
+
18
+ Scenario: Simple run of a few judges, with a lib
19
+ Given I make a temp directory
20
+ Then I have a "mypacks/mypack/simple_judge.rb" file with content:
21
+ """
22
+ n = $fb.insert
23
+ n.foo = $foo
24
+ """
25
+ Then I have a "mylib/foo.rb" file with content:
26
+ """
27
+ $foo = 42
28
+ """
29
+ Then I run bin/judges with "update --lib mylib --max-cycles 1 mypacks simple.fb"
30
+ Then Stdout contains "1 judge(s) processed"
31
+ Then Stdout contains "Update finished in 1 cycles"
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.23'
29
+ s.version = '0.0.24'
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.21'
45
+ s.add_runtime_dependency 'factbase', '~>0.0.22'
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'
@@ -44,7 +44,7 @@ class Judges::Test
44
44
  @loog.info("Testing judges in #{dir.to_rel}...")
45
45
  errors = []
46
46
  done = 0
47
- Judges::Packs.new(dir, @loog).each_with_index do |p, i|
47
+ Judges::Packs.new(dir, opts['lib'], @loog).each_with_index do |p, i|
48
48
  next unless include?(opts, p.name)
49
49
  @loog.info("\n👉 Testing #{p.script} (##{i}) in #{p.dir.to_rel}...")
50
50
  p.tests.each do |f|
@@ -37,10 +37,14 @@ class Judges::Trim
37
37
  raise 'Exactly one argument required' unless args.size == 1
38
38
  impex = Judges::Impex.new(@loog, args[0])
39
39
  fb = impex.import
40
- day = Time.now - (opts['days'].to_i * 60 * 60 * 24)
41
- p "(lt time #{day.utc.iso8601})"
40
+ days = opts['days']
41
+ day = Time.now - (days * 60 * 60 * 24)
42
42
  deleted = fb.query("(lt time #{day.utc.iso8601})").delete!
43
- @loog.info("#{deleted} facts deleted because they are too old")
44
- impex.export(fb)
43
+ if deleted.zero?
44
+ @loog.info('No facts deleted')
45
+ else
46
+ @loog.info("🗑 #{deleted} fact(s) deleted, because they were older than #{days} days")
47
+ impex.export(fb)
48
+ end
45
49
  end
46
50
  end
@@ -46,7 +46,7 @@ class Judges::Update
46
46
  fb = Factbase::Looged.new(fb, @loog)
47
47
  options = Judges::Options.new(opts['option'])
48
48
  @loog.debug("The following options provided:\n\t#{options.to_s.gsub("\n", "\n\t")}")
49
- packs = Judges::Packs.new(dir, @loog)
49
+ packs = Judges::Packs.new(dir, opts['lib'], @loog)
50
50
  c = 0
51
51
  loop do
52
52
  c += 1
data/lib/judges/impex.rb CHANGED
@@ -39,7 +39,7 @@ class Judges::Impex
39
39
  fb = Factbase.new
40
40
  if File.exist?(@file)
41
41
  fb.import(File.binread(@file))
42
- @loog.info("The factbase imported from #{@file.to_rel} (#{File.size(@file)} bytes)")
42
+ @loog.info("The factbase imported from #{@file.to_rel} (#{File.size(@file)} bytes, #{fb.size} facts)")
43
43
  elsif strict
44
44
  raise "The factbase is absent at #{@file.to_rel}"
45
45
  end
@@ -49,12 +49,12 @@ class Judges::Impex
49
49
  def import_to(fb)
50
50
  raise "The factbase is absent at #{@file.to_rel}" unless File.exist?(@file)
51
51
  fb.import(File.binread(@file))
52
- @loog.info("The factbase loaded from #{@file.to_rel} (#{File.size(@file)} bytes)")
52
+ @loog.info("The factbase loaded from #{@file.to_rel} (#{File.size(@file)} bytes, #{fb.size} facts)")
53
53
  end
54
54
 
55
55
  def export(fb)
56
56
  FileUtils.mkdir_p(File.dirname(@file))
57
57
  File.binwrite(@file, fb.export)
58
- @loog.info("Factbase exported to #{@file.to_rel} (#{File.size(@file)} bytes)")
58
+ @loog.info("Factbase exported to #{@file.to_rel} (#{File.size(@file)} bytes, #{fb.size} facts)")
59
59
  end
60
60
  end
data/lib/judges/pack.rb CHANGED
@@ -20,9 +20,8 @@
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 'yaml'
24
- require 'time'
25
23
  require_relative '../judges'
24
+ require_relative '../judges/to_rel'
26
25
  require_relative '../judges/fb/once'
27
26
  require_relative '../judges/fb/if_absent'
28
27
 
@@ -33,8 +32,9 @@ require_relative '../judges/fb/if_absent'
33
32
  class Judges::Pack
34
33
  attr_reader :dir
35
34
 
36
- def initialize(dir, loog)
35
+ def initialize(dir, lib, loog)
37
36
  @dir = dir
37
+ @lib = lib
38
38
  @loog = loog
39
39
  end
40
40
 
@@ -44,6 +44,13 @@ class Judges::Pack
44
44
  $judge = File.basename(@dir)
45
45
  $options = options
46
46
  $loog = @loog
47
+ unless @lib.nil?
48
+ raise "Lib dir #{@lib.to_rel} is absent" unless File.exist?(@lib)
49
+ raise "Lib #{@lib.to_rel} is not a directory" unless File.directory?(@lib)
50
+ Dir.glob(File.join(@lib, '*.rb')).each do |f|
51
+ require_relative(File.absolute_path(f))
52
+ end
53
+ end
47
54
  s = File.join(@dir, script)
48
55
  raise "Can't load '#{s}'" unless File.exist?(s)
49
56
  begin
@@ -60,7 +67,9 @@ class Judges::Pack
60
67
 
61
68
  # Get the name of the .rb script in the pack.
62
69
  def script
63
- File.basename(Dir.glob(File.join(@dir, '*.rb')).first)
70
+ s = Dir.glob(File.join(@dir, '*.rb')).first
71
+ raise "No *.rb scripts in #{@dir.to_rel}" if s.nil?
72
+ File.basename(s)
64
73
  end
65
74
 
66
75
  # Return all .yml tests files.
data/lib/judges/packs.rb CHANGED
@@ -28,8 +28,9 @@ require_relative 'pack'
28
28
  # Copyright:: Copyright (c) 2024 Yegor Bugayenko
29
29
  # License:: MIT
30
30
  class Judges::Packs
31
- def initialize(dir, loog)
31
+ def initialize(dir, lib, loog)
32
32
  @dir = dir
33
+ @lib = lib
33
34
  @loog = loog
34
35
  end
35
36
 
@@ -38,7 +39,7 @@ class Judges::Packs
38
39
  def each
39
40
  Dir.glob(File.join(@dir, '**/*.rb')).each do |f|
40
41
  d = File.dirname(File.absolute_path(f))
41
- yield Judges::Pack.new(d, @loog)
42
+ yield Judges::Pack.new(d, @lib, @loog)
42
43
  end
43
44
  end
44
45
 
@@ -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::VERBOSE).run({ 'days' => '10' }, [file])
42
+ Judges::Trim.new(Loog::VERBOSE).run({ 'days' => 10 }, [file])
43
43
  after = Factbase.new
44
44
  after.import(File.binread(file))
45
45
  assert_equal(1, after.size)
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, Loog::VERBOSE)
38
+ pack = Judges::Pack.new(d, nil, Loog::VERBOSE)
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, Loog::VERBOSE)
48
+ pack = Judges::Pack.new(d, nil, Loog::VERBOSE)
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, Loog::VERBOSE)
61
+ pack = Judges::Pack.new(d, nil, Loog::VERBOSE)
62
62
  pack.run(Factbase.new, {})
63
63
  end
64
64
  end
@@ -70,8 +70,23 @@ class TestPack < Minitest::Test
70
70
  FileUtils.mkdir(dir)
71
71
  File.write(File.join(dir, 'foo.rb'), '$loog.info("judge=" + $judge)')
72
72
  log = Loog::Buffer.new
73
- Judges::Pack.new(dir, log).run(Factbase.new, {})
73
+ Judges::Pack.new(dir, nil, log).run(Factbase.new, {})
74
74
  assert(log.to_s.include?("judge=#{j}"))
75
75
  end
76
76
  end
77
+
78
+ def test_with_library
79
+ Dir.mktmpdir do |d|
80
+ dir = File.join(d, 'packs')
81
+ FileUtils.mkdir_p(dir)
82
+ File.write(File.join(dir, 'x.rb'), 'once($fb).insert.bar = $foo')
83
+ lib = File.join(d, 'lib')
84
+ FileUtils.mkdir_p(lib)
85
+ File.write(File.join(lib, 'y.rb'), '$foo = 42')
86
+ pack = Judges::Pack.new(dir, lib, Loog::VERBOSE)
87
+ fb = Factbase.new
88
+ pack.run(fb, {})
89
+ assert_equal(42, fb.query('()').each.to_a.first.bar)
90
+ end
91
+ end
77
92
  end
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, Loog::VERBOSE).each do |p|
39
+ Judges::Packs.new(d, nil, Loog::VERBOSE).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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: judges
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.23
4
+ version: 0.0.24
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-05-15 00:00:00.000000000 Z
11
+ date: 2024-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backtrace
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.0.21
33
+ version: 0.0.22
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.21
40
+ version: 0.0.22
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: gli
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -111,10 +111,15 @@ files:
111
111
  - README.md
112
112
  - Rakefile
113
113
  - bin/judges
114
- - features/cli.feature
115
114
  - features/gem_package.feature
115
+ - features/inspect.feature
116
+ - features/misc.feature
117
+ - features/print.feature
116
118
  - features/step_definitions/steps.rb
117
119
  - features/support/env.rb
120
+ - features/test.feature
121
+ - features/trim.feature
122
+ - features/update.feature
118
123
  - fixtures/reward_for_good_bug/README.md
119
124
  - fixtures/reward_for_good_bug/no-reward.yml
120
125
  - fixtures/reward_for_good_bug/reward_it.rb
data/features/cli.feature DELETED
@@ -1,79 +0,0 @@
1
- Feature: Simple Run
2
- I want to run a few judges over a factbase
3
-
4
- Scenario: Help can be printed
5
- When I run bin/judges with "-h"
6
- Then Exit code is zero
7
- And Stdout contains "--help"
8
-
9
- Scenario: Version can be printed
10
- When I run bin/judges with "--version"
11
- Then Exit code is zero
12
-
13
- Scenario: Simple run of a few judges
14
- Given I make a temp directory
15
- Then I have a "simple/simple_judge.rb" file with content:
16
- """
17
- n = $fb.insert
18
- n.kind = 'yes!'
19
- """
20
- Then I run bin/judges with "--verbose update --quiet -o foo=1 -o bar=2 --max-cycles 3 . simple.fb"
21
- Then Stdout contains "foo → "
22
- Then Stdout contains "bar → "
23
- Then Stdout contains "1 judge(s) processed"
24
- Then Stdout contains "Update finished in 3 cycles"
25
- And Exit code is zero
26
-
27
- Scenario: Simple test of a few judges
28
- Given I run bin/judges with "test ./fixtures"
29
- Then Stdout contains "👉 Testing"
30
- Then Stdout contains "judge(s) tested successfully"
31
- And Exit code is zero
32
-
33
- Scenario: Simple test of just one pack
34
- Given I run bin/judges with "test --pack reward_for_good_bug ./fixtures"
35
- Then Stdout contains "judge(s) tested successfully"
36
- And Exit code is zero
37
-
38
- Scenario: Simple test of no packs
39
- Given I run bin/judges with "test --pack absent_for_sure ./fixtures"
40
- Then Exit code is not zero
41
-
42
- Scenario: Simple trimming of a factbase
43
- Given I make a temp directory
44
- Then I have a "simple/simple_judge.rb" file with content:
45
- """
46
- return if $fb.size > 2
47
- $fb.insert.time = Time.now - 100 * 60 * 60 * 24
48
- """
49
- Then I run bin/judges with "--verbose update . simple.fb"
50
- Given I run bin/judges with "trim --days 5 simple.fb"
51
- Then Stdout contains "3 facts deleted"
52
- And Exit code is zero
53
-
54
- Scenario: Simple print of a small factbase
55
- Given I make a temp directory
56
- Then I have a "simple/simple_judge.rb" file with content:
57
- """
58
- return if $fb.size > 2
59
- n = $fb.insert
60
- n.kind = 'yes!'
61
- """
62
- Then I run bin/judges with "update . simple.fb"
63
- Then I run bin/judges with "print --format=yaml simple.fb simple.yml"
64
- Then Stdout contains "printed"
65
- And Exit code is zero
66
-
67
- Scenario: Simple inspect of a small factbase
68
- Given I make a temp directory
69
- Then I have a "simple/simple_judge.rb" file with content:
70
- """
71
- return if $fb.size > 2
72
- n = $fb.insert
73
- n.kind = 'yes!'
74
- """
75
- Then I run bin/judges with "update . simple.fb"
76
- Then I run bin/judges with "inspect simple.fb"
77
- Then Stdout contains "Facts: 3"
78
- And Exit code is zero
79
-