fbe 0.0.37 → 0.0.39

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: 412a42887c949db37c75084feeed5b3c187284a34491d3412da0abdf812dfbca
4
- data.tar.gz: 3b16ac60cbad4ab99ba3c141be9e1b347db16c884826d307341bddd4eea164b5
3
+ metadata.gz: 32f31aad59acf471e8f0075c5ed1d0449a2039fb7d13cd3e0b4c3804b6ef1271
4
+ data.tar.gz: 65356a4c23c7a6630a0c0387a511cd0d367c72eb2609cb3ded007f9efacbf6e9
5
5
  SHA512:
6
- metadata.gz: 5bedce35fba41f38cd0605a2fb5ad32497e00f4a95db0a130c15c1d8d886955d797024410b1d96844470792fe0731db6ae97d332ce472ffd4db39cfb710483a8
7
- data.tar.gz: f43d741abf35225cc9d4708ef255fc7abf56f5288560b1b7e56e876e84781bfeacde5a8c5a5ca20240a8b8fd6be49045a1bf14e206ccf881cae5142e648c7592
6
+ metadata.gz: b50e3e2aaf0a16e640c8dc8068574fdb2dac380b767b00b2ae348c58a7ce0940b4db5dd85719aa263ee19ef5c2d402afef9a41cd31637f9a0e4418415a18ebc5
7
+ data.tar.gz: 732aedff1ade21b5db01cf591ad343889e234fd7e646d4012c399c9f053651fb220b5c9a746de63bff129efa37614d99c5ef9842fa688b4a7abda687d7c49d06
data/Gemfile.lock CHANGED
@@ -61,28 +61,28 @@ GEM
61
61
  crass (1.0.6)
62
62
  decoor (0.0.1)
63
63
  diff-lcs (1.5.1)
64
- docile (1.4.0)
64
+ docile (1.4.1)
65
65
  drb (2.2.1)
66
66
  erubi (1.13.0)
67
67
  ethon (0.16.0)
68
68
  ffi (>= 1.15.0)
69
- factbase (0.1.1)
70
- backtrace (~> 0.3)
71
- decoor (~> 0.0)
69
+ factbase (0.2.1)
70
+ backtrace (> 0)
71
+ decoor (> 0)
72
72
  json (~> 2.7)
73
- loog (~> 0.2)
73
+ loog (> 0)
74
74
  nokogiri (~> 1.10)
75
- others (~> 0.0)
76
- tago (~> 0.0)
75
+ others (> 0)
76
+ tago (> 0)
77
77
  yaml (~> 0.3)
78
- faraday (2.10.0)
78
+ faraday (2.10.1)
79
79
  faraday-net_http (>= 2.0, < 3.2)
80
80
  logger
81
81
  faraday-http-cache (2.5.1)
82
82
  faraday (>= 0.8)
83
83
  faraday-multipart (1.0.4)
84
84
  multipart-post (~> 2)
85
- faraday-net_http (3.1.0)
85
+ faraday-net_http (3.1.1)
86
86
  net-http
87
87
  faraday-retry (2.2.1)
88
88
  faraday (~> 2.0)
@@ -91,7 +91,7 @@ GEM
91
91
  ffi (1.17.0-x86_64-darwin)
92
92
  ffi (1.17.0-x86_64-linux-gnu)
93
93
  gli (2.21.5)
94
- hashdiff (1.1.0)
94
+ hashdiff (1.1.1)
95
95
  i18n (1.14.5)
96
96
  concurrent-ruby (~> 1.0)
97
97
  io-console (0.7.2)
@@ -100,7 +100,7 @@ GEM
100
100
  reline (>= 0.4.2)
101
101
  iri (0.8.0)
102
102
  json (2.7.2)
103
- judges (0.18.1)
103
+ judges (0.22.1)
104
104
  backtrace (~> 0)
105
105
  concurrent-ruby (~> 1.2)
106
106
  factbase (~> 0)
@@ -118,7 +118,7 @@ GEM
118
118
  loofah (2.22.0)
119
119
  crass (~> 1.0.2)
120
120
  nokogiri (>= 1.12.0)
121
- loog (0.5.2)
121
+ loog (0.6.0)
122
122
  minitest (5.24.1)
123
123
  minitest-reporters (1.7.1)
124
124
  ansi
@@ -130,13 +130,13 @@ GEM
130
130
  mutex_m (0.2.0)
131
131
  net-http (0.4.1)
132
132
  uri
133
- nokogiri (1.16.6-arm64-darwin)
133
+ nokogiri (1.16.7-arm64-darwin)
134
134
  racc (~> 1.4)
135
- nokogiri (1.16.6-x64-mingw-ucrt)
135
+ nokogiri (1.16.7-x64-mingw-ucrt)
136
136
  racc (~> 1.4)
137
- nokogiri (1.16.6-x86_64-darwin)
137
+ nokogiri (1.16.7-x86_64-darwin)
138
138
  racc (~> 1.4)
139
- nokogiri (1.16.6-x86_64-linux)
139
+ nokogiri (1.16.7-x86_64-linux)
140
140
  racc (~> 1.4)
