judges 0.18.1 → 0.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +9 -9
- data/Rakefile +2 -0
- data/bin/judges +6 -3
- data/features/update.feature +14 -0
- data/judges.gemspec +1 -1
- data/lib/judges/judge.rb +1 -0
- data/lib/judges.rb +1 -1
- data/test/test_bin.rb +43 -0
- data/test/test_judge.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1661542d2bb953029d98b55aee247ee5067488e67e7fa4debd8a35d7278bce55
|
4
|
+
data.tar.gz: 79803f9f17983970b404abd8c8619e08ad3d5587156f4cedd477f295c98ab2bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60bc48ba4d2532ce4d7960d132a5bc59674794c6b8495ada4852ea83745cdd6cdf1064ff9f76440573c34564c73057a19306f55b23fdddd783bd240517f23099
|
7
|
+
data.tar.gz: 528812bef0c9f6ba6225210a1130cfd03aea5816eb7c75da99adf323aaf09932cb18d6c0e9e057096212e353b85bf551a65b3144ba86504ff2d1930cdc1dcdaa
|
data/Gemfile.lock
CHANGED
@@ -79,7 +79,7 @@ GEM
|
|
79
79
|
bigdecimal
|
80
80
|
cucumber-gherkin (27.0.0)
|
81
81
|
cucumber-messages (>= 19.1.4, < 23)
|
82
|
-
cucumber-html-formatter (21.4.
|
82
|
+
cucumber-html-formatter (21.4.1)
|
83
83
|
cucumber-messages (> 19, < 25)
|
84
84
|
cucumber-messages (22.0.0)
|
85
85
|
cucumber-tag-expressions (6.1.0)
|
@@ -90,14 +90,14 @@ GEM
|
|
90
90
|
erubi (1.13.0)
|
91
91
|
ethon (0.16.0)
|
92
92
|
ffi (>= 1.15.0)
|
93
|
-
factbase (0.0
|
94
|
-
backtrace (
|
95
|
-
decoor (
|
93
|
+
factbase (0.2.0)
|
94
|
+
backtrace (> 0)
|
95
|
+
decoor (> 0)
|
96
96
|
json (~> 2.7)
|
97
|
-
loog (
|
97
|
+
loog (> 0)
|
98
98
|
nokogiri (~> 1.10)
|
99
|
-
others (
|
100
|
-
tago (
|
99
|
+
others (> 0)
|
100
|
+
tago (> 0)
|
101
101
|
yaml (~> 0.3)
|
102
102
|
ffi (1.17.0-aarch64-linux-gnu)
|
103
103
|
ffi (1.17.0-arm-linux-gnu)
|
@@ -106,7 +106,7 @@ GEM
|
|
106
106
|
ffi (1.17.0-x86-linux-gnu)
|
107
107
|
ffi (1.17.0-x86_64-darwin)
|
108
108
|
ffi (1.17.0-x86_64-linux-gnu)
|
109
|
-
gli (2.21.
|
109
|
+
gli (2.21.5)
|
110
110
|
hashdiff (1.1.0)
|
111
111
|
i18n (1.14.5)
|
112
112
|
concurrent-ruby (~> 1.0)
|
@@ -187,7 +187,7 @@ GEM
|
|
187
187
|
reline (0.5.9)
|
188
188
|
io-console (~> 0.5)
|
189
189
|
retries (0.0.5)
|
190
|
-
rexml (3.3.
|
190
|
+
rexml (3.3.2)
|
191
191
|
strscan
|
192
192
|
rspec-core (3.13.0)
|
193
193
|
rspec-support (~> 3.13.0)
|
data/Rakefile
CHANGED
data/bin/judges
CHANGED
@@ -24,13 +24,13 @@ $stdout.sync = true
|
|
24
24
|
|
25
25
|
require 'gli'
|
26
26
|
require 'loog'
|
27
|
+
require 'time'
|
27
28
|
require 'factbase'
|
28
29
|
|
29
30
|
Encoding.default_external = Encoding::UTF_8
|
30
31
|
Encoding.default_internal = Encoding::UTF_8
|
31
32
|
|
32
|
-
class App
|
33
|
-
extend GLI::App
|
33
|
+
class JudgesGLI extend GLI::App
|
34
34
|
|
35
35
|
loog = Loog::REGULAR
|
36
36
|
|
@@ -52,6 +52,9 @@ class App
|
|
52
52
|
end
|
53
53
|
loog.debug("Judges #{Judges::VERSION}")
|
54
54
|
loog.debug("Factbase #{Factbase::VERSION}")
|
55
|
+
loog.debug("Ruby: #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}")
|
56
|
+
loog.debug("Current directory: #{Dir.getwd}")
|
57
|
+
loog.debug("Time: #{Time.now.utc.iso8601}")
|
55
58
|
true
|
56
59
|
end
|
57
60
|
|
@@ -212,4 +215,4 @@ class App
|
|
212
215
|
end
|
213
216
|
end
|
214
217
|
|
215
|
-
exit
|
218
|
+
exit JudgesGLI.run(ARGV) if ENV['GLI_TESTING'].nil?
|
data/features/update.feature
CHANGED
@@ -52,3 +52,17 @@ Feature: Update
|
|
52
52
|
Then I run bin/judges with "update mine simple.fb"
|
53
53
|
Then Stdout contains "Failed to update correctly"
|
54
54
|
And Exit code is not zero
|
55
|
+
|
56
|
+
Scenario: Avoid duplicate insert on error in the middle
|
57
|
+
Given I make a temp directory
|
58
|
+
Then I have a "mine/foo/foo.rb" file with content:
|
59
|
+
"""
|
60
|
+
return unless $fb.query('(eq foo 42)').each.to_a.empty?
|
61
|
+
f = $fb.insert
|
62
|
+
f.foo = 42
|
63
|
+
raise 'intentional'
|
64
|
+
"""
|
65
|
+
Then I run bin/judges with "update --quiet --max-cycles=3 mine simple.fb"
|
66
|
+
And Exit code is zero
|
67
|
+
Then I run bin/judges with "inspect simple.fb"
|
68
|
+
Then Stdout contains "Facts: 1"
|
data/judges.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
27
27
|
s.required_ruby_version = '>=3.2'
|
28
28
|
s.name = 'judges'
|
29
|
-
s.version = '0.
|
29
|
+
s.version = '0.20.0'
|
30
30
|
s.license = 'MIT'
|
31
31
|
s.summary = 'Command-Line Tool for a Factbase'
|
32
32
|
s.description =
|
data/lib/judges/judge.rb
CHANGED
@@ -46,6 +46,7 @@ class Judges::Judge
|
|
46
46
|
$global = global
|
47
47
|
$local = local
|
48
48
|
$valve = FakeValve.new unless defined?($valve)
|
49
|
+
options.to_h.each { |k, v| ENV.store(k.to_s, v.to_s) }
|
49
50
|
unless @lib.nil?
|
50
51
|
raise "Lib dir #{@lib.to_rel} is absent" unless File.exist?(@lib)
|
51
52
|
raise "Lib #{@lib.to_rel} is not a directory" unless File.directory?(@lib)
|
data/lib/judges.rb
CHANGED
data/test/test_bin.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright (c) 2024 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
require 'minitest/autorun'
|
24
|
+
|
25
|
+
# Test.
|
26
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
27
|
+
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
28
|
+
# License:: MIT
|
29
|
+
class TestBin < Minitest::Test
|
30
|
+
def test_simple_run
|
31
|
+
ENV.store('GLI_TESTING', 'yes')
|
32
|
+
load File.join(__dir__, '../bin/judges')
|
33
|
+
before = $stdout
|
34
|
+
begin
|
35
|
+
$stdout = StringIO.new
|
36
|
+
JudgesGLI.run(['--version'])
|
37
|
+
s = $stdout.string
|
38
|
+
ensure
|
39
|
+
$stdout = before
|
40
|
+
end
|
41
|
+
assert(s.include?(Judges::VERSION), s)
|
42
|
+
end
|
43
|
+
end
|
data/test/test_judge.rb
CHANGED
@@ -31,7 +31,7 @@ require_relative '../lib/judges/judge'
|
|
31
31
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
32
32
|
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
33
33
|
# License:: MIT
|
34
|
-
class
|
34
|
+
class TestJudge < Minitest::Test
|
35
35
|
def test_basic_run
|
36
36
|
Dir.mktmpdir do |d|
|
37
37
|
File.write(File.join(d, 'foo.rb'), '$fb.insert')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: judges
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.20.0
|
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-07-
|
11
|
+
date: 2024-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: backtrace
|
@@ -263,6 +263,7 @@ files:
|
|
263
263
|
- test/commands/test_update.rb
|
264
264
|
- test/test__helper.rb
|
265
265
|
- test/test_baza.rb
|
266
|
+
- test/test_bin.rb
|
266
267
|
- test/test_categories.rb
|
267
268
|
- test/test_churn.rb
|
268
269
|
- test/test_impex.rb
|