fbe 0.0.36 → 0.0.37
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +2 -2
- data/lib/fbe/octo.rb +19 -1
- data/lib/fbe/unmask_repos.rb +3 -1
- data/lib/fbe.rb +1 -1
- data/test/fbe/test_award.rb +12 -0
- data/test/fbe/test_octo.rb +6 -0
- data/test/fbe/test_unmask_repos.rb +7 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 412a42887c949db37c75084feeed5b3c187284a34491d3412da0abdf812dfbca
|
4
|
+
data.tar.gz: 3b16ac60cbad4ab99ba3c141be9e1b347db16c884826d307341bddd4eea164b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bedce35fba41f38cd0605a2fb5ad32497e00f4a95db0a130c15c1d8d886955d797024410b1d96844470792fe0731db6ae97d332ce472ffd4db39cfb710483a8
|
7
|
+
data.tar.gz: f43d741abf35225cc9d4708ef255fc7abf56f5288560b1b7e56e876e84781bfeacde5a8c5a5ca20240a8b8fd6be49045a1bf14e206ccf881cae5142e648c7592
|
data/Gemfile
CHANGED
@@ -29,7 +29,7 @@ gem 'rake', '13.2.1', require: false
|
|
29
29
|
gem 'rspec-rails', '6.1.3', require: false
|
30
30
|
gem 'rubocop', '1.65.1', require: false
|
31
31
|
gem 'rubocop-performance', '1.21.1', require: false
|
32
|
-
gem 'rubocop-rspec', '3.0.
|
32
|
+
gem 'rubocop-rspec', '3.0.4', require: false
|
33
33
|
gem 'simplecov', '0.22.0', require: false
|
34
34
|
gem 'simplecov-cobertura', '2.1.0', require: false
|
35
35
|
gem 'webmock', '3.23.1', require: false
|
data/Gemfile.lock
CHANGED
@@ -217,7 +217,7 @@ GEM
|
|
217
217
|
rubocop-performance (1.21.1)
|
218
218
|
rubocop (>= 1.48.1, < 2.0)
|
219
219
|
rubocop-ast (>= 1.31.1, < 2.0)
|
220
|
-
rubocop-rspec (3.0.
|
220
|
+
rubocop-rspec (3.0.4)
|
221
221
|
rubocop (~> 1.61)
|
222
222
|
ruby-progressbar (1.13.0)
|
223
223
|
sawyer (0.9.2)
|
@@ -269,7 +269,7 @@ DEPENDENCIES
|
|
269
269
|
rspec-rails (= 6.1.3)
|
270
270
|
rubocop (= 1.65.1)
|
271
271
|
rubocop-performance (= 1.21.1)
|
272
|
-
rubocop-rspec (= 3.0.
|
272
|
+
rubocop-rspec (= 3.0.4)
|
273
273
|
simplecov (= 0.22.0)
|
274
274
|
simplecov-cobertura (= 2.1.0)
|
275
275
|
webmock (= 3.23.1)
|
data/lib/fbe/octo.rb
CHANGED
@@ -191,6 +191,24 @@ class Fbe::FakeOctokit
|
|
191
191
|
}
|
192
192
|
end
|
193
193
|
|
194
|
+
def workflow_run_usage(_repo, _id)
|
195
|
+
{
|
196
|
+
billable: {
|
197
|
+
UBUNTU: {
|
198
|
+
total_ms: 0,
|
199
|
+
jobs: 1,
|
200
|
+
job_runs: [
|
201
|
+
{
|
202
|
+
job_id: 1,
|
203
|
+
duration_ms: 0
|
204
|
+
}
|
205
|
+
]
|
206
|
+
}
|
207
|
+
},
|
208
|
+
run_duration_ms: 53_000
|
209
|
+
}
|
210
|
+
end
|
211
|
+
|
194
212
|
def releases(_repo, _opts = {})
|
195
213
|
[
|
196
214
|
release('https://github...'),
|
@@ -237,7 +255,7 @@ class Fbe::FakeOctokit
|
|
237
255
|
has_pages: false,
|
238
256
|
has_discussions: false,
|
239
257
|
forks_count: 0,
|
240
|
-
archived:
|
258
|
+
archived: name == 'zerocracy/datum',
|
241
259
|
disabled: false,
|
242
260
|
open_issues_count: 6,
|
243
261
|
license: { key: 'mit', name: 'MIT License' },
|
data/lib/fbe/unmask_repos.rb
CHANGED
@@ -37,6 +37,7 @@ module Fbe
|
|
37
37
|
|
38
38
|
def self.unmask_repos(options: $options, global: $global, loog: $loog)
|
39
39
|
repos = []
|
40
|
+
octo = Fbe.octo(loog:, global:, options:)
|
40
41
|
masks = (options.repositories || '').split(',')
|
41
42
|
masks.reject { |m| m.start_with?('-') }.each do |mask|
|
42
43
|
unless mask.include?('*')
|
@@ -44,7 +45,7 @@ module Fbe
|
|
44
45
|
next
|
45
46
|
end
|
46
47
|
re = Fbe.mask_to_regex(mask)
|
47
|
-
|
48
|
+
octo.repositories(mask.split('/')[0]).each do |r|
|
48
49
|
repos << r[:full_name] if re.match?(r[:full_name])
|
49
50
|
end
|
50
51
|
end
|
@@ -52,6 +53,7 @@ module Fbe
|
|
52
53
|
re = Fbe.mask_to_regex(mask[1..])
|
53
54
|
repos.reject! { |r| re.match?(r) }
|
54
55
|
end
|
56
|
+
repos.reject! { |repo| octo.repository(repo)[:archived] }
|
55
57
|
raise "No repos found matching: #{options.repositories}" if repos.empty?
|
56
58
|
loog.debug("Scanning #{repos.size} repositories: #{repos.join(', ')}...")
|
57
59
|
repos
|
data/lib/fbe.rb
CHANGED
data/test/fbe/test_award.rb
CHANGED
@@ -81,6 +81,7 @@ class TestAward < Minitest::Test
|
|
81
81
|
def test_some_terms
|
82
82
|
{
|
83
83
|
'(let x 25)' => 0,
|
84
|
+
'(award (give (times 5 0.25 "fun")))' => 1,
|
84
85
|
'(award (give 25 "for being a good boy"))' => 25,
|
85
86
|
'(award (give (between 42 -10 -50) "empty"))' => -10,
|
86
87
|
'(award (give (between -3 -10 -50) "empty"))' => 0,
|
@@ -91,6 +92,17 @@ class TestAward < Minitest::Test
|
|
91
92
|
end
|
92
93
|
end
|
93
94
|
|
95
|
+
def test_some_greetings
|
96
|
+
{
|
97
|
+
'(award (give (times 5 0.25 "fun")))' => 'You\'ve earned +1 points. ',
|
98
|
+
'(award (give 25 "for being a good boy"))' => 'You\'ve earned +25 points. ',
|
99
|
+
'(award (let x 0.1) (set b (times x 14)) (give b "fun"))' => 'You\'ve earned +1 points. '
|
100
|
+
}.each do |q, v|
|
101
|
+
a = Fbe::Award.new(q)
|
102
|
+
assert_equal(v, a.bill.greeting, q)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
94
106
|
def test_must_not_give_anything_when_too_small_value
|
95
107
|
{
|
96
108
|
'(award (give (between 0 5 20)))' => 0,
|
data/test/fbe/test_octo.rb
CHANGED
@@ -110,6 +110,12 @@ class TestOcto < Minitest::Test
|
|
110
110
|
assert_raises { o.repository('zerocracy/fbe') }
|
111
111
|
end
|
112
112
|
|
113
|
+
def test_workflow_run_usage
|
114
|
+
WebMock.disable_net_connect!
|
115
|
+
o = Fbe.octo(loog: Loog::NULL, global: {}, options: Judges::Options.new({ 'testing' => true }))
|
116
|
+
assert_equal(53_000, o.workflow_run_usage('zerocracy/fbe', 1)[:run_duration_ms])
|
117
|
+
end
|
118
|
+
|
113
119
|
def test_commit_pulls
|
114
120
|
skip # it's a "live" test, run it manually if you need it
|
115
121
|
WebMock.enable_net_connect!
|
@@ -37,22 +37,25 @@ class TestUnmaskRepos < Minitest::Test
|
|
37
37
|
opts = Judges::Options.new(
|
38
38
|
{
|
39
39
|
'testing' => true,
|
40
|
-
'repositories' => 'yegor256/tacit,zerocracy/*,-zerocracy/judges-action'
|
40
|
+
'repositories' => 'yegor256/tacit,zerocracy/*,-zerocracy/judges-action,zerocracy/datum'
|
41
41
|
}
|
42
42
|
)
|
43
|
-
|
43
|
+
list = Fbe.unmask_repos(options: opts, global: {}, loog: Loog::NULL)
|
44
|
+
assert(list.size.positive?)
|
45
|
+
refute_includes(list, 'zerocracy/datum')
|
44
46
|
end
|
45
47
|
|
46
48
|
def test_live_usage
|
47
49
|
skip('Run it only manually, since it touches GitHub API')
|
48
|
-
Judges::Options.new(
|
50
|
+
opts = Judges::Options.new(
|
49
51
|
{
|
50
|
-
'repositories' => 'zerocracy/*,-zerocracy/judges-action'
|
52
|
+
'repositories' => 'zerocracy/*,-zerocracy/judges-action,zerocracy/datum'
|
51
53
|
}
|
52
54
|
)
|
53
55
|
list = Fbe.unmask_repos(options: opts, global: {}, loog: Loog::NULL)
|
54
56
|
assert(list.size.positive?)
|
55
57
|
assert(list.include?('zerocracy/pages-action'))
|
56
58
|
assert(!list.include?('zerocracy/judges-action'))
|
59
|
+
refute_includes(list, 'zerocracy/datum')
|
57
60
|
end
|
58
61
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fbe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.37
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: backtrace
|