fbe 0.3.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/Gemfile.lock +21 -19
- data/assets/bylaws/bug-report-was-rewarded.liquid +1 -1
- data/assets/bylaws/code-contribution-was-rewarded.liquid +1 -1
- data/assets/bylaws/code-review-was-rewarded.liquid +1 -1
- data/assets/bylaws/dud-was-punished.liquid +1 -1
- data/assets/bylaws/enhancement-suggestion-was-rewarded.liquid +1 -1
- data/assets/bylaws/long-pull-was-punished.liquid +7 -0
- data/assets/bylaws/published-release-was-rewarded.liquid +1 -1
- data/assets/bylaws/resolved-bug-was-rewarded.liquid +1 -1
- data/lib/fbe/delete.rb +34 -0
- data/lib/fbe.rb +1 -1
- data/test/fbe/test_delete.rb +37 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8804446cc55d23590d576878600c4e5c760cfb016f0a46c4033d8c85f44a2e1f
|
4
|
+
data.tar.gz: 605d2cf5292946ce0361d68b7391e4f39b95f54a9abf2ad633f0bb88fd6940da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7812a639f13574f6918ed5a92ab239203701e484f6d90965f970d2df81691d186973f2383e5d8ef43afeba07cc0fe52eb2bb4110329c63f34cd2eb0067cc686c
|
7
|
+
data.tar.gz: 344616cbcd735acf47104035876bd05ae3f0c1a0c812d51fd7772f93dad64022e8d188ccf05ea6a2a77c6691b58a726d1c56ac48632118dc3ebe18030ddc2f3e
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -41,7 +41,7 @@ GEM
|
|
41
41
|
ast (2.4.3)
|
42
42
|
backtrace (0.4.0)
|
43
43
|
base64 (0.2.0)
|
44
|
-
baza.rb (0.0
|
44
|
+
baza.rb (0.1.0)
|
45
45
|
backtrace (> 0)
|
46
46
|
elapsed (> 0)
|
47
47
|
faraday (> 0)
|
@@ -69,7 +69,7 @@ GEM
|
|
69
69
|
tago (> 0)
|
70
70
|
ethon (0.16.0)
|
71
71
|
ffi (>= 1.15.0)
|
72
|
-
factbase (0.9.
|
72
|
+
factbase (0.9.10)
|
73
73
|
backtrace (~> 0.4)
|
74
74
|
decoor (~> 0.0)
|
75
75
|
json (~> 2.7)
|
@@ -89,7 +89,7 @@ GEM
|
|
89
89
|
multipart-post (~> 2.0)
|
90
90
|
faraday-net_http (3.4.0)
|
91
91
|
net-http (>= 0.5.0)
|
92
|
-
faraday-retry (2.
|
92
|
+
faraday-retry (2.3.1)
|
93
93
|
faraday (~> 2.0)
|
94
94
|
ffi (1.17.1-arm64-darwin)
|
95
95
|
ffi (1.17.1-x64-mingw-ucrt)
|
@@ -98,7 +98,7 @@ GEM
|
|
98
98
|
fiber-storage (1.0.0)
|
99
99
|
gli (2.22.2)
|
100
100
|
ostruct
|
101
|
-
graphql (2.
|
101
|
+
graphql (2.5.1)
|
102
102
|
base64
|
103
103
|
fiber-storage
|
104
104
|
logger
|
@@ -110,12 +110,12 @@ GEM
|
|
110
110
|
concurrent-ruby (~> 1.0)
|
111
111
|
iri (0.10.0)
|
112
112
|
json (2.10.2)
|
113
|
-
judges (0.
|
113
|
+
judges (0.39.2)
|
114
114
|
backtrace (~> 0)
|
115
115
|
baza.rb (~> 0)
|
116
116
|
concurrent-ruby (~> 1.2)
|
117
117
|
elapsed (~> 0)
|
118
|
-
factbase (
|
118
|
+
factbase (~> 0.9)
|
119
119
|
gli (~> 2.21)
|
120
120
|
iri (~> 0)
|
121
121
|
loog (~> 0)
|
@@ -142,22 +142,23 @@ GEM
|
|
142
142
|
multipart-post (2.4.1)
|
143
143
|
net-http (0.6.0)
|
144
144
|
uri
|
145
|
-
nokogiri (1.18.
|
145
|
+
nokogiri (1.18.7-arm64-darwin)
|
146
146
|
racc (~> 1.4)
|
147
|
-
nokogiri (1.18.
|
147
|
+
nokogiri (1.18.7-x64-mingw-ucrt)
|
148
148
|
racc (~> 1.4)
|
149
|
-
nokogiri (1.18.
|
149
|
+
nokogiri (1.18.7-x86_64-darwin)
|
150
150
|
racc (~> 1.4)
|
151
|
-
nokogiri (1.18.
|
151
|
+
nokogiri (1.18.7-x86_64-linux-gnu)
|
152
152
|
racc (~> 1.4)
|
153
|
-
obk (0.3.
|
153
|
+
obk (0.3.2)
|
154
154
|
octokit (9.2.0)
|
155
155
|
faraday (>= 1, < 3)
|
156
156
|
sawyer (~> 0.9)
|
157
|
+
os (1.1.4)
|
157
158
|
ostruct (0.6.1)
|
158
159
|
others (0.0.3)
|
159
160
|
parallel (1.26.3)
|
160
|
-
parser (3.3.7.
|
161
|
+
parser (3.3.7.4)
|
161
162
|
ast (~> 2.4.1)
|
162
163
|
racc
|
163
164
|
prism (1.4.0)
|
@@ -173,7 +174,7 @@ GEM
|
|
173
174
|
regexp_parser (2.10.0)
|
174
175
|
retries (0.0.5)
|
175
176
|
rexml (3.4.1)
|
176
|
-
rubocop (1.75.
|
177
|
+
rubocop (1.75.2)
|
177
178
|
json (~> 2.3)
|
178
179
|
language_server-protocol (~> 3.17.0.2)
|
179
180
|
lint_roller (~> 1.1.0)
|
@@ -181,19 +182,19 @@ GEM
|
|
181
182
|
parser (>= 3.3.0.2)
|
182
183
|
rainbow (>= 2.2.2, < 4.0)
|
183
184
|
regexp_parser (>= 2.9.3, < 3.0)
|
184
|
-
rubocop-ast (>= 1.
|
185
|
+
rubocop-ast (>= 1.44.0, < 2.0)
|
185
186
|
ruby-progressbar (~> 1.7)
|
186
187
|
unicode-display_width (>= 2.4.0, < 4.0)
|
187
|
-
rubocop-ast (1.
|
188
|
+
rubocop-ast (1.44.0)
|
188
189
|
parser (>= 3.3.7.2)
|
189
190
|
prism (~> 1.4)
|
190
|
-
rubocop-minitest (0.
|
191
|
+
rubocop-minitest (0.38.0)
|
191
192
|
lint_roller (~> 1.1)
|
192
|
-
rubocop (>= 1.
|
193
|
+
rubocop (>= 1.75.0, < 2.0)
|
193
194
|
rubocop-ast (>= 1.38.0, < 2.0)
|
194
|
-
rubocop-performance (1.
|
195
|
+
rubocop-performance (1.25.0)
|
195
196
|
lint_roller (~> 1.1)
|
196
|
-
rubocop (>= 1.
|
197
|
+
rubocop (>= 1.75.0, < 2.0)
|
197
198
|
rubocop-ast (>= 1.38.0, < 2.0)
|
198
199
|
rubocop-rake (0.7.1)
|
199
200
|
lint_roller (~> 1.1)
|
@@ -249,6 +250,7 @@ DEPENDENCIES
|
|
249
250
|
fbe!
|
250
251
|
minitest (~> 5.25)
|
251
252
|
minitest-reporters (>= 1.7)
|
253
|
+
os (> 0)
|
252
254
|
qbash (> 0)
|
253
255
|
rake (>= 13)
|
254
256
|
rubocop (~> 1.75)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
(award
|
2
|
-
(explain "When a code contribution is made, the author
|
2
|
+
(explain "When a code contribution is made, the author receives a bonus")
|
3
3
|
(in hoc "the total number of hits-of-code in the contribution")
|
4
4
|
(in comments "the total number of comments made by all reviewers")
|
5
5
|
(in reviews "the number of reviews provided")
|
@@ -1,5 +1,5 @@
|
|
1
1
|
(award
|
2
|
-
(explain "An author of every code review
|
2
|
+
(explain "An author of every code review receives a bonus")
|
3
3
|
(in hoc "the total number of hits-of-code in the contribution")
|
4
4
|
(in comments "the total number of comments made by all reviewers")
|
5
5
|
(in self "1 if the review was made for their own code contribution, otherwise zero")
|
@@ -1,5 +1,5 @@
|
|
1
1
|
(award
|
2
|
-
(explain "When an issue is submitted but then rejected by the team, the reporter
|
2
|
+
(explain "When an issue is submitted but then rejected by the team, the reporter receives a penalty")
|
3
3
|
(aka
|
4
4
|
(let fee {{ -8 | times: anger }})
|
5
5
|
(give fee "as a basis")
|
@@ -1,5 +1,5 @@
|
|
1
1
|
(award
|
2
|
-
(explain "When an enhancement is suggested and accepted by the team, the reporter
|
2
|
+
(explain "When an enhancement is suggested and accepted by the team, the reporter receives a bonus")
|
3
3
|
(aka
|
4
4
|
(let bonus {{ 4 | times: love }})
|
5
5
|
(give bonus "as a basis")
|
@@ -1,5 +1,5 @@
|
|
1
1
|
(award
|
2
|
-
(explain "When a new release is published,
|
2
|
+
(explain "When a new release is published, everyone who contributed receives a bonus")
|
3
3
|
(in hoc "how many hits-of-code are in the release")
|
4
4
|
(in contributors "how many people contributed to the release")
|
5
5
|
(aka
|
@@ -1,5 +1,5 @@
|
|
1
1
|
(award
|
2
|
-
(explain "When a bug is resolved, the person who was assigned to it
|
2
|
+
(explain "When a bug is resolved, the person who was assigned to it receives a bonus")
|
3
3
|
(in hours "how many hours it took to resolve the bug")
|
4
4
|
(in self "1 if the bug was reported and resolved by the same person, otherwise zero")
|
5
5
|
(set days (div hours 24))
|
data/lib/fbe/delete.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Zerocracy
|
4
|
+
# SPDX-License-Identifier: MIT
|
5
|
+
|
6
|
+
require_relative '../fbe'
|
7
|
+
require_relative 'fb'
|
8
|
+
|
9
|
+
# Delete a few properties from the fact.
|
10
|
+
#
|
11
|
+
# @param [Factbase::Fact] source The source
|
12
|
+
# @param [Array<String>] props List of properties to delete
|
13
|
+
# @param [Factbase] fb The factbase
|
14
|
+
# @param [String] id The unique ID of the fact
|
15
|
+
# @return [Factbase::Fact] New fact
|
16
|
+
def Fbe.delete(fact, *props, fb: Fbe.fb, id: '_id')
|
17
|
+
raise 'The fact is nil' if fact.nil?
|
18
|
+
i = fact[id]
|
19
|
+
raise "There is no #{id.inspect} in the fact" if i.nil?
|
20
|
+
i = i.first
|
21
|
+
before = {}
|
22
|
+
fact.all_properties.each do |k|
|
23
|
+
next if props.include?(k)
|
24
|
+
fact[k].each do |v|
|
25
|
+
before[k] = v
|
26
|
+
end
|
27
|
+
end
|
28
|
+
fb.query("(eq #{id} #{i})").delete!
|
29
|
+
c = fb.insert
|
30
|
+
before.each do |k, v|
|
31
|
+
c.send(:"#{k}=", v)
|
32
|
+
end
|
33
|
+
c
|
34
|
+
end
|
data/lib/fbe.rb
CHANGED
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Zerocracy
|
4
|
+
# SPDX-License-Identifier: MIT
|
5
|
+
|
6
|
+
require 'factbase'
|
7
|
+
require_relative '../test__helper'
|
8
|
+
require_relative '../../lib/fbe/delete'
|
9
|
+
|
10
|
+
# Test.
|
11
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
12
|
+
# Copyright:: Copyright (c) 2024-2025 Zerocracy
|
13
|
+
# License:: MIT
|
14
|
+
class TestDelete < Minitest::Test
|
15
|
+
def test_deletes_one_property
|
16
|
+
fb = Factbase.new
|
17
|
+
f = fb.insert
|
18
|
+
f.foo = 42
|
19
|
+
f.hey = 4
|
20
|
+
f._id = 555
|
21
|
+
Fbe.delete(f, 'foo', 'bar', fb:)
|
22
|
+
assert_equal(1, fb.size)
|
23
|
+
assert_equal(1, fb.query('(exists hey)').each.to_a.size)
|
24
|
+
assert_equal(4, fb.query('(exists hey)').each.first.hey)
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_deletes_two_properties
|
28
|
+
fb = Factbase.new
|
29
|
+
f = fb.insert
|
30
|
+
f.foo = 42
|
31
|
+
f.hey = 4
|
32
|
+
f._id = 555
|
33
|
+
Fbe.delete(f, 'foo', 'hey', fb:)
|
34
|
+
assert_equal(1, fb.size)
|
35
|
+
assert_equal(0, fb.query('(exists hey)').each.to_a.size)
|
36
|
+
end
|
37
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fbe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-04-06 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: backtrace
|
@@ -272,6 +272,7 @@ files:
|
|
272
272
|
- assets/bylaws/code-review-was-rewarded.liquid
|
273
273
|
- assets/bylaws/dud-was-punished.liquid
|
274
274
|
- assets/bylaws/enhancement-suggestion-was-rewarded.liquid
|
275
|
+
- assets/bylaws/long-pull-was-punished.liquid
|
275
276
|
- assets/bylaws/published-release-was-rewarded.liquid
|
276
277
|
- assets/bylaws/push-to-master-was-punished.liquid
|
277
278
|
- assets/bylaws/resolved-bug-was-rewarded.liquid
|
@@ -281,6 +282,7 @@ files:
|
|
281
282
|
- lib/fbe/bylaws.rb
|
282
283
|
- lib/fbe/conclude.rb
|
283
284
|
- lib/fbe/copy.rb
|
285
|
+
- lib/fbe/delete.rb
|
284
286
|
- lib/fbe/enter.rb
|
285
287
|
- lib/fbe/fb.rb
|
286
288
|
- lib/fbe/github_graph.rb
|
@@ -307,6 +309,7 @@ files:
|
|
307
309
|
- test/fbe/test_bylaws.rb
|
308
310
|
- test/fbe/test_conclude.rb
|
309
311
|
- test/fbe/test_copy.rb
|
312
|
+
- test/fbe/test_delete.rb
|
310
313
|
- test/fbe/test_enter.rb
|
311
314
|
- test/fbe/test_fb.rb
|
312
315
|
- test/fbe/test_github_graph.rb
|