fbe 0.1.0 → 0.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2837fa24108886b565d0b12026220b20fd305cf7376d4e551bbef3ccacb9b42b
4
- data.tar.gz: a6e93af54d94cfe9c8e0b92a7833a2fc11b1d808245520c00cde309d0af4a69a
3
+ metadata.gz: 2e30d3c664dd4f68ba599c702153fd09dc1e7cb9159d52a9ca131447dfe6bcda
4
+ data.tar.gz: bb35a47f645aaa956f8476759393c29be14ca339b64b4798bfe6d3d310ce79a8
5
5
  SHA512:
6
- metadata.gz: e18055e38bb2900d05314b0eb41b83bbea871d5787809744ec22dc928c3906c5110d88debf0bf4a4b98d91eb3af93709783266b53f25812d05037d1027153649
7
- data.tar.gz: 464d4e834e8f85a00f10929e54aceefc8159946c971288a67d7614982130336485c7b0a19f1b14e3854b9635d8fda414b3125e3b36657248b522448e5bdb071c
6
+ metadata.gz: 956a7c66623e26e3d642c634fd0e382073962bfbbb7b28d1f6a686b775491f98ca8e2bd5b73a5bbae52fb6feaae40a503e674c694e7a65bb92b6e39de4e649cd
7
+ data.tar.gz: 50532d3aa0f16a7f60d5f81793b28cd1f836312116d3791c9b552de060f7b95ba18993d85d83d0a6917ec111aeb7223f588aafe04809e8df8a4185cad6fc5237
data/.rubocop.yml CHANGED
@@ -22,6 +22,8 @@ Lint/NestedMethodDefinition:
22
22
  Enabled: false
23
23
  Gemspec/RequiredRubyVersion:
24
24
  Enabled: false
25
+ Metrics/ModuleLength:
26
+ Enabled: false
25
27
  Metrics/MethodLength:
26
28
  Enabled: false
27
29
  Style/ClassAndModuleChildren:
data/Gemfile CHANGED
@@ -6,16 +6,17 @@
6
6
  source 'https://rubygems.org'
7
7
  gemspec
8
8
 
9
- gem 'minitest', '5.25.4', require: false
9
+ gem 'minitest', '5.25.5', require: false
10
10
  gem 'minitest-reporters', '>=1.7', require: false
11
+ gem 'qbash', '>0', require: false
11
12
  gem 'rake', '>=13', require: false
12
13
  gem 'rspec-rails', '>0', require: false
13
- gem 'rubocop', '1.73.1', require: false
14
+ gem 'rubocop', '1.73.2', require: false
14
15
  gem 'rubocop-minitest', '>0', require: false
15
16
  gem 'rubocop-performance', '>0', require: false
16
17
  gem 'rubocop-rake', '>0', require: false
17
18
  gem 'rubocop-rspec', '>0', require: false
18
19
  gem 'simplecov', '0.22.0', require: false
19
20
  gem 'simplecov-cobertura', '2.1.0', require: false
20
- gem 'webmock', '3.25.0', require: false
21
+ gem 'webmock', '3.25.1', require: false
21
22
  gem 'yard', '0.9.37', require: false
data/Gemfile.lock CHANGED
@@ -5,7 +5,7 @@ PATH
5
5
  backtrace (~> 0)
6
6
  baza.rb (~> 0)
7
7
  decoor (~> 0)
8
- factbase (>= 0.7.4)
8
+ factbase (>= 0.9.1)
9
9
  faraday (~> 2)
10
10
  faraday-http-cache (~> 2)
11
11
  faraday-multipart (~> 1)
@@ -22,9 +22,9 @@ PATH
22
22
  GEM
23
23
  remote: https://rubygems.org/
24
24
  specs:
25
- actionpack (8.0.1)
26
- actionview (= 8.0.1)
27
- activesupport (= 8.0.1)
25
+ actionpack (8.0.2)
26
+ actionview (= 8.0.2)
27
+ activesupport (= 8.0.2)
28
28
  nokogiri (>= 1.8.5)
29
29
  rack (>= 2.2.4)
30
30
  rack-session (>= 1.0.1)
@@ -32,13 +32,13 @@ GEM
32
32
  rails-dom-testing (~> 2.2)
33
33
  rails-html-sanitizer (~> 1.6)
34
34
  useragent (~> 0.16)
35
- actionview (8.0.1)
36
- activesupport (= 8.0.1)
35
+ actionview (8.0.2)
36
+ activesupport (= 8.0.2)
37
37
  builder (~> 3.1)
