judges 0.13.0 → 0.13.1

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: '098f6126af6c35b9ee74dca41bbfb5b8e6b1357aee5dcec215a2819929e859d5'
4
- data.tar.gz: 139a4b55ea82a090e385c4f54be682dd74d0922c66d77824c8d33cecaa799a84
3
+ metadata.gz: 0e42894e95397d8b62afd1deaf3407d31321475e378f4ebdfd88216571ff742d
4
+ data.tar.gz: d59aaa5f47aa2f7373b78e36869bc09aacd1c52f881c910c45d292407c3da203
5
5
  SHA512:
6
- metadata.gz: 0e173739bc5341c55f869375fef959ff9e6ca57c1e0b814a29d4920700f640fc788a948932221c9fbf6f9e7d9d90501e274645f3de213b7f9b3211549652ad1c
7
- data.tar.gz: 52f4c44351e5f3c9efb873913f26c8a7c2c5c08dbf490434145cc691968eec240ef95bb5007568b623c043f48ab658624a573664598df587282cb1cfb43ef94b
6
+ metadata.gz: 1be5c4aad65f212b8bc700616851356ccf331be5b51a1ccc1e2d9d71e2225c8f648d0604e4ae5b1957d4b0623d43b8de6e78da2a8b1ed5ecdbbbe6db9eba3fc4
7
+ data.tar.gz: 8174ac41e04c618635c868b06164b79939cc2891066bda8063f806f9395b8985a650eab5770fd778fe86ad7f42d8f9496f46331a3cff175d570f39d0af2e00a2
@@ -9,8 +9,8 @@ Feature: Update
9
9
  n.kind = 'yes!'
10
10
  """
11
11
  Then I run bin/judges with "--verbose update --quiet -o foo=1 -o bar=2 --max-cycles 3 . simple.fb"
12
- Then Stdout contains "foo → "
13
- Then Stdout contains "bar → "
12
+ Then Stdout contains "FOO → "
13
+ Then Stdout contains "BAR → "
14
14
  Then Stdout contains "1 judge(s) processed"
15
15
  Then Stdout contains "Update finished in 3 cycle(s), modified 3/0 fact(s)"
16
16
  And Exit code is zero
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.13.0'
29
+ s.version = '0.13.1'
30
30
  s.license = 'MIT'
31
31
  s.summary = 'Command-Line Tool for a Factbase'
32
32
  s.description =
@@ -47,7 +47,11 @@ class Judges::Update
47
47
  fb = impex.import(strict: false)
48
48
  fb = Factbase::Looged.new(fb, @loog) if opts['log']
49
49
  options = Judges::Options.new(opts['option'])
50
- @loog.debug("The following options provided:\n\t#{options.to_s.gsub("\n", "\n\t")}")
50
+ if options.empty?
51
+ @loog.debug('No options provided by the --option flag')
52
+ else
53
+ @loog.debug("The following options provided:\n\t#{options.to_s.gsub("\n", "\n\t")}")
54
+ end
51
55
  judges = Judges::Judges.new(dir, opts['lib'], @loog)
52
56
  c = 0
53
57
  churn = Judges::Churn.new(0, 0)
@@ -34,6 +34,11 @@ class Judges::Options
34
34
  @pairs = pairs
35
35
  end
36
36
 
37
+ def empty?
38
+ touch # this will trigger method_missing() method, which will create @hash
39
+ @hash.empty?
40
+ end
41
+
37
42
  def +(other)
38
43
  touch # this will trigger method_missing() method, which will create @hash
39
44
  h = @hash.dup
@@ -62,15 +67,16 @@ class Judges::Options
62
67
  pp = pp.split(',') if pp.is_a?(String)
63
68
  pp.compact!
64
69
  pp.reject!(&:empty?)
65
- pp.to_h do |pair|
70
+ pp.map! do |pair|
66
71
  p = pair.split('=', 2)
67
- k = p[0].strip
72
+ k = p[0].strip.upcase
68
73
  v = p[1]
69
74
  v = v.nil? ? 'true' : v.strip
70
75
  [k.to_sym, v.match?(/^[0-9]+$/) ? v.to_i : v]
71
76
  end
77
+ pp.reject { |p| p[0].empty? }.to_h
72
78
  end
73
- k = args[0].downcase
79
+ k = args[0].upcase
74
80
  @hash[k]
75
81
  end
76
82
  end
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.13.0'
28
+ VERSION = '0.13.1'
29
29
  end
data/test/test_options.rb CHANGED
@@ -41,19 +41,27 @@ class TestOptions < Minitest::Test
41
41
  assert_equal(42, opts.max)
42
42
  end
43
43
 
44
+ def test_case_insensitive
45
+ opts = Judges::Options.new(['aBcDeF=1', 'aBCDEf=2'])
46
+ assert_equal(2, opts.abcdef)
47
+ end
48
+
44
49
  def test_with_nil
45
50
  opts = Judges::Options.new(nil)
46
51
  assert(opts.foo.nil?)
52
+ assert(opts.empty?)
47
53
  end
48
54
 
49
55
  def test_with_empty_string
50
56
  opts = Judges::Options.new(' ')
51
57
  assert(opts.foo.nil?)
58
+ assert(opts.empty?)
52
59
  end
53
60
 
54
61
  def test_with_empty_strings
55
62
  opts = Judges::Options.new(['', nil])
56
63
  assert(opts.foo.nil?)
64
+ assert(opts.empty?)
57
65
  end
58
66
 
59
67
  def test_with_string
@@ -72,7 +80,7 @@ class TestOptions < Minitest::Test
72
80
  def test_converts_to_string
73
81
  opts = Judges::Options.new('foo' => 44, 'bar' => 'long-string-maybe-secret')
74
82
  s = opts.to_s
75
- assert(s.include?('foo → "44"'))
83
+ assert(s.include?('FOO → "44"'))
76
84
  assert(s.include?('"long********************"'))
77
85
  end
78
86
 
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.13.0
4
+ version: 0.13.1
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-06-26 00:00:00.000000000 Z
11
+ date: 2024-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backtrace