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 +4 -4
- data/Gemfile.lock +4 -4
- data/lib/fbe/tombstone.rb +7 -4
- data/lib/fbe.rb +1 -1
- data/test/fbe/test_tombstone.rb +22 -18
- 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: 61a57de71b1c292ec12e6f990c09be1b71b271ca5b91df227042f853b96772f8
|
4
|
+
data.tar.gz: 55f9f3384299ef325505c2ac1721fdaa166fd346ad0d9b2759d88df1dfeeedba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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.
|
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.
|
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.
|
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
|
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
data/test/fbe/test_tombstone.rb
CHANGED
@@ -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
|
-
|
19
|
-
ts.bury!(
|
20
|
-
ts.bury!(42,
|
21
|
-
|
22
|
-
assert(ts.has?(
|
23
|
-
|
24
|
-
refute(ts.has?(
|
25
|
-
refute(ts.has?(43,
|
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
|
-
|
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
|
-
|
38
|
-
|
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
|
-
|
45
|
-
ts.bury!(42,
|
46
|
-
ts.bury!(42,
|
47
|
-
ts.bury!(
|
48
|
-
|
49
|
-
assert(ts.has?(42,
|
50
|
-
|
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
|