fbe 0.31.2 → 0.32.0
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 +2 -2
- data/lib/fbe/iterate.rb +15 -16
- data/lib/fbe/tombstone.rb +5 -3
- data/lib/fbe.rb +1 -1
- 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: e782b5b62b94f84bcd91047a11d9597ecfd038721e98717b6d0ca880d55276d6
|
4
|
+
data.tar.gz: e6fce4664e48cf191f8bc36319c2b1da042932c9a1e2e1e56c96d3f9dee76ee6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f11e700c5230f040bc376f333cb7752af379acb06452977a89fb6ff0be34a4217c80d2f261d845be5fe9bb934e2e35c527480a757a4c4568b8c8742550571632
|
7
|
+
data.tar.gz: 9df8ad3c5936aa7a0f4246e40684df7dd8408260b6561db8206827f17f6ee2963759b638da31d04443ace8759ce62a51786b023472b86df3ad35c877e2d0e76a
|
data/Gemfile.lock
CHANGED
@@ -207,10 +207,10 @@ GEM
|
|
207
207
|
lint_roller (~> 1.1)
|
208
208
|
rubocop (>= 1.75.0, < 2.0)
|
209
209
|
rubocop-ast (>= 1.38.0, < 2.0)
|
210
|
-
rubocop-performance (1.
|
210
|
+
rubocop-performance (1.26.0)
|
211
211
|
lint_roller (~> 1.1)
|
212
212
|
rubocop (>= 1.75.0, < 2.0)
|
213
|
-
rubocop-ast (>= 1.
|
213
|
+
rubocop-ast (>= 1.44.0, < 2.0)
|
214
214
|
rubocop-rake (0.7.1)
|
215
215
|
lint_roller (~> 1.1)
|
216
216
|
rubocop (>= 1.72.1)
|
data/lib/fbe/iterate.rb
CHANGED
@@ -8,7 +8,9 @@ require 'tago'
|
|
8
8
|
require 'time'
|
9
9
|
require_relative '../fbe'
|
10
10
|
require_relative 'fb'
|
11
|
+
require_relative 'if_absent'
|
11
12
|
require_relative 'octo'
|
13
|
+
require_relative 'overwrite'
|
12
14
|
require_relative 'unmask_repos'
|
13
15
|
|
14
16
|
# Creates an instance of {Fbe::Iterate} and evaluates it with the provided block.
|
@@ -26,7 +28,7 @@ require_relative 'unmask_repos'
|
|
26
28
|
# @raise [RuntimeError] If required globals are not set
|
27
29
|
# @example Iterate through repositories processing issues
|
28
30
|
# Fbe.iterate do
|
29
|
-
# as '
|
31
|
+
# as 'issues_iterator'
|
30
32
|
# by '(and (eq what "issue") (gt created_at $before))'
|
31
33
|
# repeats 5
|
32
34
|
# quota_aware
|
@@ -62,7 +64,7 @@ end
|
|
62
64
|
#
|
63
65
|
# @example Processing pull requests with state management
|
64
66
|
# iterator = Fbe::Iterate.new(fb: fb, loog: loog, options: options, global: global)
|
65
|
-
# iterator.as('
|
67
|
+
# iterator.as('pull_requests')
|
66
68
|
# iterator.by('(and (eq what "pull_request") (gt number $before))')
|
67
69
|
# iterator.repeats(10)
|
68
70
|
# iterator.quota_aware
|
@@ -151,10 +153,11 @@ class Fbe::Iterate
|
|
151
153
|
# @return [nil] Nothing is returned
|
152
154
|
# @raise [RuntimeError] If label is already set or nil
|
153
155
|
# @example Set label for issue processing
|
154
|
-
# iterator.as('
|
156
|
+
# iterator.as('issue_processor')
|
155
157
|
def as(label)
|
156
158
|
raise 'Label is already set' unless @label.nil?
|
157
159
|
raise 'Cannot set "label" to nil' if label.nil?
|
160
|
+
raise "Wrong label format '#{label}', use [_a-z][a-zA-Z0-9_]*" unless label.match?(/\A[_a-z][a-zA-Z0-9_]*\z/)
|
158
161
|
@label = label
|
159
162
|
end
|
160
163
|
|
@@ -215,10 +218,10 @@ class Fbe::Iterate
|
|
215
218
|
repo,
|
216
219
|
@fb.query(
|
217
220
|
"(agg (and
|
218
|
-
(eq what '
|
221
|
+
(eq what 'iterate')
|
219
222
|
(eq where 'github')
|
220
223
|
(eq repository #{repo}))
|
221
|
-
(first
|
224
|
+
(first #{@label}))"
|
222
225
|
).one&.first || @since
|
223
226
|
]
|
224
227
|
end
|
@@ -273,17 +276,13 @@ class Fbe::Iterate
|
|
273
276
|
end
|
274
277
|
repos.each do |repo|
|
275
278
|
next if before[repo] == starts[repo]
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
f
|
283
|
-
f.where = 'github'
|
284
|
-
f.repository = repo
|
285
|
-
f.latest = before[repo]
|
286
|
-
f.what = @label
|
279
|
+
f =
|
280
|
+
Fbe.if_absent(fb: @fb, always: true) do |n|
|
281
|
+
n.what = 'iterate'
|
282
|
+
n.where = 'github'
|
283
|
+
n.repository = repo
|
284
|
+
end
|
285
|
+
Fbe.overwrite(f, @label, before[repo], fb: @fb)
|
287
286
|
end
|
288
287
|
@loog.debug("Finished scanning #{repos.size} repos in #{start.ago}: #{seen.map { |k, v| "#{k}:#{v}" }.joined}")
|
289
288
|
end
|
data/lib/fbe/tombstone.rb
CHANGED
@@ -34,7 +34,7 @@ class Fbe::Tombstone
|
|
34
34
|
n.repo = repo
|
35
35
|
end
|
36
36
|
f.send(:"#{@fid}=", SecureRandom.random_number(99_999)) if f[@fid].nil?
|
37
|
-
nn = f['issues']&.map { |ii| ii.split('-').map(&:to_i) } || []
|
37
|
+
nn = f['issues']&.map { |ii| ii.split('-').map(&:to_i).then { |ii| ii.size == 1 ? ii << ii[0] : ii } } || []
|
38
38
|
issue = [issue] unless issue.is_a?(Array)
|
39
39
|
issue.each do |i|
|
40
40
|
nn << [i, i]
|
@@ -47,7 +47,9 @@ class Fbe::Tombstone
|
|
47
47
|
merged << [a, b]
|
48
48
|
end
|
49
49
|
end
|
50
|
-
Fbe.overwrite(
|
50
|
+
Fbe.overwrite(
|
51
|
+
f, 'issues', merged.map { |ii| ii[0] == ii[1] ? ii[0].to_s : "#{ii[0]}-#{ii[1]}" }, fb: @fb, fid: @fid
|
52
|
+
)
|
51
53
|
end
|
52
54
|
|
53
55
|
# Is it there?
|
@@ -64,7 +66,7 @@ class Fbe::Tombstone
|
|
64
66
|
issue.all? do |i|
|
65
67
|
f['issues'].any? do |ii|
|
66
68
|
a, b = ii.split('-').map(&:to_i)
|
67
|
-
(a..b).cover?(i)
|
69
|
+
b.nil? ? a == i : (a..b).cover?(i)
|
68
70
|
end
|
69
71
|
end
|
70
72
|
end
|
data/lib/fbe.rb
CHANGED