fbe 0.25.2 → 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: e3de49b140508afd1a989a717220dc48363172e87a1e505cd4389681a506978b
4
- data.tar.gz: 408c55e983349bcc82055d06922f20748d332b0beafac507340ee2745fac895a
3
+ metadata.gz: 3febaef5c95ce42ac53465cf0ba6e511c0fee2505e9ea359c9fe488ea384ef5c
4
+ data.tar.gz: e17d46ddc79715f655bdef20a8484acd65dd38ac62e4f9d0717a330dcc1a2631
5
5
  SHA512:
6
- metadata.gz: e2f7b6c2b768012d2e600c03953053c756905a77e25b84b11be796efa678dc6a89ebd99d573761528c8295acf93a1e8f3c554ce755061ff771767625053ed195
7
- data.tar.gz: '0990166f5c5283d87687e2bb512ed2ae14e2afa35404ff81f9d02517c45ecac6ec187a8f3c2a05fb3bda9cb7a4220b6e0130aa94e35d069306e2224124980961'
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.11)
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.14.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.3)
90
+ faraday (2.13.4)
91
91
  faraday-net_http (>= 2.0, < 3.5)
92
92
  json
93
93
  logger
@@ -120,8 +120,8 @@ GEM
120
120
  intercepted (0.2.0)
121
121
  iri (0.11.2)
122
122
  joined (0.4.0)
123
- json (2.13.0)
124
- judges (0.51.1)
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)
@@ -173,7 +173,7 @@ GEM
173
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,8 +197,9 @@ 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
204
  rubocop-ast (1.46.0)
204
205
  parser (>= 3.3.7.2)
@@ -236,6 +237,7 @@ GEM
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)
@@ -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.2' 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.2
4
+ version: 0.26.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko