judges 0.0.32 → 0.0.33

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: cf26642d3989b5d0097e54b224bd8c8b431f5e488f04a6c6cc778f9a914e0ad6
4
- data.tar.gz: 79974f0a047a19f499e8b9b69566ded6b9b78d3bf6f470bfc67e9aead9988dc9
3
+ metadata.gz: 9cdbff8b28d803f0ce0c0c8e8a934ea9af5b6d65b6396f04f94572bc21bb515e
4
+ data.tar.gz: 856504a44bf49b36ee64f3d304d14861965682df9257b6bbdb1284b71330d32d
5
5
  SHA512:
6
- metadata.gz: f7af589ce71752db5991f3838ea4e6b0e13969f3caab954f21d991d692d75b592c5f3bbe5d42e26cdc9a5d2c68a8ed3fcbe87401c34b1d6daa92c380f6fc7688
7
- data.tar.gz: 25a4cc8aa470fb2f457c9f00b1581d5e4c05ab07d8580da124fd59d92c768796b4548948cb03abfc88256936b3ad8a2ae2fa4dd0edd66a7f1ae69a8530176fcf
6
+ metadata.gz: ddb58a1c8443ed4d61c3f55d155c34f0ba9e164d731167e7069169ac3ee7dbe9734fd7c4bd5a9e90a98787136b43d44966a3662fe3d13014298dcf1e770dd5d4
7
+ data.tar.gz: 9c8fe18c4bebae1ceeb56611b71862d5cda792d292e6ba33f6f1e6b0700483ab385281d00e6ca1a5f3e134d644f065706e547cc3d9b56c4e634dd7c46afac0dd
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.30)
6
+ factbase (~> 0.0.32)
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.30)
77
+ factbase (0.0.32)
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.32'
35
+ ver = '0.0.33'
36
36
 
37
37
  loog = Loog::REGULAR
38
38
 
@@ -98,9 +98,7 @@ class App
98
98
  desc 'Remove the facts that are too old'
99
99
  command :trim do |c|
100
100
  c.desc 'Only the facts that match the expression are deleted'
101
- c.flag([:query])
102
- c.desc 'Remove facts that are older than X days'
103
- c.flag([:days], type: Integer)
101
+ c.flag([:query], default_value: '(never)')
104
102
  c.action do |global, options, args|
105
103
  require_relative '../lib/judges/commands/trim'
106
104
  Judges::Trim.new(loog).run(options, args)
@@ -114,7 +112,7 @@ class App
114
112
  c.desc 'Generate output name of the file automatically'
115
113
  c.switch([:auto], default_value: false)
116
114
  c.desc 'Only the facts that match the expression are printed'
117
- c.flag([:query], default_value: '()')
115
+ c.flag([:query], default_value: '(always)')
118
116
  c.desc 'Print even if target file already exists and is older than the factbase'
119
117
  c.switch([:force], default_value: false)
120
118
  c.action do |global, options, args|
@@ -1,17 +1,16 @@
1
1
  Feature: Trim
2
2
  I want to trim a factbase
3
3
 
4
- Scenario: Simple trimming of a factbase
4
+ Scenario: Simple trimming of a factbase, with a query
5
5
  Given I make a temp directory
6
- Then I run bin/judges with "--verbose eval simple.fb '$fb.insert.time = Time.now - 100 * 60 * 60 * 24'"
7
- Then I run bin/judges with "--verbose update . simple.fb"
8
- Given I run bin/judges with "trim --days 5 simple.fb"
6
+ Then I run bin/judges with "--verbose eval simple.fb '$fb.insert.foo = 42'"
7
+ Given I run bin/judges with "trim --query '(eq foo 42)' simple.fb"
9
8
  Then Stdout contains "1 fact(s) deleted"
10
9
  And Exit code is zero
11
10
 
12
- Scenario: Simple trimming of a factbase, with a query
11
+ Scenario: Delete nothing by default
13
12
  Given I make a temp directory
14
13
  Then I run bin/judges with "--verbose eval simple.fb '$fb.insert.foo = 42'"
15
- Given I run bin/judges with "trim --query '(eq foo 42)' simple.fb"
16
- Then Stdout contains "1 fact(s) deleted"
14
+ Given I run bin/judges with "trim simple.fb"
15
+ Then Stdout contains "No facts deleted"
17
16
  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.32'
29
+ s.version = '0.0.33'
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.30'
45
+ s.add_runtime_dependency 'factbase', '~>0.0.32'
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'
@@ -38,17 +38,8 @@ class Judges::Trim
38
38
  raise 'Exactly one argument required' unless args.size == 1
39
39
  impex = Judges::Impex.new(@loog, args[0])
40
40
  fb = impex.import
41
- query = opts['query']
42
- if query.nil?
43
- days = opts['days']
44
- day = Time.now - (days * 60 * 60 * 24)
45
- query = "(lt time #{day.utc.iso8601})"
46
- @loog.info("Deleting facts that are older than #{days} days")
47
- else
48
- raise 'Specify either --days or --query' unless opts['days'].nil?
49
- end
50
41
  elapsed(@loog) do
51
- deleted = fb.query(query).delete!
42
+ deleted = fb.query(opts['query']).delete!
52
43
  throw :'No facts deleted' if deleted.zero?
53
44
  impex.export(fb)
54
45
  throw :"🗑 #{deleted} fact(s) deleted"
@@ -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::NULL).run({ 'days' => 10 }, [file])
42
+ Judges::Trim.new(Loog::NULL).run({ 'query' => "(lt time #{Time.now.utc.iso8601})" }, [file])
43
43
  after = Factbase.new
44
44
  after.import(File.binread(file))
45
45
  assert_equal(1, after.size)
data/test/fb/test_once.rb CHANGED
@@ -34,7 +34,7 @@ class TestOnce < Minitest::Test
34
34
  def test_touch_once
35
35
  fb = once(Factbase.new, judge: 'something')
36
36
  fb.insert
37
- fb.query('()').each { |f| f.foo = 42 }
38
- assert(fb.query('()').extend(Enumerable).to_a.empty?)
37
+ fb.query('(always)').each { |f| f.foo = 42 }
38
+ assert(fb.query('(always)').extend(Enumerable).to_a.empty?)
39
39
  end
40
40
  end
data/test/test_pack.rb CHANGED
@@ -104,7 +104,7 @@ class TestPack < Minitest::Test
104
104
  pack = Judges::Pack.new(dir, lib, Loog::NULL)
105
105
  fb = Factbase.new
106
106
  pack.run(fb, {}, {}, {})
107
- assert_equal(42, fb.query('()').each.to_a.first.bar)
107
+ assert_equal(42, fb.query('(always)').each.to_a.first.bar)
108
108
  end
109
109
  end
110
110
 
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.32
4
+ version: 0.0.33
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-24 00:00:00.000000000 Z
11
+ date: 2024-05-25 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.30
33
+ version: 0.0.32
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.30
40
+ version: 0.0.32
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: gli
43
43
  requirement: !ruby/object:Gem::Requirement