fbe 0.0.14 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -2
- data/Gemfile.lock +20 -13
- data/fbe.gemspec +13 -13
- data/lib/fbe/fb.rb +2 -2
- data/lib/fbe/issue.rb +29 -0
- data/lib/fbe/iterate.rb +4 -5
- data/lib/fbe/octo.rb +1 -1
- data/lib/fbe/sec.rb +38 -0
- data/lib/fbe/who.rb +29 -0
- data/lib/fbe.rb +1 -1
- data/test/fbe/test_conclude.rb +18 -1
- data/test/fbe/test_fb.rb +2 -0
- data/test/fbe/test_issue.rb +43 -0
- data/test/fbe/test_sec.rb +39 -0
- data/test/fbe/test_who.rb +42 -0
- data/test/test__helper.rb +3 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ddac42d9e960528306d9483a9842027c71058304277d762b8e60521b55fd7e4b
|
4
|
+
data.tar.gz: 2acdb6268a759212fbff0f3164d34f948f5a256a6e9be911a8140dca3859c192
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d237fc6509e2fddb2d9ae9d89982f05228692b0ad9ddb185a3ff89033ce855e7e61c18c30b8e7e376cfaa2efc8a56bab3e6dcb9de13c5808c6235963c1bfe147
|
7
|
+
data.tar.gz: d3fc27efd402af4424f5fc472803569635bd0ca21cdf586dacd471ae64fad11132e94654efab4c07499049172e8ad99863c86c6589283eeb0cde9021f57846b7
|
data/Gemfile
CHANGED
@@ -24,11 +24,12 @@ source 'https://rubygems.org'
|
|
24
24
|
gemspec
|
25
25
|
|
26
26
|
gem 'minitest', '5.24.1', require: false
|
27
|
+
gem 'minitest-reporters', '1.7.1', require: false
|
27
28
|
gem 'rake', '13.2.1', require: false
|
28
29
|
gem 'rspec-rails', '6.1.3', require: false
|
29
|
-
gem 'rubocop', '1.
|
30
|
+
gem 'rubocop', '1.65.0', require: false
|
30
31
|
gem 'rubocop-performance', '1.21.1', require: false
|
31
|
-
gem 'rubocop-rspec', '3.0.
|
32
|
+
gem 'rubocop-rspec', '3.0.3', require: false
|
32
33
|
gem 'simplecov', '0.22.0', require: false
|
33
34
|
gem 'simplecov-cobertura', '2.1.0', require: false
|
34
35
|
gem 'yard', '0.9.36', require: false
|
data/Gemfile.lock
CHANGED
@@ -47,6 +47,7 @@ GEM
|
|
47
47
|
tzinfo (~> 2.0)
|
48
48
|
addressable (2.8.7)
|
49
49
|
public_suffix (>= 2.0.2, < 7.0)
|
50
|
+
ansi (1.5.0)
|
50
51
|
ast (2.4.2)
|
51
52
|
backtrace (0.4.0)
|
52
53
|
base64 (0.2.0)
|
@@ -95,18 +96,18 @@ GEM
|
|
95
96
|
reline (>= 0.4.2)
|
96
97
|
iri (0.8.0)
|
97
98
|
json (2.7.2)
|
98
|
-
judges (0.
|
99
|
-
backtrace (~> 0
|
99
|
+
judges (0.17.0)
|
100
|
+
backtrace (~> 0)
|
100
101
|
concurrent-ruby (~> 1.2)
|
101
|
-
factbase (~> 0
|
102
|
+
factbase (~> 0)
|
102
103
|
gli (~> 2.21)
|
103
|
-
iri (~> 0
|
104
|
-
loog (~> 0
|
104
|
+
iri (~> 0)
|
105
|
+
loog (~> 0)
|
105
106
|
moments (~> 0.3)
|
106
107
|
nokogiri (~> 1.10)
|
107
|
-
others (~> 0
|
108
|
-
retries (~> 0
|
109
|
-
tago (~> 0
|
108
|
+
others (~> 0)
|
109
|
+
retries (~> 0)
|
110
|
+
tago (~> 0)
|
110
111
|
typhoeus (~> 1.3)
|
111
112
|
language_server-protocol (3.17.0.3)
|
112
113
|
logger (1.6.0)
|
@@ -115,6 +116,11 @@ GEM
|
|
115
116
|
nokogiri (>= 1.12.0)
|
116
117
|
loog (0.5.2)
|
117
118
|
minitest (5.24.1)
|
119
|
+
minitest-reporters (1.7.1)
|
120
|
+
ansi
|
121
|
+
builder
|
122
|
+
minitest (>= 5.0)
|
123
|
+
ruby-progressbar
|
118
124
|
moments (0.3.0)
|
119
125
|
multipart-post (2.4.1)
|
120
126
|
mutex_m (0.2.0)
|
@@ -191,13 +197,13 @@ GEM
|
|
191
197
|
rspec-mocks (~> 3.13)
|
192
198
|
rspec-support (~> 3.13)
|
193
199
|
rspec-support (3.13.1)
|
194
|
-
rubocop (1.
|
200
|
+
rubocop (1.65.0)
|
195
201
|
json (~> 2.3)
|
196
202
|
language_server-protocol (>= 3.17.0)
|
197
203
|
parallel (~> 1.10)
|
198
204
|
parser (>= 3.3.0.2)
|
199
205
|
rainbow (>= 2.2.2, < 4.0)
|
200
|
-
regexp_parser (>=
|
206
|
+
regexp_parser (>= 2.4, < 3.0)
|
201
207
|
rexml (>= 3.2.5, < 4.0)
|
202
208
|
rubocop-ast (>= 1.31.1, < 2.0)
|
203
209
|
ruby-progressbar (~> 1.7)
|
@@ -207,7 +213,7 @@ GEM
|
|
207
213
|
rubocop-performance (1.21.1)
|
208
214
|
rubocop (>= 1.48.1, < 2.0)
|
209
215
|
rubocop-ast (>= 1.31.1, < 2.0)
|
210
|
-
rubocop-rspec (3.0.
|
216
|
+
rubocop-rspec (3.0.3)
|
211
217
|
rubocop (~> 1.61)
|
212
218
|
ruby-progressbar (1.13.0)
|
213
219
|
sawyer (0.9.2)
|
@@ -249,11 +255,12 @@ PLATFORMS
|
|
249
255
|
DEPENDENCIES
|
250
256
|
fbe!
|
251
257
|
minitest (= 5.24.1)
|
258
|
+
minitest-reporters (= 1.7.1)
|
252
259
|
rake (= 13.2.1)
|
253
260
|
rspec-rails (= 6.1.3)
|
254
|
-
rubocop (= 1.
|
261
|
+
rubocop (= 1.65.0)
|
255
262
|
rubocop-performance (= 1.21.1)
|
256
|
-
rubocop-rspec (= 3.0.
|
263
|
+
rubocop-rspec (= 3.0.3)
|
257
264
|
simplecov (= 0.22.0)
|
258
265
|
simplecov-cobertura (= 2.1.0)
|
259
266
|
yard (= 0.9.36)
|
data/fbe.gemspec
CHANGED
@@ -39,18 +39,18 @@ Gem::Specification.new do |s|
|
|
39
39
|
s.files = `git ls-files`.split($RS)
|
40
40
|
s.rdoc_options = ['--charset=UTF-8']
|
41
41
|
s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
|
42
|
-
s.
|
43
|
-
s.
|
44
|
-
s.
|
45
|
-
s.
|
46
|
-
s.
|
47
|
-
s.
|
48
|
-
s.
|
49
|
-
s.
|
50
|
-
s.
|
51
|
-
s.
|
52
|
-
s.
|
53
|
-
s.
|
54
|
-
s.
|
42
|
+
s.add_dependency 'backtrace'
|
43
|
+
s.add_dependency 'decoor'
|
44
|
+
s.add_dependency 'factbase'
|
45
|
+
s.add_dependency 'faraday'
|
46
|
+
s.add_dependency 'faraday-http-cache'
|
47
|
+
s.add_dependency 'faraday-multipart'
|
48
|
+
s.add_dependency 'faraday-retry'
|
49
|
+
s.add_dependency 'judges'
|
50
|
+
s.add_dependency 'loog'
|
51
|
+
s.add_dependency 'obk'
|
52
|
+
s.add_dependency 'octokit'
|
53
|
+
s.add_dependency 'others'
|
54
|
+
s.add_dependency 'verbose'
|
55
55
|
s.metadata['rubygems_mfa_required'] = 'true'
|
56
56
|
end
|
data/lib/fbe/fb.rb
CHANGED
@@ -30,7 +30,7 @@ require 'factbase/pre'
|
|
30
30
|
require 'factbase/rules'
|
31
31
|
require_relative '../fbe'
|
32
32
|
|
33
|
-
def Fbe.fb(fb: $fb, global: $global, options: $options)
|
33
|
+
def Fbe.fb(fb: $fb, global: $global, options: $options, loog: $loog)
|
34
34
|
global[:fb] ||= begin
|
35
35
|
rules = Dir.glob(File.join('rules', '*.fe')).map { |f| File.read(f) }
|
36
36
|
fbe = Factbase::Rules.new(
|
@@ -44,6 +44,6 @@ def Fbe.fb(fb: $fb, global: $global, options: $options)
|
|
44
44
|
f._time = Time.now
|
45
45
|
f._version = "#{Factbase::VERSION}/#{Judges::VERSION}/#{options.judges_action_version}"
|
46
46
|
end
|
47
|
-
Factbase::Looged.new(fbe,
|
47
|
+
Factbase::Looged.new(fbe, loog)
|
48
48
|
end
|
49
49
|
end
|
data/lib/fbe/issue.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# MIT License
|
4
|
+
#
|
5
|
+
# Copyright (c) 2024 Zerocracy
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
15
|
+
# copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
# SOFTWARE.
|
24
|
+
|
25
|
+
require_relative '../fbe'
|
26
|
+
|
27
|
+
def Fbe.issue(fact, options: $options, global: $global, loog: $loog)
|
28
|
+
"#{Fbe.octo(global:, options:, loog:).repo_name_by_id(fact.repository)}##{fact.issue}"
|
29
|
+
end
|
data/lib/fbe/iterate.rb
CHANGED
@@ -84,7 +84,6 @@ class Fbe::Iterate
|
|
84
84
|
oct = Fbe.octo(loog: @loog, options: @options, global: @global)
|
85
85
|
repos = Fbe.unmask_repos(loog: @loog, options: @options, global: @global)
|
86
86
|
restarted = []
|
87
|
-
fb = Fbe.fb(fb: @fb, global: @global, options: @options)
|
88
87
|
loop do
|
89
88
|
repos.each do |repo|
|
90
89
|
next if restarted.include?(repo)
|
@@ -94,12 +93,12 @@ class Fbe::Iterate
|
|
94
93
|
next
|
95
94
|
end
|
96
95
|
rid = oct.repo_id_by_name(repo)
|
97
|
-
before = fb.query(
|
96
|
+
before = @fb.query(
|
98
97
|
"(agg (and (eq what '#{@label}') (eq where 'github') (eq repository #{rid})) (first latest))"
|
99
98
|
).one
|
100
|
-
fb.query("(and (eq what '#{@label}') (eq where 'github') (eq repository #{rid}))").delete!
|
99
|
+
@fb.query("(and (eq what '#{@label}') (eq where 'github') (eq repository #{rid}))").delete!
|
101
100
|
before = before.nil? ? @since : before.first
|
102
|
-
nxt = fb.query(@query).one(before:, repository: rid)
|
101
|
+
nxt = @fb.query(@query).one(before:, repository: rid)
|
103
102
|
after =
|
104
103
|
if nxt.nil?
|
105
104
|
@loog.debug("Next element after ##{before} not suggested, re-starting from ##{@since}: #{@query}")
|
@@ -110,7 +109,7 @@ class Fbe::Iterate
|
|
110
109
|
yield(rid, nxt)
|
111
110
|
end
|
112
111
|
raise "Iterator must return an Integer, while #{after.class} returned" unless after.is_a?(Integer)
|
113
|
-
f = fb.insert
|
112
|
+
f = @fb.insert
|
114
113
|
f.where = 'github'
|
115
114
|
f.repository = rid
|
116
115
|
f.latest =
|
data/lib/fbe/octo.rb
CHANGED
@@ -31,7 +31,7 @@ require 'faraday/http_cache'
|
|
31
31
|
require 'faraday/retry'
|
32
32
|
require_relative '../fbe'
|
33
33
|
|
34
|
-
def Fbe.octo(options: $options, global: $global, loog:
|
34
|
+
def Fbe.octo(options: $options, global: $global, loog: $loog)
|
35
35
|
raise 'The $global is not set' if global.nil?
|
36
36
|
global[:octo] ||= begin
|
37
37
|
if options.testing.nil?
|
data/lib/fbe/sec.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# MIT License
|
4
|
+
#
|
5
|
+
# Copyright (c) 2024 Zerocracy
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
15
|
+
# copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
# SOFTWARE.
|
24
|
+
|
25
|
+
require_relative '../fbe'
|
26
|
+
|
27
|
+
def Fbe.sec(fact, prop = :seconds)
|
28
|
+
s = fact.send(prop.to_s)
|
29
|
+
if s < 60
|
30
|
+
format('%d seconds', s)
|
31
|
+
elsif s < 60 * 60
|
32
|
+
format('%d minutes', s / 60)
|
33
|
+
elsif s < 60 * 60 * 24
|
34
|
+
format('%d hours', s / (60 * 60))
|
35
|
+
else
|
36
|
+
format('%d days', s / (60 * 60 * 24))
|
37
|
+
end
|
38
|
+
end
|
data/lib/fbe/who.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# MIT License
|
4
|
+
#
|
5
|
+
# Copyright (c) 2024 Zerocracy
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
15
|
+
# copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
# SOFTWARE.
|
24
|
+
|
25
|
+
require_relative '../fbe'
|
26
|
+
|
27
|
+
def Fbe.who(fact, prop = :who, options: $options, global: $global, loog: $loog)
|
28
|
+
"@#{Fbe.octo(options:, global:, loog:).user_name_by_id(fact.send(prop.to_s))}"
|
29
|
+
end
|
data/lib/fbe.rb
CHANGED
data/test/fbe/test_conclude.rb
CHANGED
@@ -65,7 +65,7 @@ class TestConclude < Minitest::Test
|
|
65
65
|
|
66
66
|
def test_maybe
|
67
67
|
options = Judges::Options.new
|
68
|
-
fb = Fbe.fb(global: {}, options:)
|
68
|
+
fb = Fbe.fb(fb: Factbase.new, global: {}, options:, loog: Loog::NULL)
|
69
69
|
fb.insert.foo = 1
|
70
70
|
Fbe.conclude(fb:, judge: 'issue-was-opened', loog: Loog::NULL, options:, global: {}) do
|
71
71
|
on '(exists foo)'
|
@@ -96,4 +96,21 @@ class TestConclude < Minitest::Test
|
|
96
96
|
f = fb.query('(exists bar)').each.to_a[0]
|
97
97
|
assert_equal(42, f.bar)
|
98
98
|
end
|
99
|
+
|
100
|
+
def test_ignores_globals
|
101
|
+
$fb = nil
|
102
|
+
$loog = nil
|
103
|
+
$options = nil
|
104
|
+
$global = nil
|
105
|
+
fb = Factbase.new
|
106
|
+
fb.insert.foo = 1
|
107
|
+
Fbe.conclude(fb:, judge: 'judge-xxx', loog: Loog::NULL, global: {}, options: Judges::Options.new) do
|
108
|
+
on '(exists foo)'
|
109
|
+
draw do |n, prev|
|
110
|
+
n.sum = prev.foo + 1
|
111
|
+
'something funny'
|
112
|
+
end
|
113
|
+
end
|
114
|
+
assert_equal(2, fb.size)
|
115
|
+
end
|
99
116
|
end
|
data/test/fbe/test_fb.rb
CHANGED
@@ -24,6 +24,7 @@
|
|
24
24
|
|
25
25
|
require 'minitest/autorun'
|
26
26
|
require 'factbase'
|
27
|
+
require 'loog'
|
27
28
|
require 'judges/options'
|
28
29
|
require_relative '../../lib/fbe'
|
29
30
|
require_relative '../../lib/fbe/fb'
|
@@ -37,6 +38,7 @@ class TestFb < Minitest::Test
|
|
37
38
|
$fb = Factbase.new
|
38
39
|
$global = {}
|
39
40
|
$options = Judges::Options.new
|
41
|
+
$loog = Loog::NULL
|
40
42
|
Fbe.fb.insert.foo = 1
|
41
43
|
Fbe.fb.insert.bar = 2
|
42
44
|
assert_equal(1, Fbe.fb.query('(exists bar)').each.to_a.size)
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# MIT License
|
4
|
+
#
|
5
|
+
# Copyright (c) 2024 Zerocracy
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
15
|
+
# copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
# SOFTWARE.
|
24
|
+
|
25
|
+
require 'minitest/autorun'
|
26
|
+
require 'loog'
|
27
|
+
require_relative '../../lib/fbe/issue'
|
28
|
+
|
29
|
+
# Test.
|
30
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
31
|
+
# Copyright:: Copyright (c) 2024 Zerocracy
|
32
|
+
# License:: MIT
|
33
|
+
class TestIssue < Minitest::Test
|
34
|
+
def test_simple
|
35
|
+
fb = Factbase.new
|
36
|
+
f = fb.insert
|
37
|
+
f.repository = 323
|
38
|
+
f.issue = 333
|
39
|
+
global = {}
|
40
|
+
options = Judges::Options.new({ 'testing' => true })
|
41
|
+
assert_equal('yegor256/test#333', Fbe.issue(f, global:, options:, loog: Loog::NULL))
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# MIT License
|
4
|
+
#
|
5
|
+
# Copyright (c) 2024 Zerocracy
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
15
|
+
# copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
# SOFTWARE.
|
24
|
+
|
25
|
+
require 'minitest/autorun'
|
26
|
+
require_relative '../../lib/fbe/sec'
|
27
|
+
|
28
|
+
# Test.
|
29
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
30
|
+
# Copyright:: Copyright (c) 2024 Zerocracy
|
31
|
+
# License:: MIT
|
32
|
+
class TestSec < Minitest::Test
|
33
|
+
def test_simple
|
34
|
+
fb = Factbase.new
|
35
|
+
f = fb.insert
|
36
|
+
f.seconds = 333
|
37
|
+
assert_equal('5 minutes', Fbe.sec(f))
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# MIT License
|
4
|
+
#
|
5
|
+
# Copyright (c) 2024 Zerocracy
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
15
|
+
# copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
# SOFTWARE.
|
24
|
+
|
25
|
+
require 'minitest/autorun'
|
26
|
+
require 'loog'
|
27
|
+
require_relative '../../lib/fbe/who'
|
28
|
+
|
29
|
+
# Test.
|
30
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
31
|
+
# Copyright:: Copyright (c) 2024 Zerocracy
|
32
|
+
# License:: MIT
|
33
|
+
class TestWho < Minitest::Test
|
34
|
+
def test_simple
|
35
|
+
fb = Factbase.new
|
36
|
+
f = fb.insert
|
37
|
+
f.who = 444
|
38
|
+
global = {}
|
39
|
+
options = Judges::Options.new({ 'testing' => true })
|
40
|
+
assert_equal('@yegor256', Fbe.who(f, global:, options:, loog: Loog::NULL))
|
41
|
+
end
|
42
|
+
end
|
data/test/test__helper.rb
CHANGED
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.16
|
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-07-
|
11
|
+
date: 2024-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: backtrace
|
@@ -227,17 +227,23 @@ files:
|
|
227
227
|
- lib/fbe/conclude.rb
|
228
228
|
- lib/fbe/fb.rb
|
229
229
|
- lib/fbe/if_absent.rb
|
230
|
+
- lib/fbe/issue.rb
|
230
231
|
- lib/fbe/iterate.rb
|
231
232
|
- lib/fbe/octo.rb
|
233
|
+
- lib/fbe/sec.rb
|
232
234
|
- lib/fbe/unmask_repos.rb
|
235
|
+
- lib/fbe/who.rb
|
233
236
|
- renovate.json
|
234
237
|
- rules/basic.fe
|
235
238
|
- test/fbe/test_conclude.rb
|
236
239
|
- test/fbe/test_fb.rb
|
237
240
|
- test/fbe/test_if_absent.rb
|
241
|
+
- test/fbe/test_issue.rb
|
238
242
|
- test/fbe/test_iterate.rb
|
239
243
|
- test/fbe/test_octo.rb
|
244
|
+
- test/fbe/test_sec.rb
|
240
245
|
- test/fbe/test_unmask_repos.rb
|
246
|
+
- test/fbe/test_who.rb
|
241
247
|
- test/test__helper.rb
|
242
248
|
- test/test_fbe.rb
|
243
249
|
homepage: http://github.com/zerocracy/fbe
|