fbe 0.26.0 → 0.26.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3febaef5c95ce42ac53465cf0ba6e511c0fee2505e9ea359c9fe488ea384ef5c
4
- data.tar.gz: e17d46ddc79715f655bdef20a8484acd65dd38ac62e4f9d0717a330dcc1a2631
3
+ metadata.gz: b849b9929f2a7579adec7673a431029084c7b803254dec5787eb646a350d24ac
4
+ data.tar.gz: b1ef7521253aaf79effeb848d10546f34263bf4ee9c70061525ac319eb763639
5
5
  SHA512:
6
- metadata.gz: 1410ceb456eb24952e4665275168c67e44495f13c7d10f62a4ea7a93c2fdcbe1352bf445bfcd84b4468ab299233bac8cfa74fcf31730a7c7d9cd2e9b7fa00441
7
- data.tar.gz: 8fa1f5e93abfedb2c9e49323b14ab85c33c2f1322758d9a46237817b9308a5ce19658b3d11fafe565179ed46831912d8e13e0fa899e6d074df8914e328886882
6
+ metadata.gz: ce54eb0f7a9c8d167f3f10ca07a17b2ceaf2a16b9022105e7716140d0922a628aae23b4440cb72b2dc25119fc2e52b56ef4b39b9566dfd0c79aed63119f3463c
7
+ data.tar.gz: 85d36c561759499b8216f65477cdc5b8b9e3878ac83e9dd89d4001039bd8fac2ee66a64f5b10c5af7b366051567a987c163c28bae4d7085c69d10210f6ecf3e2
data/Gemfile.lock CHANGED
@@ -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.79.0)
192
+ rubocop (1.79.1)
193
193
  json (~> 2.3)
194
194
  language_server-protocol (~> 3.17.0.2)
195
195
  lint_roller (~> 1.1.0)
@@ -199,7 +199,6 @@ GEM
199
199
  regexp_parser (>= 2.9.3, < 3.0)
200
200
  rubocop-ast (>= 1.46.0, < 2.0)
201
201
  ruby-progressbar (~> 1.7)
202
- tsort (>= 0.2.0)
203
202
  unicode-display_width (>= 2.4.0, < 4.0)
204
203
  rubocop-ast (1.46.0)
205
204
  parser (>= 3.3.7.2)
@@ -237,7 +236,6 @@ GEM
237
236
  tago (0.1.0)
238
237
  timeout (0.4.3)
239
238
  total (0.4.1)
240
- tsort (0.2.0)
241
239
  typhoeus (1.4.1)
242
240
  ethon (>= 0.9.0)
243
241
  tzinfo (2.0.6)
data/lib/fbe/octo.rb CHANGED
@@ -185,6 +185,7 @@ def Fbe.octo(options: $options, global: $global, loog: $loog)
185
185
  raise 'The name of the repo is nil' if name.nil?
186
186
  json = @origin.repository(name)
187
187
  id = json[:id]
188
+ raise "Repository #{name} not found" if id.nil?
188
189
  @loog.debug("GitHub repository #{name.inspect} has an ID: ##{id}")
189
190
  id
190
191
  end
@@ -78,6 +78,7 @@ def Fbe.unmask_repos(options: $options, global: $global, loog: $loog, quota_awar
78
78
  raise "No repos found matching: #{options.repositories.inspect}" if repos.empty?
79
79
  repos.shuffle!
80
80
  loog.debug("Scanning #{repos.size} repositories: #{repos.joined}...")
81
+ repos.each { |repo| octo.repository(repo) }
81
82
  return repos unless block_given?
82
83
  repos.each do |repo|
83
84
  if quota_aware && octo.off_quota?
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.26.0' unless const_defined?(:VERSION)
13
+ VERSION = '0.26.2' unless const_defined?(:VERSION)
14
14
  end
@@ -64,6 +64,29 @@ class TestOcto < Fbe::Test
64
64
  assert_equal('dude56', nick)
65
65
  end
66
66
 
67
+ def test_reads_repo_id_by_name
68
+ WebMock.disable_net_connect!
69
+ stub_request(:get, 'https://api.github.com/rate_limit').to_return(
70
+ { body: '{}', headers: { 'X-RateLimit-Remaining' => '222' } }
71
+ )
72
+ o = Fbe.octo(loog: Loog::NULL, global: {}, options: Judges::Options.new)
73
+ stub_request(:get, 'https://api.github.com/repos/foo/bar').to_return(
74
+ body: { id: 42 }.to_json, headers: { 'Content-Type': 'application/json' }
75
+ )
76
+ id = o.repo_id_by_name('foo/bar')
77
+ assert_equal(42, id)
78
+ end
79
+
80
+ def test_reads_lost_repo_id_by_name
81
+ WebMock.disable_net_connect!
82
+ stub_request(:get, 'https://api.github.com/rate_limit').to_return(
83
+ { body: '{}', headers: { 'X-RateLimit-Remaining' => '222' } }
84
+ )
85
+ o = Fbe.octo(loog: Loog::NULL, global: {}, options: Judges::Options.new)
86
+ stub_request(:get, 'https://api.github.com/repos/foo/bar').to_return(status: 404)
87
+ assert_raises(StandardError) { o.repo_id_by_name('foo/bar') }
88
+ end
89
+
67
90
  def test_fails_user_request_when_off_quota
68
91
  WebMock.disable_net_connect!
69
92
  stub_request(:get, 'https://api.github.com/rate_limit').to_return(
@@ -34,6 +34,16 @@ class TestUnmaskRepos < Fbe::Test
34
34
  assert_predicate(list.size, :positive?)
35
35
  end
36
36
 
37
+ def test_fails_on_broken_names
38
+ WebMock.disable_net_connect!
39
+ stub_request(:get, 'https://api.github.com/rate_limit').to_return(
40
+ { body: '{}', headers: { 'X-RateLimit-Remaining' => '222' } }
41
+ )
42
+ stub_request(:get, 'https://api.github.com/repos/foo/bar').to_return(status: 404)
43
+ options = Judges::Options.new({ 'repositories' => 'foo/bar' })
44
+ assert_raises(StandardError) { Fbe.unmask_repos(options:, global: {}, loog: Loog::NULL).each.to_a }
45
+ end
46
+
37
47
  def test_finds_case_insensitive
38
48
  opts = Judges::Options.new({ 'testing' => true, 'repositories' => 'Yegor256/*' })
39
49
  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.26.0
4
+ version: 0.26.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko