fbe 0.38.1 → 0.39.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f22a31b94db1f205cc7abe914acad2fbe83811f82b3c0f4d4d1444fd41c85ab5
4
- data.tar.gz: 4b06b99c1bd84d3e767b0531224282ef8fc06febacd725052638eedba5881403
3
+ metadata.gz: bcdd3a7dc6452b707cd14157c1009b9b7a1f551f9ea66c5cc31c08849e87a2d3
4
+ data.tar.gz: 2d1b97f86162a5e853df3a19e8ba6c4f96f398c51c19aa5a2bab0ee036cba1b4
5
5
  SHA512:
6
- metadata.gz: 06fb6917512049d88eecd68407084bd6342c410aba636e1e25493d64b7407b798073da2a9ca9c91408517237e61a05cf538f54ab9533b95eced5c54a80a32aa1
7
- data.tar.gz: 7706c0d39076475f86dc25e09a0c3e89d0cd20d7aa26e11b715404e980e5104d0d2ad7942b4fb3a61661f63aa107e3e3f596f072871381814407857a8392a8f4
6
+ metadata.gz: a8e6f7be8faebeaa3aa2ad93f809988ef7fba01265faa67da6bf0c292cf088f1a655305820b1a72570dcd2282a065a1f6570daa349c0ea26458beed96a3d0845
7
+ data.tar.gz: 4c2747bdf3bee54e7ecdf667db8d55f93323fc4448f1398753200b963404d5723e094f34064461787999456fa1316a551f470890dc7c6569310f28ccd8338c68
@@ -16,6 +16,6 @@ jobs:
16
16
  runs-on: ubuntu-24.04
17
17
  steps:
18
18
  - uses: actions/checkout@v5
19
- - uses: crate-ci/typos@v1.36.2
19
+ - uses: crate-ci/typos@v1.36.3
20
20
  with:
21
21
  config: .github/.typos.toml
data/Gemfile.lock CHANGED
@@ -28,7 +28,7 @@ PATH
28
28
  GEM
29
29
  remote: https://rubygems.org/
30
30
  specs:
31
- activesupport (8.0.2.1)
31
+ activesupport (8.0.3)
32
32
  base64
33
33
  benchmark (>= 0.3)
34
34
  bigdecimal
@@ -47,7 +47,7 @@ GEM
47
47
  ast (2.4.3)
48
48
  backtrace (0.4.1)
49
49
  base64 (0.3.0)
50
- baza.rb (0.10.2)
50
+ baza.rb (0.11.0)
51
51
  backtrace (~> 0.4)
52
52
  elapsed (~> 0.2)
53
53
  faraday (~> 2.13)
@@ -87,7 +87,7 @@ GEM
87
87
  others (~> 0.1)
88
88
  tago (~> 0.1)
89
89
  yaml (~> 0.3)
90
- faraday (2.13.4)
90
+ faraday (2.14.0)
91
91
  faraday-net_http (>= 2.0, < 3.5)
92
92
  json
93
93
  logger
@@ -107,7 +107,7 @@ GEM
107
107
  filesize (0.2.0)
108
108
  gli (2.22.2)
109
109
  ostruct
110
- graphql (2.5.12)
110
+ graphql (2.5.13)
111
111
  base64
112
112
  fiber-storage
113
113
  logger
@@ -120,21 +120,21 @@ GEM
120
120
  intercepted (0.2.0)
121
121
  iri (0.11.2)
122
122
  joined (0.4.0)
123
- json (2.13.2)
124
- judges (0.53.8)
123
+ json (2.15.0)
124
+ judges (0.54.0)
125
125
  backtrace (~> 0.4)
126
- baza.rb (~> 0.5)
126
+ baza.rb (~> 0.10)
127
127
  concurrent-ruby (~> 1.2)
128
- elapsed (~> 0.0)
129
- factbase (~> 0.11)
128
+ elapsed (~> 0.2)
129
+ factbase (~> 0.16)
130
130
  gli (~> 2.21)
131
131
  iri (~> 0.11)
132
132
  loog (~> 0.6)
133
133
  moments (~> 0.3)
134
134
  nokogiri (~> 1.10)
135
- others (~> 0.0)
135
+ others (~> 0.1)
136
136
  retries (~> 0.0)
137
- tago (~> 0.1)
137
+ tago (~> 0.2)
138
138
  timeout (~> 0.4)
139
139
  total (~> 0.4)
140
140
  typhoeus (~> 1.3)
@@ -189,7 +189,7 @@ GEM
189
189
  regexp_parser (2.11.3)
190
190
  retries (0.0.5)
191
191
  rexml (3.4.4)
192
- rubocop (1.80.2)
192
+ rubocop (1.81.1)
193
193
  json (~> 2.3)
194
194
  language_server-protocol (~> 3.17.0.2)
195
195
  lint_roller (~> 1.1.0)
@@ -197,10 +197,10 @@ GEM
197
197
  parser (>= 3.3.0.2)
198
198
  rainbow (>= 2.2.2, < 4.0)
199
199
  regexp_parser (>= 2.9.3, < 3.0)
200
- rubocop-ast (>= 1.46.0, < 2.0)
200
+ rubocop-ast (>= 1.47.1, < 2.0)
201
201
  ruby-progressbar (~> 1.7)
202
202
  unicode-display_width (>= 2.4.0, < 4.0)
203
- rubocop-ast (1.46.0)
203
+ rubocop-ast (1.47.1)
204
204
  parser (>= 3.3.7.2)
205
205
  prism (~> 1.4)
206
206
  rubocop-minitest (0.38.2)
@@ -228,12 +228,12 @@ GEM
228
228
  simplecov (~> 0.19)
229
229
  simplecov-html (0.13.2)
230
230
  simplecov_json_formatter (0.1.4)
231
- sqlite3 (2.7.3-arm64-darwin)
232
- sqlite3 (2.7.3-x64-mingw-ucrt)
233
- sqlite3 (2.7.3-x86_64-darwin)
234
- sqlite3 (2.7.3-x86_64-linux-gnu)
231
+ sqlite3 (2.7.4-arm64-darwin)
232
+ sqlite3 (2.7.4-x64-mingw-ucrt)
233
+ sqlite3 (2.7.4-x86_64-darwin)
234
+ sqlite3 (2.7.4-x86_64-linux-gnu)
235
235
  strscan (3.1.5)
236
- tago (0.2.0)
236
+ tago (0.3.0)
237
237
  timeout (0.4.3)
238
238
  total (0.4.1)
239
239
  typhoeus (1.5.0)
data/lib/fbe/conclude.rb CHANGED
@@ -195,6 +195,14 @@ class Fbe::Conclude
195
195
  # end
196
196
  # end
197
197
  def roll(&)
198
+ if @lifetime_aware && @options.lifetime && Time.now - @epoch > @options.lifetime * 0.9
199
+ @loog.debug("We ran out of lifetime (#{@epoch.ago} already), can't even start")
200
+ return
201
+ end
202
+ if @timeout_aware && @options.timeout && Time.now - @kickoff > @options.timeout * 0.9
203
+ @loog.debug("We've spent more than #{@kickoff.ago}, won't even start")
204
+ return
205
+ end
198
206
  passed = 0
199
207
  oct = Fbe.octo(loog: @loog, options: @options, global: @global)
200
208
  @fb.query(@query).each do |a|
data/lib/fbe/iterate.rb CHANGED
@@ -97,6 +97,7 @@ class Fbe::Iterate
97
97
  @label = nil
98
98
  @since = 0
99
99
  @query = nil
100
+ @sort_by = nil
100
101
  @repeats = 1
101
102
  @quota_aware = true
102
103
  @lifetime_aware = true
@@ -164,6 +165,24 @@ class Fbe::Iterate
164
165
  @query = query
165
166
  end
166
167
 
168
+ # Sets the field to sort results by in ascending order.
169
+ #
170
+ # When set, all matching results will be fetched, sorted by the specified
171
+ # field, and iterated in order. This executes the query once per repository
172
+ # instead of calling one() repeatedly.
173
+ #
174
+ # @param [String] prop The fact attribute to sort by
175
+ # @return [nil] Nothing is returned
176
+ # @raise [RuntimeError] If prop is nil, already set, or not a valid field name
177
+ # @example Sort issues by number
178
+ # iterator.sort_by('issue')
179
+ def sort_by(prop)
180
+ raise 'Sort field is already set' unless @sort_by.nil?
181
+ raise 'Cannot set sort field to nil' if prop.nil?
182
+ raise 'Sort field must be a String' unless prop.is_a?(String)
183
+ @sort_by = prop
184
+ end
185
+
167
186
  # Sets the label for tracking iteration state.
168
187
  #
169
188
  # The label is used to create marker facts in the factbase that track
@@ -245,6 +264,7 @@ class Fbe::Iterate
245
264
  ]
246
265
  end
247
266
  starts = before.dup
267
+ values = {}
248
268
  loop do
249
269
  if @quota_aware && oct.off_quota?
250
270
  @loog.info("We are off GitHub quota, time to stop after #{started.ago}")
@@ -277,11 +297,24 @@ class Fbe::Iterate
277
297
  @loog.debug("We've seen too many (#{seen[repo]}) in #{repo}, let's see next one")
278
298
  next
279
299
  end
280
- nxt = @fb.query(@query).one(@fb, before: before[repo], repository: repo)
300
+ nxt =
301
+ if @sort_by
302
+ values[repo] ||= @fb.query(@query).each(
303
+ @fb, before: before[repo], repository: repo
304
+ ).map { _1[@sort_by]&.first }.compact.sort.each
305
+ begin
306
+ values[repo].next
307
+ rescue StopIteration
308
+ nil
309
+ end
310
+ else
311
+ @fb.query(@query).one(@fb, before: before[repo], repository: repo)
312
+ end
281
313
  before[repo] =
282
314
  if nxt.nil?
283
315
  @loog.debug("Next element after ##{before[repo]} not suggested, re-starting from ##{@since}: #{@query}")
284
316
  restarted << repo
317
+ values.delete(repo) if @sort_by
285
318
  @since
286
319
  else
287
320
  @loog.debug("Next is ##{nxt}, starting from it")
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.38.1' unless const_defined?(:VERSION)
13
+ VERSION = '0.39.0' unless const_defined?(:VERSION)
14
14
  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.38.1
4
+ version: 0.39.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko