fbe 0.41.0 → 0.41.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/.github/workflows/codecov.yml +1 -1
- data/.github/workflows/typos.yml +1 -1
- data/Gemfile.lock +10 -10
- data/lib/fbe/github_graph.rb +62 -15
- data/lib/fbe/iterate.rb +3 -1
- data/lib/fbe/octo.rb +54 -37
- data/lib/fbe.rb +1 -1
- 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: 4a52362d869769dc3027bd183f38ee8d3d8a58906c6f80ad117e3eb7c57aa5e0
|
|
4
|
+
data.tar.gz: b80bafc4f9058883d16ec102873fc209ac00f0884716f23375e0c0a635ce3364
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 06d5913951e05e86c637b47ab753c242a6c797bbf80cffe7af16d41bdb705a542e39e510ddf420b153db90842116051f5ba5617766996517f467002172e401e9
|
|
7
|
+
data.tar.gz: 874aa12ad658ef1eae85cf083db1aec7b93654c4e995f2cc91e3dbf2bc782369a932c569cd50668b03a837a81bf0b078845d31945ff79df79bcb46b403dca202
|
data/.github/workflows/typos.yml
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -60,11 +60,11 @@ GEM
|
|
|
60
60
|
tago (~> 0.2)
|
|
61
61
|
typhoeus (~> 1.4)
|
|
62
62
|
benchmark (0.4.1)
|
|
63
|
-
bigdecimal (3.
|
|
63
|
+
bigdecimal (3.3.1)
|
|
64
64
|
builder (3.3.0)
|
|
65
65
|
concurrent-ruby (1.3.5)
|
|
66
66
|
connection_pool (2.5.4)
|
|
67
|
-
crack (1.0.
|
|
67
|
+
crack (1.0.1)
|
|
68
68
|
bigdecimal
|
|
69
69
|
rexml
|
|
70
70
|
decoor (0.1.0)
|
|
@@ -120,7 +120,7 @@ GEM
|
|
|
120
120
|
intercepted (0.2.0)
|
|
121
121
|
iri (0.11.2)
|
|
122
122
|
joined (0.4.0)
|
|
123
|
-
json (2.15.
|
|
123
|
+
json (2.15.1)
|
|
124
124
|
judges (0.54.0)
|
|
125
125
|
backtrace (~> 0.4)
|
|
126
126
|
baza.rb (~> 0.10)
|
|
@@ -146,7 +146,7 @@ GEM
|
|
|
146
146
|
logger (1.7.0)
|
|
147
147
|
loog (0.6.1)
|
|
148
148
|
logger (~> 1.0)
|
|
149
|
-
minitest (5.
|
|
149
|
+
minitest (5.26.0)
|
|
150
150
|
minitest-reporters (1.7.1)
|
|
151
151
|
ansi
|
|
152
152
|
builder
|
|
@@ -176,7 +176,7 @@ GEM
|
|
|
176
176
|
parser (3.3.9.0)
|
|
177
177
|
ast (~> 2.4.1)
|
|
178
178
|
racc
|
|
179
|
-
prism (1.5.
|
|
179
|
+
prism (1.5.2)
|
|
180
180
|
public_suffix (6.0.2)
|
|
181
181
|
qbash (0.4.5)
|
|
182
182
|
backtrace (> 0)
|
|
@@ -185,11 +185,11 @@ GEM
|
|
|
185
185
|
tago (> 0)
|
|
186
186
|
racc (1.8.1)
|
|
187
187
|
rainbow (3.1.1)
|
|
188
|
-
rake (13.3.
|
|
188
|
+
rake (13.3.1)
|
|
189
189
|
regexp_parser (2.11.3)
|
|
190
190
|
retries (0.0.5)
|
|
191
191
|
rexml (3.4.4)
|
|
192
|
-
rubocop (1.81.
|
|
192
|
+
rubocop (1.81.6)
|
|
193
193
|
json (~> 2.3)
|
|
194
194
|
language_server-protocol (~> 3.17.0.2)
|
|
195
195
|
lint_roller (~> 1.1.0)
|
|
@@ -207,10 +207,10 @@ GEM
|
|
|
207
207
|
lint_roller (~> 1.1)
|
|
208
208
|
rubocop (>= 1.75.0, < 2.0)
|
|
209
209
|
rubocop-ast (>= 1.38.0, < 2.0)
|
|
210
|
-
rubocop-performance (1.26.
|
|
210
|
+
rubocop-performance (1.26.1)
|
|
211
211
|
lint_roller (~> 1.1)
|
|
212
212
|
rubocop (>= 1.75.0, < 2.0)
|
|
213
|
-
rubocop-ast (>= 1.
|
|
213
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
|
214
214
|
rubocop-rake (0.7.1)
|
|
215
215
|
lint_roller (~> 1.1)
|
|
216
216
|
rubocop (>= 1.72.1)
|
|
@@ -248,7 +248,7 @@ GEM
|
|
|
248
248
|
verbose (0.1.0)
|
|
249
249
|
loog (~> 0.2)
|
|
250
250
|
tago (~> 0.0)
|
|
251
|
-
webmock (3.
|
|
251
|
+
webmock (3.26.0)
|
|
252
252
|
addressable (>= 2.8.0)
|
|
253
253
|
crack (>= 0.3.2)
|
|
254
254
|
hashdiff (>= 0.4.0, < 2.0.0)
|
data/lib/fbe/github_graph.rb
CHANGED
|
@@ -95,16 +95,32 @@ class Fbe::Graph
|
|
|
95
95
|
# @param [String] owner The repository owner (username or organization)
|
|
96
96
|
# @param [String] name The repository name
|
|
97
97
|
# @param [String] branch The branch name (e.g., "master" or "main")
|
|
98
|
-
# @
|
|
98
|
+
# @param [Array<Array<String, String, String>> repos List of owner, name, branch
|
|
99
|
+
# @return [Integer, Array<Hash>] The total number of commits in the branch or array with hash
|
|
99
100
|
# @example
|
|
100
101
|
# graph = Fbe::Graph.new(token: 'github_token')
|
|
101
102
|
# count = graph.total_commits('octocat', 'Hello-World', 'main')
|
|
102
103
|
# puts count #=> 42
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
# @example
|
|
105
|
+
# result = Fbe.github_graph.total_commits(
|
|
106
|
+
# repos: [
|
|
107
|
+
# ['zerocracy', 'fbe', 'master'],
|
|
108
|
+
# ['zerocracy', 'judges-action', 'master']
|
|
109
|
+
# ]
|
|
110
|
+
# )
|
|
111
|
+
# puts result #=>
|
|
112
|
+
# [{"owner"=>"zerocracy", "name"=>"fbe", "branch"=>"master", "total_commits"=>754},
|
|
113
|
+
# {"owner"=>"zerocracy", "name"=>"judges-action", "branch"=>"master", "total_commits"=>2251}]
|
|
114
|
+
def total_commits(owner = nil, name = nil, branch = nil, repos: nil)
|
|
115
|
+
raise 'Need owner, name and branch or repos' if owner.nil? && name.nil? && branch.nil? && repos.nil?
|
|
116
|
+
raise 'Owner, name and branch is required' if (owner.nil? || name.nil? || branch.nil?) && repos.nil?
|
|
117
|
+
raise 'Repos list cannot be empty' if owner.nil? && name.nil? && branch.nil? && repos&.empty?
|
|
118
|
+
raise 'Need only owner, name and branch or repos' if (!owner.nil? || !name.nil? || !branch.nil?) && !repos.nil?
|
|
119
|
+
repos ||= [[owner, name, branch]]
|
|
120
|
+
requests =
|
|
121
|
+
repos.each_with_index.map do |(owner, name, branch), i|
|
|
122
|
+
<<~GRAPHQL
|
|
123
|
+
repo_#{i}: repository(owner: "#{owner}", name: "#{name}") {
|
|
108
124
|
ref(qualifiedName: "#{branch}") {
|
|
109
125
|
target {
|
|
110
126
|
... on Commit {
|
|
@@ -115,10 +131,25 @@ class Fbe::Graph
|
|
|
115
131
|
}
|
|
116
132
|
}
|
|
117
133
|
}
|
|
134
|
+
GRAPHQL
|
|
135
|
+
end
|
|
136
|
+
result = query("{\n#{requests.join("\n")}\n}")
|
|
137
|
+
if owner && name && branch
|
|
138
|
+
ref = result.repo_0&.ref
|
|
139
|
+
raise "Repository '#{owner}/#{name}' or branch '#{branch}' not found" unless ref&.target&.history
|
|
140
|
+
ref.target.history.total_count
|
|
141
|
+
else
|
|
142
|
+
repos.each_with_index.map do |(owner, name, branch), i|
|
|
143
|
+
ref = result.send(:"repo_#{i}")&.ref
|
|
144
|
+
raise "Repository '#{owner}/#{name}' or branch '#{branch}' not found" unless ref&.target&.history
|
|
145
|
+
{
|
|
146
|
+
'owner' => owner,
|
|
147
|
+
'name' => name,
|
|
148
|
+
'branch' => branch,
|
|
149
|
+
'total_commits' => ref.target.history.total_count
|
|
118
150
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
result.repository.ref.target.history.total_count
|
|
151
|
+
end
|
|
152
|
+
end
|
|
122
153
|
end
|
|
123
154
|
|
|
124
155
|
# Gets the total number of issues and pull requests in a repository.
|
|
@@ -451,12 +482,28 @@ class Fbe::Graph
|
|
|
451
482
|
|
|
452
483
|
# Returns mock total commit count.
|
|
453
484
|
#
|
|
454
|
-
# @param [String]
|
|
455
|
-
# @param [String]
|
|
456
|
-
# @param [String]
|
|
457
|
-
# @
|
|
458
|
-
|
|
459
|
-
|
|
485
|
+
# @param [String] owner Repository owner
|
|
486
|
+
# @param [String] name Repository name
|
|
487
|
+
# @param [String] branch Branch name
|
|
488
|
+
# @param [Array<Array<String, String, String>> repos List of owner, name, branch
|
|
489
|
+
# @return [Integer, Array<Hash>] Returns 1484 for single repo or array of hashes
|
|
490
|
+
def total_commits(owner = nil, name = nil, branch = nil, repos: nil)
|
|
491
|
+
raise 'Need owner, name and branch or repos' if owner.nil? && name.nil? && branch.nil? && repos.nil?
|
|
492
|
+
raise 'Owner, name and branch is required' if (owner.nil? || name.nil? || branch.nil?) && repos.nil?
|
|
493
|
+
raise 'Repos list cannot be empty' if owner.nil? && name.nil? && branch.nil? && repos&.empty?
|
|
494
|
+
raise 'Need only owner, name and branch or repos' if (!owner.nil? || !name.nil? || !branch.nil?) && !repos.nil?
|
|
495
|
+
if owner && name && branch
|
|
496
|
+
1484
|
|
497
|
+
else
|
|
498
|
+
repos.each_with_index.map do |(owner, name, branch), _i|
|
|
499
|
+
{
|
|
500
|
+
'owner' => owner,
|
|
501
|
+
'name' => name,
|
|
502
|
+
'branch' => branch,
|
|
503
|
+
'total_commits' => 1484
|
|
504
|
+
}
|
|
505
|
+
end
|
|
506
|
+
end
|
|
460
507
|
end
|
|
461
508
|
|
|
462
509
|
# Returns mock issue type event data.
|
data/lib/fbe/iterate.rb
CHANGED
|
@@ -330,7 +330,9 @@ class Fbe::Iterate
|
|
|
330
330
|
rescue Fbe::OffQuota => e
|
|
331
331
|
@loog.info(e.message)
|
|
332
332
|
ensure
|
|
333
|
-
if defined?(repos) &&
|
|
333
|
+
if defined?(repos) && !repos.nil? &&
|
|
334
|
+
defined?(before) && !before.nil? &&
|
|
335
|
+
defined?(starts) && !starts.nil?
|
|
334
336
|
repos.each do |repo|
|
|
335
337
|
next if before[repo] == starts[repo]
|
|
336
338
|
f =
|
data/lib/fbe/octo.rb
CHANGED
|
@@ -1318,43 +1318,60 @@ class Fbe::FakeOctokit
|
|
|
1318
1318
|
]
|
|
1319
1319
|
end
|
|
1320
1320
|
|
|
1321
|
-
def issue_events(_repo,
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1321
|
+
def issue_events(_repo, number)
|
|
1322
|
+
if number == 120
|
|
1323
|
+
[
|
|
1324
|
+
{
|
|
1325
|
+
id: 1010, actor: { login: 'user2', id: 422, type: 'User' },
|
|
1326
|
+
event: 'assigned', created_at: Time.parse('2025-10-27 14:00:00 UTC'),
|
|
1327
|
+
assignee: { login: 'user2', id: 422, type: 'User' },
|
|
1328
|
+
assigner: { login: 'user', id: 411, type: 'User' }
|
|
1329
|
+
},
|
|
1330
|
+
{
|
|
1331
|
+
id: 1011, actor: { login: 'user2', id: 422, type: 'User' },
|
|
1332
|
+
event: 'unassigned', created_at: Time.parse('2025-10-27 15:00:00 UTC'),
|
|
1333
|
+
assignee: { login: 'user2', id: 422, type: 'User' },
|
|
1334
|
+
assigner: { login: 'user', id: 411, type: 'User' }
|
|
1335
|
+
}
|
|
1336
|
+
]
|
|
1337
|
+
else
|
|
1338
|
+
[
|
|
1339
|
+
{
|
|
1340
|
+
id: 126, actor: { login: 'user', id: 411, type: 'User' },
|
|
1341
|
+
event: 'labeled', created_at: Time.parse('2025-05-30 14:41:00 UTC'),
|
|
1342
|
+
label: { name: 'bug', color: 'd73a4a' }
|
|
1343
|
+
},
|
|
1344
|
+
{
|
|
1345
|
+
id: 206, actor: { login: 'user', id: 411, type: 'User' },
|
|
1346
|
+
event: 'mentioned', created_at: Time.parse('2025-05-30 14:41:10 UTC')
|
|
1347
|
+
},
|
|
1348
|
+
{
|
|
1349
|
+
id: 339, actor: { login: 'user2', id: 422, type: 'User' },
|
|
1350
|
+
event: 'subscribed', created_at: Time.parse('2025-05-30 14:41:10 UTC')
|
|
1351
|
+
},
|
|
1352
|
+
{
|
|
1353
|
+
id: 490, actor: { login: 'github-actions[bot]', id: 41_898_282, type: 'Bot' },
|
|
1354
|
+
event: 'renamed', created_at: Time.parse('2025-05-30 14:41:30 UTC'),
|
|
1355
|
+
rename: { from: 'some title', to: 'some title 2' }
|
|
1356
|
+
},
|
|
1357
|
+
{
|
|
1358
|
+
id: 505, actor: { login: 'user', id: 411, type: 'User' },
|
|
1359
|
+
event: 'subscribed', created_at: Time.parse('2025-05-30 16:18:24 UTC')
|
|
1360
|
+
},
|
|
1361
|
+
{
|
|
1362
|
+
id: 608, actor: { login: 'user2', id: 422, type: 'User', test: 123 },
|
|
1363
|
+
event: 'assigned', created_at: Time.parse('2025-05-30 17:59:08 UTC'),
|
|
1364
|
+
assignee: { login: 'user2', id: 422, type: 'User' },
|
|
1365
|
+
assigner: { login: 'user', id: 411, type: 'User' }
|
|
1366
|
+
},
|
|
1367
|
+
{
|
|
1368
|
+
id: 776, actor: { login: 'user2', id: 422, type: 'User' },
|
|
1369
|
+
event: 'referenced', commit_id: '4621af032170f43d',
|
|
1370
|
+
commit_url: 'https://api.github.com/repos/foo/foo/commits/4621af032170f43d',
|
|
1371
|
+
created_at: Time.parse('2025-05-30 19:57:50 UTC')
|
|
1372
|
+
}
|
|
1373
|
+
]
|
|
1374
|
+
end
|
|
1358
1375
|
end
|
|
1359
1376
|
|
|
1360
1377
|
def pull_request_comments(_name, _number)
|
data/lib/fbe.rb
CHANGED