38
38
  erubi (~> 1.11)
39
39
  rails-dom-testing (~> 2.2)
40
40
  rails-html-sanitizer (~> 1.6)
41
- activesupport (8.0.1)
41
+ activesupport (8.0.2)
42
42
  base64
43
43
  benchmark (>= 0.3)
44
44
  bigdecimal
@@ -89,14 +89,14 @@ GEM
89
89
  erubi (1.13.1)
90
90
  ethon (0.16.0)
91
91
  ffi (>= 1.15.0)
92
- factbase (0.7.4)
93
- backtrace (> 0)
94
- decoor (> 0)
92
+ factbase (0.9.1)
93
+ backtrace (>= 0.4.0)
94
+ decoor (>= 0.0.1)
95
95
  json (~> 2.7)
96
- loog (> 0)
96
+ loog (>= 0.6.0)
97
97
  nokogiri (~> 1.10)
98
- others (> 0)
99
- tago (> 0)
98
+ others (>= 0.0.3)
99
+ tago (>= 0.0.2)
100
100
  yaml (~> 0.3)
101
101
  faraday (2.12.2)
102
102
  faraday-net_http (>= 2.0, < 3.5)
@@ -117,7 +117,7 @@ GEM
117
117
  fiber-storage (1.0.0)
118
118
  gli (2.22.2)
119
119
  ostruct
120
- graphql (2.4.11)
120
+ graphql (2.4.13)
121
121
  base64
122
122
  fiber-storage
123
123
  logger
@@ -133,13 +133,13 @@ GEM
133
133
  rdoc (>= 4.0.0)
134
134
  reline (>= 0.4.2)
135
135
  iri (0.10.0)
136
- json (2.10.1)
137
- judges (0.34.0)
136
+ json (2.10.2)
137
+ judges (0.36.3)
138
138
  backtrace (~> 0)
139
139
  baza.rb (~> 0)
140
140
  concurrent-ruby (~> 1.2)
141
141
  elapsed (~> 0)
142
- factbase (>= 0.7.0)
142
+ factbase (>= 0.9.1)
143
143
  gli (~> 2.21)
144
144
  iri (~> 0)
145
145
  loog (~> 0)
@@ -149,6 +149,7 @@ GEM
149
149
  retries (~> 0)
150
150
  tago (~> 0)
151
151
  timeout (~> 0)
152
+ total (~> 0)
152
153
  typhoeus (~> 1.3)
153
154
  language_server-protocol (3.17.0.4)
154
155
  lint_roller (1.1.0)
@@ -158,7 +159,7 @@ GEM
158
159
  crass (~> 1.0.2)
159
160
  nokogiri (>= 1.12.0)
160
161
  loog (0.6.0)
161
- minitest (5.25.4)
162
+ minitest (5.25.5)
162
163
  minitest-reporters (1.7.1)
163
164
  ansi
164
165
  builder
@@ -193,8 +194,13 @@ GEM
193
194
  date
194
195
  stringio
195
196
  public_suffix (6.0.1)
197
+ qbash (0.4.0)
198
+ backtrace (> 0)
199
+ elapsed (> 0)
200
+ loog (> 0)
201
+ tago (> 0)
196
202
  racc (1.8.1)
197
- rack (3.1.10)
203
+ rack (3.1.12)
198
204
  rack-session (2.1.0)
199
205
  base64 (>= 0.1.0)
200
206
  rack (>= 3.0.0)
@@ -209,9 +215,9 @@ GEM
209
215
  rails-html-sanitizer (1.6.2)
210
216
  loofah (~> 2.21)
211
217
  nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
212
- railties (8.0.1)
213
- actionpack (= 8.0.1)
214
- activesupport (= 8.0.1)
218
+ railties (8.0.2)
219
+ actionpack (= 8.0.2)
220
+ activesupport (= 8.0.2)
215
221
  irb (~> 1.13)
216
222
  rackup (>= 1.0.0)
217
223
  rake (>= 12.2)
@@ -243,7 +249,7 @@ GEM
243
249
  rspec-mocks (~> 3.13)
244
250
  rspec-support (~> 3.13)
245
251
  rspec-support (3.13.2)
246
- rubocop (1.73.1)
252
+ rubocop (1.73.2)
247
253
  json (~> 2.3)
248
254
  language_server-protocol (~> 3.17.0.2)
