fbe 0.25.1 → 0.26.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: 67cf152b4e3772a5ebd732741963baa7e6b02ced09fe0dfb372f3f5035edfb50
4
- data.tar.gz: c9d7838bead7f87e11289bcd92ae84cd460d9f19ea875977326559ee4264b8c5
3
+ metadata.gz: 3febaef5c95ce42ac53465cf0ba6e511c0fee2505e9ea359c9fe488ea384ef5c
4
+ data.tar.gz: e17d46ddc79715f655bdef20a8484acd65dd38ac62e4f9d0717a330dcc1a2631
5
5
  SHA512:
6
- metadata.gz: fb39e6b666c46b43b483f5075d99ca36fac1086577df736a624bf109487fef976da1e2c8fc61fd05aff252c6bae270e269b7f47ff9bde433b53d1b2d9f19c57f
7
- data.tar.gz: ec66f9a5dab0b3f402881870516b07b1cc8d70fa282a6b020a880793ec1631e9a310158915b9b8ecff2a077fd8339d569d28fd7ae069dc4f8c488da75fc86bf6
6
+ metadata.gz: 1410ceb456eb24952e4665275168c67e44495f13c7d10f62a4ea7a93c2fdcbe1352bf445bfcd84b4468ab299233bac8cfa74fcf31730a7c7d9cd2e9b7fa00441
7
+ data.tar.gz: 8fa1f5e93abfedb2c9e49323b14ab85c33c2f1322758d9a46237817b9308a5ce19658b3d11fafe565179ed46831912d8e13e0fa899e6d074df8914e328886882
data/Gemfile.lock CHANGED
@@ -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.9.8)
50
+ baza.rb (0.9.12)
51
51
  backtrace (~> 0.4)
52
52
  elapsed (~> 0.0)
53
53
  faraday (~> 2.13)
@@ -70,13 +70,13 @@ GEM
70
70
  decoor (0.1.0)
71
71
  docile (1.4.1)
72
72
  drb (2.2.3)
73
- elapsed (0.1.0)
74
- loog (> 0)
75
- tago (> 0)
73
+ elapsed (0.2.0)
74
+ loog (~> 0.6)
75
+ tago (~> 0.1)
76
76
  ellipsized (0.3.0)
77
77
  ethon (0.16.0)
78
78
  ffi (>= 1.15.0)
79
- factbase (0.13.0)
79
+ factbase (0.14.3)
80
80
  backtrace (~> 0.4)
81
81
  decoor (~> 0.0)
82
82
  ellipsized (~> 0.3)
@@ -87,7 +87,7 @@ GEM
87
87
  others (~> 0.0)
88
88
  tago (~> 0.0)
89
89
  yaml (~> 0.3)
90
- faraday (2.13.2)
90
+ faraday (2.13.4)
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.10)
110
+ graphql (2.5.11)
111
111
  base64
112
112
  fiber-storage
113
113
  logger
@@ -119,9 +119,9 @@ GEM
119
119
  concurrent-ruby (~> 1.0)
120
120
  intercepted (0.2.0)
121
121
  iri (0.11.2)
122
- joined (0.3.0)
123
- json (2.12.2)
124
- judges (0.51.0)
122
+ joined (0.4.0)
123
+ json (2.13.2)
124
+ judges (0.52.1)
125
125
  backtrace (~> 0.4)
126
126
  baza.rb (~> 0.5)
127
127
  concurrent-ruby (~> 1.2)
@@ -157,23 +157,23 @@ GEM
157
157
  multipart-post (2.4.1)
158
158
  net-http (0.6.0)
159
159
  uri
160
- nokogiri (1.18.8-arm64-darwin)
160
+ nokogiri (1.18.9-arm64-darwin)
161
161
  racc (~> 1.4)
162
- nokogiri (1.18.8-x64-mingw-ucrt)
162
+ nokogiri (1.18.9-x64-mingw-ucrt)
163
163
  racc (~> 1.4)
164
- nokogiri (1.18.8-x86_64-darwin)
164
+ nokogiri (1.18.9-x86_64-darwin)
165
165
  racc (~> 1.4)
166
- nokogiri (1.18.8-x86_64-linux-gnu)
166
+ nokogiri (1.18.9-x86_64-linux-gnu)
167
167
  racc (~> 1.4)
168
168
  obk (0.3.2)
169
169
  octokit (10.0.0)
170
170
  faraday (>= 1, < 3)
171
171
  sawyer (~> 0.9)
172
172
  os (1.1.4)
173
- ostruct (0.6.2)
173
+ ostruct (0.6.3)
174
174
  others (0.1.1)
175
175
  parallel (1.27.0)
176
- parser (3.3.8.0)
176
+ parser (3.3.9.0)
177
177
  ast (~> 2.4.1)
178
178
  racc
179
179
  prism (1.4.0)
@@ -189,7 +189,7 @@ GEM
189
189
  regexp_parser (2.10.0)
190
190
  retries (0.0.5)
191
191
  rexml (3.4.1)
192
- rubocop (1.78.0)
192
+ rubocop (1.79.0)
193
193
  json (~> 2.3)
194
194
  language_server-protocol (~> 3.17.0.2)
195
195
  lint_roller (~> 1.1.0)
@@ -197,10 +197,11 @@ 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.45.1, < 2.0)
200
+ rubocop-ast (>= 1.46.0, < 2.0)
201
201
  ruby-progressbar (~> 1.7)
202
+ tsort (>= 0.2.0)
202
203
  unicode-display_width (>= 2.4.0, < 4.0)
