fbe 0.10.0 → 0.12.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 +4 -4
- data/.github/workflows/typos.yml +19 -0
- data/.gitignore +2 -2
- data/.rubocop.yml +1 -0
- data/Gemfile.lock +12 -11
- data/REUSE.toml +8 -7
- data/lib/fbe/octo.rb +171 -1
- data/lib/fbe.rb +1 -1
- data/test/fbe/test_octo.rb +24 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ed20ed25d37fbb0a555303dad81f2ac461a59e17b073af0be21775475d92fc8
|
4
|
+
data.tar.gz: 7621cf7d678261979e315b9222843ebaf6f1cdd29e339ddac776393514fefd73
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ba5749440eb961591dcc10e8c3457b9b926e55152313670b6e3e220a54e2422b684a9a5f7ede3f873ee38244d7759f0a18f95ae97430296fa328922996e42a6
|
7
|
+
data.tar.gz: '08461885b503285fec347a052e9c321535415bb218cd88d6b476b4ec40a9fb44934fddbd276a0c5d4f4bb145db94a71ffedead986787d250ad07dcd0af34b886'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Zerocracy
|
2
|
+
# SPDX-License-Identifier: MIT
|
3
|
+
---
|
4
|
+
# yamllint disable rule:line-length
|
5
|
+
name: typos
|
6
|
+
'on':
|
7
|
+
push:
|
8
|
+
branches:
|
9
|
+
- master
|
10
|
+
pull_request:
|
11
|
+
branches:
|
12
|
+
- master
|
13
|
+
jobs:
|
14
|
+
typos:
|
15
|
+
timeout-minutes: 15
|
16
|
+
runs-on: ubuntu-24.04
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v4
|
19
|
+
- uses: crate-ci/typos@v1.32.0
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -58,7 +58,7 @@ GEM
|
|
58
58
|
bigdecimal (3.1.9)
|
59
59
|
builder (3.3.0)
|
60
60
|
concurrent-ruby (1.3.5)
|
61
|
-
connection_pool (2.5.
|
61
|
+
connection_pool (2.5.3)
|
62
62
|
crack (1.0.0)
|
63
63
|
bigdecimal
|
64
64
|
rexml
|
@@ -70,7 +70,7 @@ GEM
|
|
70
70
|
tago (> 0)
|
71
71
|
ethon (0.16.0)
|
72
72
|
ffi (>= 1.15.0)
|
73
|
-
factbase (0.10.
|
73
|
+
factbase (0.10.2)
|
74
74
|
backtrace (~> 0.4)
|
75
75
|
decoor (~> 0.0)
|
76
76
|
json (~> 2.7)
|
@@ -80,7 +80,7 @@ GEM
|
|
80
80
|
others (~> 0.0)
|
81
81
|
tago (~> 0.0)
|
82
82
|
yaml (~> 0.3)
|
83
|
-
faraday (2.13.
|
83
|
+
faraday (2.13.1)
|
84
84
|
faraday-net_http (>= 2.0, < 3.5)
|
85
85
|
json
|
86
86
|
logger
|
@@ -99,7 +99,7 @@ GEM
|
|
99
99
|
fiber-storage (1.0.1)
|
100
100
|
gli (2.22.2)
|
101
101
|
ostruct
|
102
|
-
graphql (2.5.
|
102
|
+
graphql (2.5.7)
|
103
103
|
base64
|
104
104
|
fiber-storage
|
105
105
|
logger
|
@@ -110,8 +110,8 @@ GEM
|
|
110
110
|
i18n (1.14.7)
|
111
111
|
concurrent-ruby (~> 1.0)
|
112
112
|
iri (0.10.0)
|
113
|
-
json (2.
|
114
|
-
judges (0.
|
113
|
+
json (2.12.0)
|
114
|
+
judges (0.42.1)
|
115
115
|
backtrace (~> 0)
|
116
116
|
baza.rb (~> 0)
|
117
117
|
concurrent-ruby (~> 1.2)
|
@@ -128,11 +128,12 @@ GEM
|
|
128
128
|
timeout (~> 0)
|
129
129
|
total (~> 0)
|
130
130
|
typhoeus (~> 1.3)
|
131
|
-
language_server-protocol (3.17.0.
|
131
|
+
language_server-protocol (3.17.0.5)
|
132
132
|
lint_roller (1.1.0)
|
133
133
|
liquid (5.5.1)
|
134
134
|
logger (1.7.0)
|
135
|
-
loog (0.6.
|
135
|
+
loog (0.6.1)
|
136
|
+
logger (~> 1.0)
|
136
137
|
minitest (5.25.5)
|
137
138
|
minitest-reporters (1.7.1)
|
138
139
|
ansi
|
@@ -163,8 +164,8 @@ GEM
|
|
163
164
|
ast (~> 2.4.1)
|
164
165
|
racc
|
165
166
|
prism (1.4.0)
|
166
|
-
public_suffix (6.0.
|
167
|
-
qbash (0.4.
|
167
|
+
public_suffix (6.0.2)
|
168
|
+
qbash (0.4.5)
|
168
169
|
backtrace (> 0)
|
169
170
|
elapsed (> 0)
|
170
171
|
loog (> 0)
|
@@ -175,7 +176,7 @@ GEM
|
|
175
176
|
regexp_parser (2.10.0)
|
176
177
|
retries (0.0.5)
|
177
178
|
rexml (3.4.1)
|
178
|
-
rubocop (1.75.
|
179
|
+
rubocop (1.75.6)
|
179
180
|
json (~> 2.3)
|
180
181
|
language_server-protocol (~> 3.17.0.2)
|
181
182
|
lint_roller (~> 1.1.0)
|
data/REUSE.toml
CHANGED
@@ -4,9 +4,17 @@
|
|
4
4
|
version = 1
|
5
5
|
[[annotations]]
|
6
6
|
path = [
|
7
|
+
".DS_Store",
|
8
|
+
".gitattributes",
|
9
|
+
".gitignore",
|
10
|
+
".pdd",
|
7
11
|
"**.json",
|
8
12
|
"**.md",
|
13
|
+
"**.png",
|
9
14
|
"**.txt",
|
15
|
+
"**/.DS_Store",
|
16
|
+
"**/.gitignore",
|
17
|
+
"**/.pdd",
|
10
18
|
"**/*.csv",
|
11
19
|
"**/*.fe",
|
12
20
|
"**/*.jpg",
|
@@ -18,15 +26,8 @@ path = [
|
|
18
26
|
"**/*.svg",
|
19
27
|
"**/*.txt",
|
20
28
|
"**/*.vm",
|
21
|
-
"**/.DS_Store",
|
22
|
-
"**/.gitignore",
|
23
|
-
"**/.pdd",
|
24
29
|
"**/CNAME",
|
25
30
|
"**/Gemfile.lock",
|
26
|
-
".DS_Store",
|
27
|
-
".gitattributes",
|
28
|
-
".gitignore",
|
29
|
-
".pdd",
|
30
31
|
"Gemfile.lock",
|
31
32
|
"README.md",
|
32
33
|
"renovate.json",
|
data/lib/fbe/octo.rb
CHANGED
@@ -50,7 +50,8 @@ def Fbe.octo(options: $options, global: $global, loog: $loog)
|
|
50
50
|
loog.warn('The GitHub API token is an empty string, won\'t use it')
|
51
51
|
else
|
52
52
|
o = Octokit::Client.new(access_token: token)
|
53
|
-
loog.info("Accessing GitHub API with a token (#{token.length} chars, ending by #{token[-4..].inspect}
|
53
|
+
loog.info("Accessing GitHub API with a token (#{token.length} chars, ending by #{token[-4..].inspect}, " \
|
54
|
+
"#{Octokit::Client.new(access_token: token).rate_limit.remaining} quota remaining)")
|
54
55
|
end
|
55
56
|
o.auto_paginate = true
|
56
57
|
o.per_page = 100
|
@@ -173,6 +174,173 @@ class Fbe::FakeOctokit
|
|
173
174
|
]
|
174
175
|
end
|
175
176
|
|
177
|
+
# Gets repository invitations for the authenticated user.
|
178
|
+
#
|
179
|
+
# @param [Hash] _options Additional options (not used in mock)
|
180
|
+
# @return [Array<Hash>] Array of invitation objects with repository and inviter information
|
181
|
+
# @example
|
182
|
+
# fake_client = Fbe::FakeOctokit.new
|
183
|
+
# fake_client.user_repository_invitations #=> [{:id=>1, :node_id=>"INV_", ...}]
|
184
|
+
def user_repository_invitations(_options = {})
|
185
|
+
[
|
186
|
+
{
|
187
|
+
id: 1,
|
188
|
+
node_id: 'INV_kwDOJRF-Hq4B_yXr',
|
189
|
+
repository: repository('zerocracy/fbe'),
|
190
|
+
invitee: user(526_301),
|
191
|
+
inviter: user(888),
|
192
|
+
permissions: 'write',
|
193
|
+
created_at: random_time,
|
194
|
+
url: 'https://api.github.com/user/repository_invitations/1',
|
195
|
+
html_url: 'https://github.com/zerocracy/fbe/invitations',
|
196
|
+
expired: false
|
197
|
+
},
|
198
|
+
{
|
199
|
+
id: 2,
|
200
|
+
node_id: 'INV_kwDOJRF-Hq4B_yXs',
|
201
|
+
repository: repository('yegor256/takes'),
|
202
|
+
invitee: user(526_301),
|
203
|
+
inviter: user(888),
|
204
|
+
permissions: 'admin',
|
205
|
+
created_at: random_time,
|
206
|
+
url: 'https://api.github.com/user/repository_invitations/2',
|
207
|
+
html_url: 'https://github.com/yegor256/takes/invitations',
|
208
|
+
expired: false
|
209
|
+
}
|
210
|
+
]
|
211
|
+
end
|
212
|
+
|
213
|
+
# Gets organization memberships for the authenticated user.
|
214
|
+
#
|
215
|
+
# @param [Hash] _options Additional options (not used in mock)
|
216
|
+
# @return [Array<Hash>] Array of organization membership objects
|
217
|
+
# @example
|
218
|
+
# fake_client = Fbe::FakeOctokit.new
|
219
|
+
# fake_client.organization_memberships #=> [{:url=>"https://api.github.com/orgs/...", ...}]
|
220
|
+
def organization_memberships(_options = {})
|
221
|
+
[
|
222
|
+
{
|
223
|
+
url: 'https://api.github.com/orgs/zerocracy/memberships/yegor256',
|
224
|
+
state: 'active',
|
225
|
+
role: 'admin',
|
226
|
+
organization_url: 'https://api.github.com/orgs/zerocracy',
|
227
|
+
organization: {
|
228
|
+
login: 'zerocracy',
|
229
|
+
id: 24_234_201,
|
230
|
+
node_id: 'MDEyOk9yZ2FuaXphdGlvbjI0MjM0MjAx',
|
231
|
+
url: 'https://api.github.com/orgs/zerocracy',
|
232
|
+
avatar_url: 'https://avatars.githubusercontent.com/u/24234201?v=4',
|
233
|
+
description: 'AI-managed software development',
|
234
|
+
name: 'Zerocracy',
|
235
|
+
company: nil,
|
236
|
+
blog: 'https://www.zerocracy.com',
|
237
|
+
location: nil,
|
238
|
+
email: 'team@zerocracy.com',
|
239
|
+
twitter_username: nil,
|
240
|
+
is_verified: false,
|
241
|
+
has_organization_projects: true,
|
242
|
+
has_repository_projects: true,
|
243
|
+
public_repos: 30,
|
244
|
+
public_gists: 0,
|
245
|
+
followers: 0,
|
246
|
+
following: 0,
|
247
|
+
html_url: 'https://github.com/zerocracy',
|
248
|
+
created_at: random_time,
|
249
|
+
updated_at: random_time,
|
250
|
+
type: 'Organization'
|
251
|
+
},
|
252
|
+
user: user(526_301)
|
253
|
+
},
|
254
|
+
{
|
255
|
+
url: 'https://api.github.com/orgs/objectionary/memberships/yegor256',
|
256
|
+
state: 'active',
|
257
|
+
role: 'member',
|
258
|
+
organization_url: 'https://api.github.com/orgs/objectionary',
|
259
|
+
organization: {
|
260
|
+
login: 'objectionary',
|
261
|
+
id: 80_033_603,
|
262
|
+
node_id: 'MDEyOk9yZ2FuaXphdGlvbjgwMDMzNjAz',
|
263
|
+
url: 'https://api.github.com/orgs/objectionary',
|
264
|
+
avatar_url: 'https://avatars.githubusercontent.com/u/80033603?v=4',
|
265
|
+
description: 'EO/EOLANG, an object-oriented language',
|
266
|
+
name: 'Objectionary',
|
267
|
+
company: nil,
|
268
|
+
blog: 'https://www.eolang.org',
|
269
|
+
location: nil,
|
270
|
+
email: nil,
|
271
|
+
twitter_username: nil,
|
272
|
+
is_verified: false,
|
273
|
+
has_organization_projects: true,
|
274
|
+
has_repository_projects: true,
|
275
|
+
public_repos: 15,
|
276
|
+
public_gists: 0,
|
277
|
+
followers: 0,
|
278
|
+
following: 0,
|
279
|
+
html_url: 'https://github.com/objectionary',
|
280
|
+
created_at: random_time,
|
281
|
+
updated_at: random_time,
|
282
|
+
type: 'Organization'
|
283
|
+
},
|
284
|
+
user: user(526_301)
|
285
|
+
}
|
286
|
+
]
|
287
|
+
end
|
288
|
+
|
289
|
+
# Updates the authenticated user's organization membership.
|
290
|
+
#
|
291
|
+
# @param [String] org The organization name (e.g., 'zerocracy')
|
292
|
+
# @param [Hash] _options Additional options (typically includes :state to update membership state)
|
293
|
+
# @return [Hash] Updated membership information
|
294
|
+
# @example
|
295
|
+
# fake_client = Fbe::FakeOctokit.new
|
296
|
+
# fake_client.update_organization_membership('zerocracy', state: 'active')
|
297
|
+
def update_organization_membership(org, _options = {})
|
298
|
+
{
|
299
|
+
url: "https://api.github.com/orgs/#{org}/memberships/yegor256",
|
300
|
+
state: 'active',
|
301
|
+
role: 'member',
|
302
|
+
organization_url: "https://api.github.com/orgs/#{org}",
|
303
|
+
organization: {
|
304
|
+
login: org,
|
305
|
+
id: 24_234_201,
|
306
|
+
node_id: 'MDEyOk9yZ2FuaXphdGlvbjI0MjM0MjAx',
|
307
|
+
url: "https://api.github.com/orgs/#{org}",
|
308
|
+
avatar_url: 'https://avatars.githubusercontent.com/u/24234201?v=4',
|
309
|
+
description: 'Organization description',
|
310
|
+
name: org.capitalize,
|
311
|
+
company: nil,
|
312
|
+
blog: "https://www.#{org}.com",
|
313
|
+
location: nil,
|
314
|
+
email: "team@#{org}.com",
|
315
|
+
twitter_username: nil,
|
316
|
+
is_verified: false,
|
317
|
+
has_organization_projects: true,
|
318
|
+
has_repository_projects: true,
|
319
|
+
public_repos: 30,
|
320
|
+
public_gists: 0,
|
321
|
+
followers: 0,
|
322
|
+
following: 0,
|
323
|
+
html_url: "https://github.com/#{org}",
|
324
|
+
created_at: random_time,
|
325
|
+
updated_at: random_time,
|
326
|
+
type: 'Organization'
|
327
|
+
},
|
328
|
+
user: user(526_301)
|
329
|
+
}
|
330
|
+
end
|
331
|
+
|
332
|
+
# Removes a user from an organization.
|
333
|
+
#
|
334
|
+
# @param [String] org The organization name (e.g., 'zerocracy')
|
335
|
+
# @param [String] _user The user login (not used in this mock implementation)
|
336
|
+
# @return [Boolean] Returns true when successful (204 No Content in actual API)
|
337
|
+
# @example
|
338
|
+
# fake_client = Fbe::FakeOctokit.new
|
339
|
+
# fake_client.remove_organization_membership('zerocracy') #=> true
|
340
|
+
def remove_organization_membership(_org, _user = nil)
|
341
|
+
true
|
342
|
+
end
|
343
|
+
|
176
344
|
# Gives a star to a repository.
|
177
345
|
#
|
178
346
|
# @param [String] _repo The repository name (e.g., 'user/repo')
|
@@ -193,6 +361,7 @@ class Fbe::FakeOctokit
|
|
193
361
|
# fake_client.user(526_301) #=> {:id=>444, :login=>"yegor256", :type=>"User"}
|
194
362
|
# fake_client.user('octocat') #=> {:id=>444, :login=>nil, :type=>"User"}
|
195
363
|
def user(uid)
|
364
|
+
raise Octokit::NotFound if [404_001, 404_002].include?(uid)
|
196
365
|
login = (uid == 526_301 ? 'yegor256' : 'torvalds') if uid.is_a?(Integer)
|
197
366
|
{
|
198
367
|
id: 444,
|
@@ -269,6 +438,7 @@ class Fbe::FakeOctokit
|
|
269
438
|
end
|
270
439
|
|
271
440
|
def repository(name)
|
441
|
+
raise Octokit::NotFound if [404_123, 404_124].include?(name)
|
272
442
|
{
|
273
443
|
id: name_to_number(name),
|
274
444
|
full_name: name.is_a?(Integer) ? 'yegor256/test' : name,
|
data/lib/fbe.rb
CHANGED
data/test/fbe/test_octo.rb
CHANGED
@@ -132,6 +132,18 @@ class TestOcto < Fbe::Test
|
|
132
132
|
assert(o.off_quota)
|
133
133
|
end
|
134
134
|
|
135
|
+
def test_print_quota_left_while_initialize
|
136
|
+
WebMock.disable_net_connect!
|
137
|
+
stub_request(:get, 'https://api.github.com/rate_limit').to_return(
|
138
|
+
body: '{}', headers: { 'X-RateLimit-Remaining' => '1234' }
|
139
|
+
)
|
140
|
+
buf = Loog::Buffer.new
|
141
|
+
o = Fbe.octo(loog: buf, global: {}, options: Judges::Options.new({ 'github_token' => 'secret_github_token' }))
|
142
|
+
assert_match(/Accessing GitHub API with a token \(19 chars, ending by "oken", 1234 quota remaining\)/, buf.to_s)
|
143
|
+
assert_nil(o.last_response, 'Not to be requests until initialize main Octokit client, ' \
|
144
|
+
'because middleware cached after first request and not apply after')
|
145
|
+
end
|
146
|
+
|
135
147
|
def test_retrying
|
136
148
|
WebMock.disable_net_connect!
|
137
149
|
global = {}
|
@@ -250,4 +262,16 @@ class TestOcto < Fbe::Test
|
|
250
262
|
o = Fbe.octo(loog: Loog::VERBOSE, global: {}, options: Judges::Options.new({ 'github_api_pause' => 0.01 }))
|
251
263
|
refute_nil(o.off_quota)
|
252
264
|
end
|
265
|
+
|
266
|
+
def test_fetches_fake_not_found_users
|
267
|
+
o = Fbe.octo(loog: Loog::NULL, global: {}, options: Judges::Options.new({ 'testing' => true }))
|
268
|
+
assert_raises(Octokit::NotFound) { o.user(404_001) }
|
269
|
+
assert_raises(Octokit::NotFound) { o.user(404_002) }
|
270
|
+
end
|
271
|
+
|
272
|
+
def test_fetches_fake_not_found_repos
|
273
|
+
o = Fbe.octo(loog: Loog::NULL, global: {}, options: Judges::Options.new({ 'testing' => true }))
|
274
|
+
assert_raises(Octokit::NotFound) { o.repository(404_123) }
|
275
|
+
assert_raises(Octokit::NotFound) { o.repository(404_124) }
|
276
|
+
end
|
253
277
|
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.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
@@ -265,6 +265,7 @@ files:
|
|
265
265
|
- ".github/workflows/pdd.yml"
|
266
266
|
- ".github/workflows/rake.yml"
|
267
267
|
- ".github/workflows/reuse.yml"
|
268
|
+
- ".github/workflows/typos.yml"
|
268
269
|
- ".github/workflows/xcop.yml"
|
269
270
|
- ".github/workflows/yamllint.yml"
|
270
271
|
- ".gitignore"
|