249
255
  lint_roller (~> 1.1.0)
@@ -288,6 +294,7 @@ GEM
288
294
  tago (0.0.2)
289
295
  thor (1.3.2)
290
296
  timeout (0.4.3)
297
+ total (0.4.1)
291
298
  typhoeus (1.4.1)
292
299
  ethon (>= 0.9.0)
293
300
  tzinfo (2.0.6)
@@ -300,7 +307,7 @@ GEM
300
307
  verbose (0.0.2)
301
308
  loog (~> 0.2)
302
309
  tago (~> 0.0)
303
- webmock (3.25.0)
310
+ webmock (3.25.1)
304
311
  addressable (>= 2.8.0)
305
312
  crack (>= 0.3.2)
306
313
  hashdiff (>= 0.4.0, < 2.0.0)
@@ -319,18 +326,19 @@ PLATFORMS
319
326
 
320
327
  DEPENDENCIES
321
328
  fbe!
322
- minitest (= 5.25.4)
329
+ minitest (= 5.25.5)
323
330
  minitest-reporters (>= 1.7)
331
+ qbash (> 0)
324
332
  rake (>= 13)
325
333
  rspec-rails (> 0)
326
- rubocop (= 1.73.1)
334
+ rubocop (= 1.73.2)
327
335
  rubocop-minitest (> 0)
328
336
  rubocop-performance (> 0)
329
337
  rubocop-rake (> 0)
330
338
  rubocop-rspec (> 0)
331
339
  simplecov (= 0.22.0)
332
340
  simplecov-cobertura (= 2.1.0)
333
- webmock (= 3.25.0)
341
+ webmock (= 3.25.1)
334
342
  yard (= 0.9.37)
335
343
 
336
344
  BUNDLED WITH
data/REUSE.toml CHANGED
@@ -4,6 +4,9 @@
4
4
  version = 1
5
5
  [[annotations]]