203
- rubocop-ast (1.45.1)
204
+ rubocop-ast (1.46.0)
204
205
  parser (>= 3.3.7.2)
205
206
  prism (~> 1.4)
206
207
  rubocop-minitest (0.38.1)
@@ -226,16 +227,17 @@ GEM
226
227
  simplecov-cobertura (3.0.0)
227
228
  rexml
228
229
  simplecov (~> 0.19)
229
- simplecov-html (0.13.1)
230
+ simplecov-html (0.13.2)
230
231
  simplecov_json_formatter (0.1.4)
231
- sqlite3 (2.7.1-arm64-darwin)
232
- sqlite3 (2.7.1-x64-mingw-ucrt)
233
- sqlite3 (2.7.1-x86_64-darwin)
234
- sqlite3 (2.7.1-x86_64-linux-gnu)
232
+ sqlite3 (2.7.3-arm64-darwin)
233
+ sqlite3 (2.7.3-x64-mingw-ucrt)
234
+ sqlite3 (2.7.3-x86_64-darwin)
235
+ sqlite3 (2.7.3-x86_64-linux-gnu)
235
236
  strscan (3.1.5)
236
237
  tago (0.1.0)
237
238
  timeout (0.4.3)
238
239
  total (0.4.1)
240
+ tsort (0.2.0)
239
241
  typhoeus (1.4.1)
240
242
  ethon (>= 0.9.0)
241
243
  tzinfo (2.0.6)
data/lib/fbe/fb.rb CHANGED
@@ -5,6 +5,7 @@
5
5
 
6
6
  require 'factbase'
7
7
  require 'factbase/cached/cached_factbase'
8
+ require 'factbase/impatient'
8
9
  require 'factbase/indexed/indexed_factbase'
9
10
  require 'factbase/logged'
10
11
  require 'factbase/pre'
@@ -46,15 +47,18 @@ def Fbe.fb(fb: $fb, global: $global, options: $options, loog: $loog)
46
47
  f._version = "#{Factbase::VERSION}/#{Judges::VERSION}/#{options.action_version}"
47
48
  f._job = options.job_id unless options.job_id.nil?
48
49
  end
49
- Factbase::Logged.new(
50
- Factbase::SyncFactbase.new(
51
- Factbase::IndexedFactbase.new(
52
- Factbase::CachedFactbase.new(
53
- fbe
50
+ Factbase::Impatient.new(
51
+ Factbase::Logged.new(
52
+ Factbase::SyncFactbase.new(
53
+ Factbase::IndexedFactbase.new(
54
+ Factbase::CachedFactbase.new(
55
+ fbe
56
+ )
54
57
  )
55
- )
58
+ ),
59
+ loog
56
60
  ),
57
- loog
61
+ timeout: 60
58
62
  )
59
63
  end
60
64
  end
@@ -49,11 +49,12 @@ end
49
49
  # @param [Judges::Options] options Options containing 'repositories' field with masks
50
50
  # @param [Hash] global Global cache for storing API responses
51
51
  # @param [Loog] loog Logger for debug output
52
+ # @param [quota_aware] Boolean Should we stop if quota is off?
52
53
  # @return [Array<String>] Shuffled list of repository full names (e.g., 'org/repo')
53
54
  # @raise [RuntimeError] If no repositories match the provided masks
54
55
  # @note Exclusion patterns must start with '-' (e.g., '-org/pattern*')
55
56
  # @note Results are shuffled to distribute load when processing
56
- def Fbe.unmask_repos(options: $options, global: $global, loog: $loog)
57
+ def Fbe.unmask_repos(options: $options, global: $global, loog: $loog, quota_aware: true)
57
58
  raise 'Repositories mask is not specified' unless options.repositories
58
59
  raise 'Repositories mask is empty' if options.repositories.empty?
59
60
  repos = []
@@ -77,5 +78,12 @@ def Fbe.unmask_repos(options: $options, global: $global, loog: $loog)
77
78
  raise "No repos found matching: #{options.repositories.inspect}" if repos.empty?
78
79
  repos.shuffle!
79
80
  loog.debug("Scanning #{repos.size} repositories: #{repos.joined}...")
80
- repos
81
+ return repos unless block_given?
82
+ repos.each do |repo|
83
+ if quota_aware && octo.off_quota?
84
+ $loog.info("No GitHub quota left, it is time to stop at #{repo}")
85
+ break
86
+ end
87
+ yield repo
88
+ end
81
89
  end
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.25.1' unless const_defined?(:VERSION)
13
+ VERSION = '0.26.0' unless const_defined?(:VERSION)
14
14
  end
@@ -25,6 +25,15 @@ class TestUnmaskRepos < Fbe::Test
25
25
  refute_includes(list, 'zerocracy/datum')
26
26
  end
27
27
 
28
+ def test_iterates_them
29
+ opts = Judges::Options.new({ 'testing' => true, 'repositories' => 'yegor256/tacit,zerocracy/*' })
30
+ list = []
31
+ Fbe.unmask_repos(options: opts, global: {}, loog: Loog::NULL) do |n|
32
+ list << n
33
+ end
34
+ assert_predicate(list.size, :positive?)
35
+ end
36
+
28
37
  def test_finds_case_insensitive
29
38
  opts = Judges::Options.new({ 'testing' => true, 'repositories' => 'Yegor256/*' })
30
39
  list = Fbe.unmask_repos(options: opts, global: {}, loog: Loog::NULL)
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.25.1
4
+ version: 0.26.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko