fbe 0.28.1 → 0.28.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 25b95f924ac73210555c91b1102ab632a0ad478b843a4c0e13d8aad5ea193d3a
4
- data.tar.gz: 4b9c39ac83710018b43edb06963e1bf5bf27f9800b64a19bd51986d0611295d3
3
+ metadata.gz: 61a57de71b1c292ec12e6f990c09be1b71b271ca5b91df227042f853b96772f8
4
+ data.tar.gz: 55f9f3384299ef325505c2ac1721fdaa166fd346ad0d9b2759d88df1dfeeedba
5
5
  SHA512:
6
- metadata.gz: 9959047b9386598ba19232bc2101c97400bfee084c01d0cf5285f5ec84681cf2f1f39da10c7a88e09dcc705b87d45d03a38b9b529c64645fb6e8ba334727bf63
7
- data.tar.gz: 31ce58af7e239460b310afd89aa8c719c8984f73087233fda8c1d1453b7a836d19f3dddfea9ea9592b4a5a0de616be380c8791e201e37377265a2cc9f65606c9
6
+ metadata.gz: bc243fbc22b222834b791ffa62ba115fac2c938fad223d8c3ae4a06a42a1233d02d1953a8537451fa0c6e1dd9b2f33bfae49d37baf36c469718c9734a94510ff
7
+ data.tar.gz: 981cfa09101bb45b7951bd11b8c95757fde0b95361995cace2c60a59e48bd69adc2b3aa2d679df25c78dd54cb16c0ae4d11fc89aae5a44399ea3b06a9db5d9d1
data/Gemfile.lock CHANGED
@@ -74,7 +74,7 @@ GEM
74
74
  loog (~> 0.6)
75
75
  tago (~> 0.1)
76
76
  ellipsized (0.3.0)
77
- ethon (0.17.0)
77
+ ethon (0.15.0)
78
78
  ffi (>= 1.15.0)
79
79
  factbase (0.15.6)
80
80
  backtrace (~> 0.4)
@@ -189,7 +189,7 @@ GEM
189
189
  regexp_parser (2.11.2)
190
190
  retries (0.0.5)
191
191
  rexml (3.4.2)
192
- rubocop (1.80.0)
192
+ rubocop (1.80.1)
193
193
  json (~> 2.3)
194
194
  language_server-protocol (~> 3.17.0.2)
195
195
  lint_roller (~> 1.1.0)
@@ -236,8 +236,8 @@ GEM
236
236
  tago (0.1.0)
237
237
  timeout (0.4.3)
238
238
  total (0.4.1)
239
- typhoeus (1.4.1)
240
- ethon (>= 0.9.0)
239
+ typhoeus (1.5.0)
240
+ ethon (>= 0.9.0, < 0.16.0)
241
241
  tzinfo (2.0.6)
242
242
  concurrent-ruby (~> 1.0)
243
243
  unicode-display_width (3.1.5)
data/lib/fbe/tombstone.rb CHANGED
@@ -22,13 +22,15 @@ class Fbe::Tombstone
22
22
  end
23
23
 
24
24
  # Put it there.
25
+ # @param [String] where The place, e.g. "github"
25
26
  # @param [Integer] repo ID of repository
26
27
  # @param [Integer] issue ID of issue (or array of them)
27
- def bury!(repo, issue)
28
+ def bury!(where, repo, issue)
28
29
  f =
29
30
  Fbe.if_absent(fb: @fb, always: true) do |n|
30
31
  n.what = 'tombstone'
31
- n.repository = repo
32
+ n.where = where
33
+ n.repo = repo
32
34
  end
33
35
  f.send(:"#{@fid}=", SecureRandom.random_number(99_999)) if f[@fid].nil?
34
36
  nn = f['issues']&.map { |ii| ii.split('-').map(&:to_i) } || []
@@ -54,12 +56,13 @@ class Fbe::Tombstone
54
56
  end
55
57
 
56
58
  # Is it there?
59
+ # @param [String] where The place, e.g. "github"
57
60
  # @param [Integer] repo ID of repository
58
61
  # @param [Integer] issue ID of issue (or array of them)
59
62
  # @return [Boolean] True if it's there
60
- def has?(repo, issue)
63
+ def has?(where, repo, issue)
61
64
  f = @fb.query(
62
- "(and (eq what 'tombstone') (eq repository #{repo}) (exists issues))"
65
+ "(and (eq where '#{where}') (eq what 'tombstone') (eq repo #{repo}) (exists issues))"
63
66
  ).each.first
64
67
  return false if f.nil?
65
68
  issue = [issue] unless issue.is_a?(Array)
data/lib/fbe.rb CHANGED
@@ -10,5 +10,5 @@
10
10
  # License:: MIT
11
11
  module Fbe
12
12
  # Current version of the gem (changed by +.rultor.yml+ on every release)
13
- VERSION = '0.28.1' unless const_defined?(:VERSION)
13
+ VERSION = '0.28.2' unless const_defined?(:VERSION)
14
14
  end
@@ -15,38 +15,42 @@ class TestTombstone < Fbe::Test
15
15
  def test_simple
16
16
  fb = Factbase.new
17
17
  ts = Fbe::Tombstone.new(fb:)
18
- ts.bury!(41, 13)
19
- ts.bury!(42, 13)
20
- ts.bury!(42, 999)
21
- assert(ts.has?(41, 13))
22
- assert(ts.has?(42, 999))
23
- refute(ts.has?(8, 7))
24
- refute(ts.has?(43, 999))
25
- refute(ts.has?(43, 990))
18
+ where = 'github'
19
+ ts.bury!(where, 41, 13)
20
+ ts.bury!(where, 42, 13)
21
+ ts.bury!(where, 42, 999)
22
+ assert(ts.has?(where, 41, 13))
23
+ assert(ts.has?(where, 42, 999))
24
+ refute(ts.has?(where, 8, 7))
25
+ refute(ts.has?(where, 43, 999))
26
+ refute(ts.has?(where, 43, 990))
26
27
  end
27
28
 
28
29
  def test_on_empty
29
30
  fb = Factbase.new
30
31
  ts = Fbe::Tombstone.new(fb:)
31
- refute(ts.has?(8, 7))
32
+ where = 'github'
33
+ refute(ts.has?(where, 8, 7))
32
34
  end
33
35
 
34
36
  def test_bury_twice
35
37
  fb = Factbase.new
36
38
  ts = Fbe::Tombstone.new(fb:)
37
- 2.times { ts.bury!(42, 7) }
38
- assert(ts.has?(42, 7))
39
+ where = 'github'
40
+ 2.times { ts.bury!(where, 42, 7) }
41
+ assert(ts.has?(where, 42, 7))
39
42
  end
40
43
 
41
44
  def test_merges_them
42
45
  fb = Factbase.new
43
46
  ts = Fbe::Tombstone.new(fb:)
44
- ts.bury!(42, 13)
45
- ts.bury!(42, 18)
46
- ts.bury!(42, 14)
47
- ts.bury!(42, [17, 15, 16])
48
- assert(ts.has?(42, 16))
49
- assert(ts.has?(42, [16, 18]))
50
- refute(ts.has?(42, 22))
47
+ where = 'github'
48
+ ts.bury!(where, 42, 13)
49
+ ts.bury!(where, 42, 18)
50
+ ts.bury!(where, 42, 14)
51
+ ts.bury!(where, 42, [17, 15, 16])
52
+ assert(ts.has?(where, 42, 16))
53
+ assert(ts.has?(where, 42, [16, 18]))
54
+ refute(ts.has?(where, 42, 22))
51
55
  end
52
56
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fbe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.28.1
4
+ version: 0.28.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko