fbe 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +5 -5
- data/README.md +7 -7
- data/fbe.gemspec +1 -1
- data/lib/fbe/conclude.rb +2 -0
- data/lib/fbe/fb.rb +1 -0
- data/lib/fbe/if_absent.rb +2 -1
- data/lib/fbe/octo.rb +5 -1
- data/lib/fbe.rb +1 -1
- data/rules/basic.fe +12 -78
- data/test/fbe/test_conclude.rb +3 -0
- data/test/fbe/test_octo.rb +7 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce20c859a4a73ebc7c16726e6c11751f291889d9e47f29c901f9c260e3e98ca2
|
4
|
+
data.tar.gz: 4925ec6f17748589aaa23560c5f2a81824ff8a7bfd9aa6f7ea9f0c04c08202ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30cd3accfc71a0f7c3f2875b930bb262d50c362e26ae0c8ca0fee6faa088ef1d00eec238792d0096e90a3e2049a5238db0850d012049279f30389be575c0f048
|
7
|
+
data.tar.gz: 6870bf7417ccc5e87ca0807f8563d7b1852e62b8a03001bea7d191b1684f4bfcdfa5479688fbd4b045a8478a5eacce4def75787abf4b566543fdc86b06fe38ca
|
data/Gemfile
CHANGED
@@ -23,7 +23,7 @@
|
|
23
23
|
source 'https://rubygems.org'
|
24
24
|
gemspec
|
25
25
|
|
26
|
-
gem 'minitest', '5.24.
|
26
|
+
gem 'minitest', '5.24.1', require: false
|
27
27
|
gem 'rake', '13.2.1', require: false
|
28
28
|
gem 'rspec-rails', '6.1.3', require: false
|
29
29
|
gem 'rubocop', '1.64.1', require: false
|
data/Gemfile.lock
CHANGED
@@ -12,7 +12,7 @@ PATH
|
|
12
12
|
judges (~> 0.0)
|
13
13
|
loog (~> 0.2)
|
14
14
|
obk (~> 0.0)
|
15
|
-
octokit (~> 9.1
|
15
|
+
octokit (~> 9.1)
|
16
16
|
others (~> 0.0)
|
17
17
|
verbose (~> 0.0)
|
18
18
|
|
@@ -62,7 +62,7 @@ GEM
|
|
62
62
|
erubi (1.13.0)
|
63
63
|
ethon (0.16.0)
|
64
64
|
ffi (>= 1.15.0)
|
65
|
-
factbase (0.0.
|
65
|
+
factbase (0.0.56)
|
66
66
|
backtrace (~> 0.3)
|
67
67
|
decoor (~> 0.0)
|
68
68
|
json (~> 2.7)
|
@@ -94,7 +94,7 @@ GEM
|
|
94
94
|
reline (>= 0.4.2)
|
95
95
|
iri (0.8.0)
|
96
96
|
json (2.7.2)
|
97
|
-
judges (0.13.
|
97
|
+
judges (0.13.2)
|
98
98
|
backtrace (~> 0.3)
|
99
99
|
concurrent-ruby (~> 1.2)
|
100
100
|
factbase (~> 0.0)
|
@@ -112,7 +112,7 @@ GEM
|
|
112
112
|
crass (~> 1.0.2)
|
113
113
|
nokogiri (>= 1.12.0)
|
114
114
|
loog (0.5.1)
|
115
|
-
minitest (5.24.
|
115
|
+
minitest (5.24.1)
|
116
116
|
moments (0.3.0)
|
117
117
|
multipart-post (2.4.1)
|
118
118
|
mutex_m (0.2.0)
|
@@ -246,7 +246,7 @@ PLATFORMS
|
|
246
246
|
|
247
247
|
DEPENDENCIES
|
248
248
|
fbe!
|
249
|
-
minitest (= 5.24.
|
249
|
+
minitest (= 5.24.1)
|
250
250
|
rake (= 13.2.1)
|
251
251
|
rspec-rails (= 6.1.3)
|
252
252
|
rubocop (= 1.64.1)
|
data/README.md
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# FactBase Extended
|
2
2
|
|
3
|
-
[![DevOps By Rultor.com](http://www.rultor.com/b/
|
3
|
+
[![DevOps By Rultor.com](http://www.rultor.com/b/zerocracy/fbe)](http://www.rultor.com/p/zerocracy/fbe)
|
4
4
|
[![We recommend RubyMine](https://www.elegantobjects.org/rubymine.svg)](https://www.jetbrains.com/ruby/)
|
5
5
|
|
6
|
-
[![rake](https://github.com/
|
7
|
-
[![PDD status](http://www.0pdd.com/svg?name=
|
6
|
+
[![rake](https://github.com/zerocracy/fbe/actions/workflows/rake.yml/badge.svg)](https://github.com/zerocracy/fbe/actions/workflows/rake.yml)
|
7
|
+
[![PDD status](http://www.0pdd.com/svg?name=zerocracy/fbe)](http://www.0pdd.com/p?name=zerocracy/fbe)
|
8
8
|
[![Gem Version](https://badge.fury.io/rb/fbe.svg)](http://badge.fury.io/rb/fbe)
|
9
|
-
[![Test Coverage](https://img.shields.io/codecov/c/github/
|
10
|
-
[![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://rubydoc.info/github/
|
11
|
-
[![Hits-of-Code](https://hitsofcode.com/github/
|
12
|
-
[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/
|
9
|
+
[![Test Coverage](https://img.shields.io/codecov/c/github/zerocracy/fbe.svg)](https://codecov.io/github/zerocracy/fbe?branch=master)
|
10
|
+
[![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://rubydoc.info/github/zerocracy/fbe/master/frames)
|
11
|
+
[![Hits-of-Code](https://hitsofcode.com/github/zerocracy/fbe)](https://hitsofcode.com/view/github/zerocracy/fbe)
|
12
|
+
[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/zerocracy/fbe/blob/master/LICENSE.txt)
|
13
13
|
|
14
14
|
It's a collection of tools.
|
15
15
|
|
data/fbe.gemspec
CHANGED
@@ -48,7 +48,7 @@ Gem::Specification.new do |s|
|
|
48
48
|
s.add_runtime_dependency 'judges', '~>0.0'
|
49
49
|
s.add_runtime_dependency 'loog', '~>0.2'
|
50
50
|
s.add_runtime_dependency 'obk', '~>0.0'
|
51
|
-
s.add_runtime_dependency 'octokit', '~>9.1
|
51
|
+
s.add_runtime_dependency 'octokit', '~>9.1'
|
52
52
|
s.add_runtime_dependency 'others', '~>0.0'
|
53
53
|
s.add_runtime_dependency 'verbose', '~>0.0'
|
54
54
|
s.metadata['rubygems_mfa_required'] = 'true'
|
data/lib/fbe/conclude.rb
CHANGED
data/lib/fbe/fb.rb
CHANGED
data/lib/fbe/if_absent.rb
CHANGED
@@ -25,9 +25,10 @@
|
|
25
25
|
require 'time'
|
26
26
|
require 'others'
|
27
27
|
require_relative '../fbe'
|
28
|
+
require_relative 'fb'
|
28
29
|
|
29
30
|
# Injects a fact if it's absent in the factbase.
|
30
|
-
def Fbe.if_absent(fb)
|
31
|
+
def Fbe.if_absent(fb = Fbe.fb)
|
31
32
|
attrs = {}
|
32
33
|
f = others(map: attrs) do |*args|
|
33
34
|
k = args[0]
|
data/lib/fbe/octo.rb
CHANGED
@@ -42,6 +42,8 @@ def Fbe.octo(options: $options, global: $global, loog: Loog::NULL)
|
|
42
42
|
loog.debug("The 'GITHUB_TOKEN' environment variable is not set") if token.nil?
|
43
43
|
if token.nil?
|
44
44
|
loog.warn('Accessing GitHub API without a token!')
|
45
|
+
elsif token.empty?
|
46
|
+
loog.warn('The GitHub API token is an empty string, won\'t use it')
|
45
47
|
else
|
46
48
|
o = Octokit::Client.new(access_token: token)
|
47
49
|
loog.info("Accessing GitHub API with a token (#{token.length} chars)")
|
@@ -145,7 +147,9 @@ class Fbe::FakeOctokit
|
|
145
147
|
end
|
146
148
|
|
147
149
|
def add_comment(_repo, _issue, _text)
|
148
|
-
|
150
|
+
{
|
151
|
+
id: 42
|
152
|
+
}
|
149
153
|
end
|
150
154
|
|
151
155
|
def search_issues(_query, _options = {})
|
data/lib/fbe.rb
CHANGED
data/rules/basic.fe
CHANGED
@@ -29,25 +29,6 @@
|
|
29
29
|
return r
|
30
30
|
')
|
31
31
|
|
32
|
-
(explain (when
|
33
|
-
(exists what)
|
34
|
-
(or
|
35
|
-
(eq what 'events-were-scanned')
|
36
|
-
(eq what 'labels-were-scanned')
|
37
|
-
(eq what 'bug-was-accepted')
|
38
|
-
(eq what 'bug-was-resolved')
|
39
|
-
(eq what 'comment-was-posted')
|
40
|
-
(eq what 'git-was-pushed')
|
41
|
-
(eq what 'events-were-scanned')
|
42
|
-
(eq what 'issue-was-closed')
|
43
|
-
(eq what 'issue-was-opened')
|
44
|
-
(eq what 'issue-was-assigned')
|
45
|
-
(eq what 'label-was-attached')
|
46
|
-
(eq what 'release-published')
|
47
|
-
(eq what 'reward-for-bug-reported')
|
48
|
-
(eq what 'reward-for-resolved-bug')
|
49
|
-
(eq what 'tag-was-created'))))
|
50
|
-
|
51
32
|
(explain (when
|
52
33
|
(exists what)
|
53
34
|
(matches what "^[a-z]+(-[a-z]+)*$")))
|
@@ -56,7 +37,7 @@
|
|
56
37
|
(exists details)
|
57
38
|
(and
|
58
39
|
(not (matches details " "))
|
59
|
-
(not (matches details "^.{,
|
40
|
+
(not (matches details "^.{,80}$"))
|
60
41
|
(not (matches details "[^.]$")))))
|
61
42
|
|
62
43
|
(explain (when
|
@@ -68,6 +49,9 @@
|
|
68
49
|
(explain (when
|
69
50
|
(exists _version)
|
70
51
|
(eq "String" (type _version))))
|
52
|
+
(explain (when
|
53
|
+
(exists why)
|
54
|
+
(eq "String" (type why))))
|
71
55
|
(explain (when
|
72
56
|
(exists issue)
|
73
57
|
(and
|
@@ -75,13 +59,14 @@
|
|
75
59
|
(gt issue 0))))
|
76
60
|
(explain (when
|
77
61
|
(exists repository)
|
78
|
-
(
|
62
|
+
(and
|
63
|
+
(eq "Integer" (type repository))
|
64
|
+
(gt repository 0))))
|
79
65
|
(explain (when
|
80
66
|
(exists who)
|
81
|
-
(
|
82
|
-
(
|
83
|
-
|
84
|
-
(eq "Integer" (type award))))
|
67
|
+
(and
|
68
|
+
(eq "Integer" (type who))
|
69
|
+
(gt who 0))))
|
85
70
|
|
86
71
|
(explain (when
|
87
72
|
(exists when)
|
@@ -94,9 +79,10 @@
|
|
94
79
|
(explain (when
|
95
80
|
(exists award)
|
96
81
|
(and
|
82
|
+
(eq "Integer" (type award))
|
97
83
|
(exists when)
|
98
84
|
(exists who)
|
99
|
-
(exists
|
85
|
+
(exists why))))
|
100
86
|
|
101
87
|
(explain (when
|
102
88
|
(eq what 'events-were-scanned')
|
@@ -104,55 +90,3 @@
|
|
104
90
|
(exists repository)
|
105
91
|
(exists latest)
|
106
92
|
(eq "Integer" (type latest)))))
|
107
|
-
|
108
|
-
(explain (when
|
109
|
-
(eq what 'label-was-attached')
|
110
|
-
(and
|
111
|
-
(exists issue)
|
112
|
-
(exists label)
|
113
|
-
(eq "String" (type label)))))
|
114
|
-
|
115
|
-
(explain (when
|
116
|
-
(eq what 'issue-was-opened')
|
117
|
-
(and
|
118
|
-
(exists issue)
|
119
|
-
(exists when)
|
120
|
-
(exists who))))
|
121
|
-
|
122
|
-
(explain (when
|
123
|
-
(eq what 'issue-was-closed')
|
124
|
-
(and
|
125
|
-
(exists issue)
|
126
|
-
(exists when)
|
127
|
-
(exists who))))
|
128
|
-
|
129
|
-
(explain (when
|
130
|
-
(eq what 'bug-was-resolved')
|
131
|
-
(and
|
132
|
-
(exists cause)
|
133
|
-
(exists when)
|
134
|
-
(exists issue)
|
135
|
-
(exists details)
|
136
|
-
(exists who))))
|
137
|
-
|
138
|
-
(explain (when
|
139
|
-
(eq what 'bug-was-accepted')
|
140
|
-
(and
|
141
|
-
(exists cause)
|
142
|
-
(exists when)
|
143
|
-
(exists issue)
|
144
|
-
(exists details)
|
145
|
-
(exists reporter)
|
146
|
-
(eq "Integer" (type reporter))
|
147
|
-
(exists who))))
|
148
|
-
|
149
|
-
(explain (when
|
150
|
-
(eq what 'bug-report-was-rewarded')
|
151
|
-
(and
|
152
|
-
(exists cause)
|
153
|
-
(exists award)
|
154
|
-
(eq "Integer" (type award))
|
155
|
-
(exists when)
|
156
|
-
(exists issue)
|
157
|
-
(exists repository))))
|
158
|
-
|
data/test/fbe/test_conclude.rb
CHANGED
data/test/fbe/test_octo.rb
CHANGED
@@ -39,6 +39,13 @@ class TestOcto < Minitest::Test
|
|
39
39
|
assert(!o.off_quota)
|
40
40
|
end
|
41
41
|
|
42
|
+
def test_post_comment
|
43
|
+
global = {}
|
44
|
+
options = Judges::Options.new({ 'testing' => true })
|
45
|
+
o = Fbe.octo(loog: Loog::NULL, global:, options:)
|
46
|
+
assert_equal(42, o.add_comment('foo/foo', 4, 'hello!')[:id])
|
47
|
+
end
|
48
|
+
|
42
49
|
def test_rate_limit
|
43
50
|
o = Fbe::FakeOctokit.new
|
44
51
|
assert_equal(100, o.rate_limit.remaining)
|
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.
|
4
|
+
version: 0.0.4
|
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-
|
11
|
+
date: 2024-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: backtrace
|
@@ -156,14 +156,14 @@ dependencies:
|
|
156
156
|
requirements:
|
157
157
|
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: 9.1
|
159
|
+
version: '9.1'
|
160
160
|
type: :runtime
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version: 9.1
|
166
|
+
version: '9.1'
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: others
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|