fbe 0.0.37 → 0.0.38

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: e69702483c25c55333a0391946414e8204e5116c47af9ce6c76736f30ac60e09
4
+ data.tar.gz: 5d868159c91bd6c58d6b6be8c5ba25c1138c0191cf5b915044a49b170342a36e
5
5
  SHA512:
6
- metadata.gz: 5bedce35fba41f38cd0605a2fb5ad32497e00f4a95db0a130c15c1d8d886955d797024410b1d96844470792fe0731db6ae97d332ce472ffd4db39cfb710483a8
7
- data.tar.gz: f43d741abf35225cc9d4708ef255fc7abf56f5288560b1b7e56e876e84781bfeacde5a8c5a5ca20240a8b8fd6be49045a1bf14e206ccf881cae5142e648c7592
6
+ metadata.gz: 0c7ed04c82fe5f4c1fe28a127113ab65bc539db0079bb097ebb9979ba2cb521f37a4f5b6ee16aab51f8eac2e67e3da2bbba2f28372218a4a17de6c767514edf4
7
+ data.tar.gz: 4dc676859c6a144bd405808180a63c23bebd61423dc6d009a752a983c4267786b170e6d50758f98896adeb699d775ed75d9978dbf3dc90d0dbd56faee9502a15
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,46 @@
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, days, interval, fb: Fbe.fb, judge: $judge, loog: $loog, &)
29
+ pmp = fb.query("(and (eq what 'pmp') (eq area '#{area}') (exists #{days}))").each.to_a.first
30
+ days = pmp.nil? ? 28 : pmp[days].first
31
+ since = Time.now - (days * 24 * 60 * 60)
32
+ interval = pmp.nil? ? 7 : pmp[interval].first
33
+ unless fb.query(
34
+ "(and
35
+ (eq what '#{judge}')
36
+ (gt when (minus (to_time (env 'TODAY' '#{Time.now.utc.iso8601}')) '#{interval} days')))"
37
+ ).each.to_a.empty?
38
+ loog.debug("#{$judge} statistics have recently been collected, skipping now")
39
+ return
40
+ end
41
+ f = fb.insert
42
+ f.what = judge
43
+ f.when = Time.now
44
+ f.since = since
45
+ yield f
46
+ 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.38'
31
31
  end
@@ -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', 'days', 'interval', 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.38
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