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 +4 -4
- data/Gemfile.lock +1 -3
- data/lib/fbe/octo.rb +1 -0
- data/lib/fbe/unmask_repos.rb +1 -0
- data/lib/fbe.rb +1 -1
- data/test/fbe/test_octo.rb +23 -0
- data/test/fbe/test_unmask_repos.rb +10 -0
- 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: b849b9929f2a7579adec7673a431029084c7b803254dec5787eb646a350d24ac
|
4
|
+
data.tar.gz: b1ef7521253aaf79effeb848d10546f34263bf4ee9c70061525ac319eb763639
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|
data/lib/fbe/unmask_repos.rb
CHANGED
@@ -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
data/test/fbe/test_octo.rb
CHANGED
@@ -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)
|