fbe 0.0.15 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c5ea827d19e33c1c0ad518ddbb0d72d258e3dadddbff602160239f24484404e7
4
- data.tar.gz: 120705aa037a3b913df3e2bf71345866d1116c613289ae18bad45a00e4cd12c2
3
+ metadata.gz: ddac42d9e960528306d9483a9842027c71058304277d762b8e60521b55fd7e4b
4
+ data.tar.gz: 2acdb6268a759212fbff0f3164d34f948f5a256a6e9be911a8140dca3859c192
5
5
  SHA512:
6
- metadata.gz: e67f7173ede47f85219145b238557ee902a9c9bad68eb3282fb6ca6b05988cda85c12c645204f1687637edd48aea575e579e6ca07977f731bb62319e1b2f992c
7
- data.tar.gz: da98195d8f36a36625da70cf38a0f5342d62e09da6ee40fef291e22ccf02f29487462bdda5e212aaa6fd4855ca6ddde1ea1abf9bee84ab3693a839013f844824
6
+ metadata.gz: d237fc6509e2fddb2d9ae9d89982f05228692b0ad9ddb185a3ff89033ce855e7e61c18c30b8e7e376cfaa2efc8a56bab3e6dcb9de13c5808c6235963c1bfe147
7
+ data.tar.gz: d3fc27efd402af4424f5fc472803569635bd0ca21cdf586dacd471ae64fad11132e94654efab4c07499049172e8ad99863c86c6589283eeb0cde9021f57846b7
data/Gemfile CHANGED
@@ -24,7 +24,7 @@ source 'https://rubygems.org'
24
24
  gemspec
25
25
 
26
26
  gem 'minitest', '5.24.1', require: false
27
- gem 'minitest-reporters', '1.6.1', require: false
27
+ gem 'minitest-reporters', '1.7.1', require: false
28
28
  gem 'rake', '13.2.1', require: false
29
29
  gem 'rspec-rails', '6.1.3', require: false
30
30
  gem 'rubocop', '1.65.0', require: false
data/Gemfile.lock CHANGED
@@ -116,7 +116,7 @@ GEM
116
116
  nokogiri (>= 1.12.0)
117
117
  loog (0.5.2)
118
118
  minitest (5.24.1)
119
- minitest-reporters (1.6.1)
119
+ minitest-reporters (1.7.1)
120
120
  ansi
121
121
  builder
122
122
  minitest (>= 5.0)
@@ -255,7 +255,7 @@ PLATFORMS
255
255
  DEPENDENCIES
256
256
  fbe!
257
257
  minitest (= 5.24.1)
258
- minitest-reporters (= 1.6.1)
258
+ minitest-reporters (= 1.7.1)
259
259
  rake (= 13.2.1)
260
260
  rspec-rails (= 6.1.3)
261
261
  rubocop (= 1.65.0)
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/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
@@ -27,5 +27,5 @@
27
27
  # License:: MIT
28
28
  module Fbe
29
29
  # Current version of the gem (changed by .rultor.yml on every release)
30
- VERSION = '0.0.15'
30
+ VERSION = '0.0.16'
31
31
  end
@@ -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
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.0.15
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
@@ -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