judges 0.19.0 → 0.20.0

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: 5dc4d51701430ff754d2fb33b4938d6ad105f0d08590c875c88095b0992bab17
4
- data.tar.gz: 7b5b223a403e3d5d82128589a4838ac66b8518644e0c110e5a688e6139fa92d6
3
+ metadata.gz: 1661542d2bb953029d98b55aee247ee5067488e67e7fa4debd8a35d7278bce55
4
+ data.tar.gz: 79803f9f17983970b404abd8c8619e08ad3d5587156f4cedd477f295c98ab2bb
5
5
  SHA512:
6
- metadata.gz: 5a293823a64b90aa7edb793b4d9fc35c7e06d7012d70073e96a9080232d48b5c12ec0f0f1b20759412eb033a4921cbeef43129101050c784b90ecf11e55d4900
7
- data.tar.gz: 5cd0c89a797662738454256c960afa5edf46b77e6109157cb8d8d44c534a130a7dcd0522dfe5091c878f7e9f3c0a7e95c1f47c283696ba4cd0fb7e592e61d3de
6
+ metadata.gz: 60bc48ba4d2532ce4d7960d132a5bc59674794c6b8495ada4852ea83745cdd6cdf1064ff9f76440573c34564c73057a19306f55b23fdddd783bd240517f23099
7
+ data.tar.gz: 528812bef0c9f6ba6225210a1130cfd03aea5816eb7c75da99adf323aaf09932cb18d6c0e9e057096212e353b85bf551a65b3144ba86504ff2d1930cdc1dcdaa
data/Rakefile CHANGED
@@ -33,6 +33,8 @@ def version
33
33
  Gem::Specification.load(Dir['*.gemspec'].first).version
34
34
  end
35
35
 
36
+ ENV['RACK_ENV'] = 'test'
37
+
36
38
  task default: %i[clean test features rubocop yard copyright]
37
39
 
38
40
  require 'rake/testtask'
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 App.run(ARGV)
218
+ exit JudgesGLI.run(ARGV) if ENV['GLI_TESTING'].nil?
@@ -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.19.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.rb CHANGED
@@ -25,5 +25,5 @@
25
25
  # Copyright:: Copyright (c) 2024 Yegor Bugayenko
26
26
  # License:: MIT
27
27
  module Judges
28
- VERSION = '0.19.0'
28
+ VERSION = '0.20.0'
29
29
  end
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 TestPack < Minitest::Test
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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: judges
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.0
4
+ version: 0.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
@@ -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