141
141
  obk (0.3.1)
142
142
  octokit (9.1.0)
@@ -149,7 +149,7 @@ GEM
149
149
  racc
150
150
  psych (5.1.2)
151
151
  stringio
152
- public_suffix (6.0.0)
152
+ public_suffix (6.0.1)
153
153
  racc (1.8.1)
154
154
  rack (3.1.7)
155
155
  rack-session (2.0.0)
@@ -212,7 +212,7 @@ GEM
212
212
  rubocop-ast (>= 1.31.1, < 2.0)
213
213
  ruby-progressbar (~> 1.7)
214
214
  unicode-display_width (>= 2.4.0, < 3.0)
215
- rubocop-ast (1.31.3)
215
+ rubocop-ast (1.32.0)
216
216
  parser (>= 3.3.1.0)
217
217
  rubocop-performance (1.21.1)
218
218
  rubocop (>= 1.48.1, < 2.0)
@@ -252,7 +252,7 @@ GEM
252
252
  webrick (1.8.1)
253
253
  yaml (0.3.0)
254
254
  yard (0.9.36)
255
- zeitwerk (2.6.16)
255
+ zeitwerk (2.6.17)
256
256
 
257
257
  PLATFORMS
258
258
  arm64-darwin-22
@@ -0,0 +1,48 @@
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
+ require_relative 'fb'
27
+
28
+ def Fbe.regularly(area, p_every_days, p_since_days = nil, fb: Fbe.fb, judge: $judge, loog: $loog, &)
29
+ pmp = fb.query("(and (eq what 'pmp') (eq area '#{area}') (exists #{p_every_days}))").each.to_a.first
30
+ interval = pmp.nil? ? 7 : pmp[p_every_days].first
31
+ unless fb.query(
32
+ "(and
33
+ (eq what '#{judge}')
34
+ (gt when (minus (to_time (env 'TODAY' '#{Time.now.utc.iso8601}')) '#{interval} days')))"
35
+ ).each.to_a.empty?
36
+ loog.debug("#{$judge} statistics have recently been collected, skipping now")
37
+ return
38
+ end
39
+ f = fb.insert
40
+ f.what = judge
41
+ f.when = Time.now
42
+ unless p_since_days.nil?
43
+ days = pmp.nil? ? 28 : pmp[p_since_days].first
44
+ since = Time.now - (days * 24 * 60 * 60)
45
+ f.since = since
46
+ end
47
+ yield f
48
+ 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.37'
30
+ VERSION = '0.0.39'
31
31
  end
@@ -23,6 +23,7 @@
23
23
  # SOFTWARE.
24
24
 
25
25
  require 'minitest/autorun'
26
+ require 'loog'
26
27
  require_relative '../test__helper'
27
28
  require_relative '../../lib/fbe/award'
28
29
 
@@ -58,7 +59,8 @@ class TestAward < Minitest::Test
58
59
  (set b2 (if (lt b2 at_least) b2 0))
59
60
  (set b2 (between b2 3 120))
60
61
  (give b2 "for holding the bug open for too long (${days} days)"))
61
- '
62
+ ',
63
+ judge: '', global: {}, loog: Loog::NULL, options: nil
62
64
  )
63
65
  b = a.bill(hours: 10)
64
66
  assert(b.points <= 100)
@@ -0,0 +1,47 @@
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 'factbase'
28
+ require_relative '../test__helper'
29
+ require_relative '../../lib/fbe/regularly'
30
+
31
+ # Test.
32
+ # Author:: Yegor Bugayenko (yegor256@gmail.com)
33
+ # Copyright:: Copyright (c) 2024 Zerocracy
34
+ # License:: MIT
35
+ class TestRegularly < Minitest::Test
36
+ def test_simple
37
+ fb = Factbase.new
38
+ loog = Loog::NULL
39
+ judge = 'test'
40
+ 2.times do
41
+ Fbe.regularly('pmp', 'interval', 'days', fb:, loog:, judge:) do |f|
42
+ f.foo = 42
43
+ end
44
+ end
45
+ assert_equal(1, fb.size)
46
+ end
47
+ 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.37
4
+ version: 0.0.39
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-06 00:00:00.000000000 Z
11
+ date: 2024-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backtrace
@@ -234,6 +234,7 @@ files:
234
234
  - lib/fbe/middleware/quota.rb
235
235
  - lib/fbe/octo.rb
236
236
  - lib/fbe/pmp.rb
237
+ - lib/fbe/regularly.rb
237
238
  - lib/fbe/sec.rb
238
239
  - lib/fbe/unmask_repos.rb
239
240
  - lib/fbe/who.rb
@@ -248,6 +249,7 @@ files:
248
249
  - test/fbe/test_iterate.rb
249
250
  - test/fbe/test_octo.rb
250
251
  - test/fbe/test_pmp.rb
252
+ - test/fbe/test_regularly.rb
251
253
  - test/fbe/test_sec.rb
252
254
  - test/fbe/test_unmask_repos.rb
253
255
  - test/fbe/test_who.rb