6
6
  path = [
7
+ "**.json",
8
+ "**.md",
9
+ "**.txt",
7
10
  "**/*.csv",
8
11
  "**/*.fe",
9
12
  "**/*.jpg",
@@ -15,13 +18,15 @@ path = [
15
18
  "**/*.svg",
16
19
  "**/*.txt",
17
20
  "**/*.vm",
21
+ "**/.DS_Store",
18
22
  "**/.gitignore",
23
+ "**/.pdd",
19
24
  "**/CNAME",
25
+ "**/Gemfile.lock",
26
+ ".DS_Store",
20
27
  ".gitattributes",
21
28
  ".gitignore",
22
- ".gitleaksignore",
23
29
  ".pdd",
24
- ".xcop",
25
30
  "Gemfile.lock",
26
31
  "README.md",
27
32
  "renovate.json",
data/Rakefile CHANGED
@@ -3,6 +3,7 @@
3
3
  # SPDX-FileCopyrightText: Copyright (c) 2024-2025 Zerocracy
4
4
  # SPDX-License-Identifier: MIT
5
5
 
6
+ require 'qbash'
6
7
  require 'rubygems'
7
8
  require 'rake'
8
9
  require 'rake/clean'
@@ -17,7 +18,7 @@ end
17
18
 
18
19
  ENV['RACK_ENV'] = 'test'
19
20
 
20
- task default: %i[clean test rubocop yard]
21
+ task default: %i[clean test picks reqs rubocop yard]
21
22
 
22
23
  require 'rake/testtask'
23
24
  desc 'Run all unit tests'
@@ -29,6 +30,20 @@ Rake::TestTask.new(:test) do |test|
29
30
  test.verbose = false
30
31
  end
31
32
 
33
+ desc 'Run them via Ruby, one by one'
34
+ task :picks do
35
+ Dir['test/**/*.rb'].each do |f|
36
+ qbash("bundle exec ruby #{Shellwords.escape(f)}", log: $stdout)
37
+ end
38
+ end
39
+
40
+ desc 'Require them via Ruby, one by one'
41
+ task :reqs do
42
+ Dir['lib/**/*.rb'].each do |f|
43
+ qbash("bundle exec ruby #{Shellwords.escape(f)}", log: $stdout)
44
+ end
45
+ end
46
+
32
47
  require 'yard'
33
48
  desc 'Build Yard documentation'
34
49
  YARD::Rake::YardocTask.new do |t|
data/fbe.gemspec CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
25
25
  s.add_dependency 'backtrace', '~>0'
26
26
  s.add_dependency 'baza.rb', '~>0'
27
27
  s.add_dependency 'decoor', '~>0'
28
- s.add_dependency 'factbase', '>=0.7.4'
28
+ s.add_dependency 'factbase', '>=0.9.1'
29
29
  s.add_dependency 'faraday', '~>2'
30
30
  s.add_dependency 'faraday-http-cache', '~>2'
31
31
  s.add_dependency 'faraday-multipart', '~>1'
data/lib/fbe/award.rb CHANGED
@@ -41,7 +41,8 @@ class Fbe::Award
41
41
  # @param [Hash] vars Hash of variables
42
42
  # @return [Fbe::Award::Bill] The bill
43
43
  def bill(vars = {})
44
- term = Factbase::Syntax.new(Factbase.new, @query, term: Fbe::Award::BTerm).to_term
44
+ term = Factbase::Syntax.new(@query).to_term
45
+ term.redress!(Fbe::Award::BTerm)
45
46
  bill = Bill.new
46
47
  vars.each { |k, v| bill.set(k, v) }
47
48
  term.bill_to(bill)
@@ -51,20 +52,15 @@ class Fbe::Award
51
52
  # Build a bylaw object from this award query.
52
53
  # @return [Fbe::Award::Bylaw] The bylaw
53
54
  def bylaw
54
- term = Factbase::Syntax.new(Factbase.new, @query, term: Fbe::Award::PTerm).to_term
55
+ term = Factbase::Syntax.new(@query).to_term
56
+ term.redress!(Fbe::Award::PTerm)
55
57
  bylaw = Bylaw.new
56
58
  term.publish_to(bylaw)
57
59
  bylaw
58
60
  end
59
61
 
60
62
  # A term for bill.
61
- class BTerm < Factbase::Term
62
- def initialize(_fb, operator, operands)
63
- super(nil, nil, nil)
64
- @op = operator
65
- @operands = operands
66
- end
67
-
63
+ module BTerm
68
64
  def to_s
69
65
  "(#{@op} #{@operands.join(' ')})"
70
66
  end
@@ -164,13 +160,7 @@ class Fbe::Award
164
160
  end
165
161
 
166
162
  # A term for bylaw.
167
- class PTerm < Factbase::Term
168
- def initialize(_fb, operator, operands)
169
- super(nil, nil, nil)
170
- @op = operator
171
- @operands = operands
172
- end
173
-
163
+ module PTerm
174
164
  def to_s
175
165
  case @op
176
166
  when :total
data/lib/fbe/fb.rb CHANGED
@@ -3,12 +3,12 @@
3
3
  # SPDX-FileCopyrightText: Copyright (c) 2024-2025 Zerocracy
4
4
  # SPDX-License-Identifier: MIT
5
5
 
6
- require 'loog'
7
- require 'judges'
8
6
  require 'factbase'
9
7
  require 'factbase/logged'
10
8
  require 'factbase/pre'
11
9
  require 'factbase/rules'
10
+ require 'judges'
11
+ require 'loog'
12
12
  require_relative '../fbe'
13
13
 
14
14
  # Returns an instance of +Factbase+ (cached).
@@ -6,6 +6,7 @@
6
6
  require 'graphql/client'
7
7
  require 'graphql/client/http'
8
8
  require 'loog'
9
+ require_relative '../fbe'
9
10
 
10
11
  # Creates an instance of {Fbe::Graph}.
11
12
  #
data/lib/fbe/iterate.rb CHANGED
@@ -126,7 +126,7 @@ class Fbe::Iterate
126
126
  ).one
127
127
  @fb.query("(and (eq what '#{@label}') (eq where 'github') (eq repository #{rid}))").delete!
128
128
  before = before.nil? ? @since : before.first
129
- nxt = @fb.query(@query).one(before:, repository: rid)
129
+ nxt = @fb.query(@query).one(@fb, before:, repository: rid)
130
130
  after =
131
131
  if nxt.nil?
132
132
  @loog.debug("Next element after ##{before} not suggested, re-starting from ##{@since}: #{@query}")
@@ -3,6 +3,7 @@
3
3
  # SPDX-FileCopyrightText: Copyright (c) 2024-2025 Zerocracy
4
4
  # SPDX-License-Identifier: MIT
5
5
 
6
+ require 'faraday'
6
7
  require 'faraday/logging/formatter'
7
8
  require_relative '../../fbe'
8
9
  require_relative '../../fbe/middleware'
@@ -4,6 +4,7 @@
4
4
  # SPDX-License-Identifier: MIT
5
5
 
6
6
  require 'faraday'
7
+ require_relative '../middleware'
7
8
 
8
9
  # Faraday Middleware that monitors GitHub API rate limits.
9
10
  #
data/lib/fbe.rb CHANGED
@@ -10,5 +10,5 @@
10
10
  # License:: MIT
11
11
  module Fbe
12
12
  # Current version of the gem (changed by +.rultor.yml+ on every release)
13
- VERSION = '0.1.0'
13
+ VERSION = '0.2.1' unless const_defined?(:VERSION)
14
14
  end
data/rules/basic.fe CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  (undef explain)
24
24
  (defn explain '
25
- r = @operands[0].evaluate(fact, maps);
25
+ r = @operands[0].evaluate(fact, maps, fb);
26
26
  if !r && !$loog.nil?
27
27
  $loog.error(\'This rule failed: \' + self.to_s)
28
28
  end
@@ -5,7 +5,12 @@
5
5
 
6
6
  require 'faraday'
7
7
  require 'logger'
8
+ require 'loog'
9
+ require 'judges'
10
+ require 'judges/options'
8
11
  require_relative '../../../lib/fbe/middleware'
12
+ require_relative '../../../lib/fbe/middleware/quota'
13
+ require_relative '../../test__helper'
9
14
 
10
15
  class QuotaTest < Minitest::Test
11
16
  class FakeApp
@@ -3,9 +3,11 @@
3
3
  # SPDX-FileCopyrightText: Copyright (c) 2024-2025 Zerocracy
4
4
  # SPDX-License-Identifier: MIT
5
5
 
6
+ require 'judges/options'
6
7
  require 'loog'
7
- require_relative '../test__helper'
8
+ require 'webmock/minitest'
8
9
  require_relative '../../lib/fbe/enter'
10
+ require_relative '../test__helper'
9
11
 
10
12
  # Test.
11
13
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
@@ -6,6 +6,7 @@
6
6
  require 'judges/options'
7
7
  require 'webmock/minitest'
8
8
  require 'loog'
9
+ require_relative '../test__helper'
9
10
  require_relative '../../lib/fbe/github_graph'
10
11
 
11
12
  # Test.
@@ -3,9 +3,11 @@
3
3
  # SPDX-FileCopyrightText: Copyright (c) 2024-2025 Zerocracy
4
4
  # SPDX-License-Identifier: MIT
5
5
 
6
+ require 'factbase'
7
+ require 'judges/options'
6
8
  require 'loog'
7
- require_relative '../test__helper'
8
9
  require_relative '../../lib/fbe/issue'
10
+ require_relative '../test__helper'
9
11
 
10
12
  # Test.
11
13
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
data/test/fbe/test_sec.rb CHANGED
@@ -3,6 +3,7 @@
3
3
  # SPDX-FileCopyrightText: Copyright (c) 2024-2025 Zerocracy
4
4
  # SPDX-License-Identifier: MIT
5
5
 
6
+ require 'factbase'
6
7
  require_relative '../test__helper'
7
8
  require_relative '../../lib/fbe/sec'
8
9
 
data/test/fbe/test_who.rb CHANGED
@@ -3,9 +3,11 @@
3
3
  # SPDX-FileCopyrightText: Copyright (c) 2024-2025 Zerocracy
4
4
  # SPDX-License-Identifier: MIT
5
5
 
6
+ require 'factbase'
7
+ require 'judges/options'
6
8
  require 'loog'
7
- require_relative '../test__helper'
8
9
  require_relative '../../lib/fbe/who'
10
+ require_relative '../test__helper'
9
11
 
10
12
  # Test.
11
13
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
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.1.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-03-02 00:00:00.000000000 Z
10
+ date: 2025-03-13 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: backtrace
@@ -57,14 +57,14 @@ dependencies:
57
57
  requirements:
58
58
  - - ">="
59
59
  - !ruby/object:Gem::Version
60
- version: 0.7.4
60
+ version: 0.9.1
61
61
  type: :runtime
62
62
  prerelease: false
63
63
  version_requirements: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - ">="
66
66
  - !ruby/object:Gem::Version
67
- version: 0.7.4
67
+ version: 0.9.1
68
68
  - !ruby/object:Gem::Dependency
69
69
  name: faraday
70
70
  requirement: !ruby/object:Gem::Requirement