judges 0.0.11 → 0.0.13

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: a3b228cb0e22d71082da253b074c34367a2bd25f2b8eaa94f18941f976161b30
4
- data.tar.gz: 4f5296d0a6827f40e4b72e8dbf4485c7c945fcb6bff57a413b303924580019b1
3
+ metadata.gz: f1b1028f7e8d932c33c2f0c761ede5fa5478a913d2292f56a70fe7ff0e8902aa
4
+ data.tar.gz: 0a48c55211f32ce7825a72f67c6c6f3757a3bdc6cf9067b1375712b6e5a3aba6
5
5
  SHA512:
6
- metadata.gz: 7efa088162e4d2b94a4776886a17fc2d9ad144aa9cb470c3ca0b58cb5ba22fe01b6d18d5dd38bbb0a914376fe0e908fa2105dad94a58bb48b3235fb503162816
7
- data.tar.gz: ddfa2405cdb2c3deb91365fc4f04b44add319615b71081476655d4539c3838eb65ec9d9b842250f737ea8f3376df8bc87c87553f973bedab489e6ee3a5721ec9
6
+ metadata.gz: e497c35fb9aee490a9c85c911a195414c3ad17a60b60b0b4be0851b6b68a857f879fe66e16b0603db26c8ee0a85af910a15b919e89b997935de5118f288ca180
7
+ data.tar.gz: 6894d6010bbbf1f99de4c721821a6d449ca4a15fed9602751b9fa857865c37d730014e9cca48460357c2e8754873077876ca7983ef013c93f78428d77b50ff49
data/bin/judges CHANGED
@@ -35,7 +35,7 @@ loog = Loog::REGULAR
35
35
 
36
36
  program_desc('Automated executor of judges for a factbase')
37
37
 
38
- version('0.0.11')
38
+ version('0.0.13')
39
39
 
40
40
  synopsis_format(:full)
41
41
 
@@ -61,6 +61,14 @@ command :update do |c|
61
61
  end
62
62
  end
63
63
 
64
+ desc 'Join two factbases'
65
+ command :print do |c|
66
+ c.action do |global, options, args|
67
+ require_relative '../lib/judges/commands/join'
68
+ Judges::Join.new(loog).run(options, args)
69
+ end
70
+ end
71
+
64
72
  desc 'Print the factbase into a human-readable format (YAML, JSON, etc.)'
65
73
  command :print do |c|
66
74
  c.desc 'Output format (xml, json, or yaml)'
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.0.11'
29
+ s.version = '0.0.13'
30
30
  s.license = 'MIT'
31
31
  s.summary = 'Command-Line Tool for a Factbase'
32
32
  s.description = '
@@ -41,7 +41,8 @@ Gem::Specification.new do |s|
41
41
  s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
42
42
  s.rdoc_options = ['--charset=UTF-8']
43
43
  s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
44
- s.add_runtime_dependency 'factbase', '~>0.0.11'
44
+ s.add_runtime_dependency 'backtrace', '~> 0.3'
45
+ s.add_runtime_dependency 'factbase', '~>0.0.12'
45
46
  s.add_runtime_dependency 'gli', '~>2.21'
46
47
  s.add_runtime_dependency 'loog', '~>0.2'
47
48
  s.add_runtime_dependency 'nokogiri', '~> 1.10'
@@ -0,0 +1,53 @@
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 'factbase'
24
+ require 'fileutils'
25
+ require_relative '../../judges'
26
+ require_relative '../../judges/to_rel'
27
+ require_relative '../../judges/packs'
28
+ require_relative '../../judges/options'
29
+
30
+ # Join.
31
+ # Author:: Yegor Bugayenko (yegor256@gmail.com)
32
+ # Copyright:: Copyright (c) 2024 Yegor Bugayenko
33
+ # License:: MIT
34
+ class Judges::Join
35
+ def initialize(loog)
36
+ @loog = loog
37
+ end
38
+
39
+ def run(_opts, args)
40
+ raise 'Exactly two arguments required' unless args.size == 2
41
+ master = args[0]
42
+ raise "The master factbase is absent: #{master.to_rel}" unless File.exist?(master)
43
+ slave = args[1]
44
+ raise "The slave factbase is absent: #{slave.to_rel}" unless File.exist?(slave)
45
+ fb = Factbase.new
46
+ fb.import(File.read(master))
47
+ @loog.info("Master factbase imported from #{master.to_rel} (#{File.size(master)} bytes)")
48
+ fb.import(File.read(slave))
49
+ @loog.info("Slave factbase imported from #{slave.to_rel} (#{File.size(slave)} bytes)")
50
+ File.write(master, fb.export)
51
+ @loog.info("Master factbase exported to #{master.to_rel} (#{File.size(master)} bytes)")
52
+ end
53
+ end
@@ -23,6 +23,7 @@
23
23
  require 'fileutils'
24
24
  require 'factbase'
25
25
  require_relative '../../judges'
26
+ require_relative '../../judges/to_rel'
26
27
  require_relative '../../judges/packs'
27
28
 
28
29
  # Update.
@@ -37,7 +38,7 @@ class Judges::Print
37
38
  def run(opts, args)
38
39
  raise 'At lease one argument required' if args.empty?
39
40
  f = args[0]
40
- raise "The file is absent: #{f}" unless File.exist?(f)
41
+ raise "The file is absent: #{f.to_rel}" unless File.exist?(f)
41
42
  o = args[1]
42
43
  if o.nil?
43
44
  raise 'Either provide output file name or use --auto' unless opts[:auto]
@@ -46,7 +47,7 @@ class Judges::Print
46
47
  end
47
48
  fb = Factbase.new
48
49
  fb.import(File.read(f))
49
- @loog.info("Factbase imported from #{f} (#{File.size(f)} bytes)")
50
+ @loog.info("Factbase imported from #{f.to_rel} (#{File.size(f)} bytes)")
50
51
  FileUtils.mkdir_p(File.dirname(o))
51
52
  output =
52
53
  case opts[:format].downcase
@@ -58,6 +59,6 @@ class Judges::Print
58
59
  fb.to_xml
59
60
  end
60
61
  File.write(o, output)
61
- @loog.info("Factbase printed to #{o} (#{File.size(o)} bytes)")
62
+ @loog.info("Factbase printed to #{o.to_rel} (#{File.size(o)} bytes)")
62
63
  end
63
64
  end
@@ -22,7 +22,9 @@
22
22
 
23
23
  require 'nokogiri'
24
24
  require 'factbase'
25
+ require 'backtrace'
25
26
  require_relative '../../judges'
27
+ require_relative '../../judges/to_rel'
26
28
  require_relative '../../judges/packs'
27
29
  require_relative '../../judges/options'
28
30
 
@@ -38,15 +40,27 @@ class Judges::Test
38
40
  def run(_opts, args)
39
41
  raise 'Exactly one argument required' unless args.size == 1
40
42
  dir = args[0]
41
- @loog.info("Testing judges in #{dir}...")
43
+ @loog.info("Testing judges in #{dir.to_rel}...")
44
+ errors = []
42
45
  done = Judges::Packs.new(dir, @loog).each_with_index do |p, i|
43
- @loog.info("Testing #{p.script} in #{p.dir}...")
44
- p.tests.each do |t|
45
- test_one(p, t)
46
+ @loog.info("\n👉 Testing #{p.script} (##{i}) in #{p.dir.to_rel}...")
47
+ p.tests.each do |f|
48
+ yaml = YAML.load_file(f, permitted_classes: [Time])
49
+ @loog.info("Testing #{f.to_rel}:")
50
+ begin
51
+ test_one(p, yaml)
52
+ rescue StandardError => e
53
+ @loog.warn(Backtrace.new(e))
54
+ errors << f
55
+ end
46
56
  end
47
- @loog.info("Pack ##{i} found in #{p.dir}")
48
57
  end
49
- @loog.info("#{done} judges tested")
58
+ if errors.empty?
59
+ @loog.info("\nAll #{done} judges tested successfully")
60
+ else
61
+ @loog.info("\n#{done} judges tested, #{errors.size} of them failed")
62
+ raise "#{errors.size} tests failed" unless errors.empty?
63
+ end
50
64
  end
51
65
 
52
66
  private
@@ -22,7 +22,9 @@
22
22
 
23
23
  require 'factbase'
24
24
  require 'fileutils'
25
+ require 'backtrace'
25
26
  require_relative '../../judges'
27
+ require_relative '../../judges/to_rel'
26
28
  require_relative '../../judges/packs'
27
29
  require_relative '../../judges/options'
28
30
 
@@ -43,17 +45,26 @@ class Judges::Update
43
45
  fb = Factbase.new
44
46
  if File.exist?(file)
45
47
  fb.import(File.read(file))
46
- @loog.info("Factbase imported from #{file} (#{File.size(file)} bytes)")
48
+ @loog.info("Factbase imported from #{file.to_rel} (#{File.size(file)} bytes)")
47
49
  else
48
- @loog.info("There is no Factbase to import from #{file}")
50
+ @loog.info("There is no Factbase to import from #{file.to_rel} (file is absent)")
49
51
  end
52
+ options = Judges::Options.new(opts['option'])
53
+ @loog.debug("The following options provided:\n\t#{options.to_s.gsub("\n", "\n\t")}")
54
+ errors = []
50
55
  done = Judges::Packs.new(dir, @loog).each_with_index do |p, i|
51
- @loog.info("Pack ##{i} found in #{p.dir}")
52
- p.run(fb, Judges::Options.new(opts['options']))
56
+ @loog.info("Pack ##{i} found in #{p.dir.to_rel}")
57
+ begin
58
+ p.run(fb, options)
59
+ rescue StandardError => e
60
+ @loog.warn(Backtrace.new(e))
61
+ errors << p.script
62
+ end
53
63
  end
54
- @loog.info("#{done} judges processed")
64
+ @loog.info("#{done} judges processed (#{errors.size} errors)")
55
65
  FileUtils.mkdir_p(File.dirname(file))
56
66
  File.write(file, fb.export)
57
- @loog.info("Factbase exported to #{file} (#{File.size(file)} bytes)")
67
+ @loog.info("Factbase exported to #{file.to_rel} (#{File.size(file)} bytes)")
68
+ raise "Failed to update correctly (#{errors.size} errors)" unless errors.empty?
58
69
  end
59
70
  end
@@ -22,26 +22,40 @@
22
22
 
23
23
  require_relative '../judges'
24
24
 
25
- # Options for ruby scripts.
25
+ # Options for Ruby scripts in the judges.
26
26
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
27
27
  # Copyright:: Copyright (c) 2024 Yegor Bugayenko
28
28
  # License:: MIT
29
29
  class Judges::Options
30
30
  # Ctor.
31
- # @param [Array<String>] List of pairs, like ["token=af73cd3", "max_speed=1"]
31
+ # @param pairs [Array<String>] List of pairs, like ["token=af73cd3", "max_speed=1"]
32
32
  def initialize(pairs)
33
33
  @pairs = pairs
34
34
  end
35
35
 
36
+ # Convert them all to a string (printable in a log).
37
+ def to_s
38
+ touch # this will trigger method_missing() method, which will create @hash
39
+ @hash.map do |k, v|
40
+ v = v.to_s
41
+ v = "#{v[0..3]}#{'*' * (v.length - 4)}" if v.length > 8
42
+ "#{k}=#{v}"
43
+ end.join("\n")
44
+ end
45
+
36
46
  # Get option by name.
37
47
  def method_missing(*args)
38
- @hash ||= (if @pairs.nil?
39
- []
40
- else
41
- (@pairs.is_a?(Hash) ? @pairs.map { |k, v| "#{k}=#{v}" } : @pairs)
42
- end).to_h do |pair|
43
- p = pair.split('=', 2)
44
- [p[0].to_sym, p[1].match?(/^[0-9]+$/) ? p[1].to_i : p[1]]
48
+ @hash ||= begin
49
+ pp = @pairs || []
50
+ pp = @pairs.map { |k, v| "#{k}=#{v}" } if pp.is_a?(Hash)
51
+ pp = pp.split(',') if pp.is_a?(String)
52
+ pp.to_h do |pair|
53
+ p = pair.split('=', 2)
54
+ k = p[0].strip
55
+ v = p[1]
56
+ v = v.nil? ? 'true' : v.strip
57
+ [k.to_sym, v.match?(/^[0-9]+$/) ? v.to_i : v]
58
+ end
45
59
  end
46
60
  k = args[0].downcase
47
61
  @hash[k]
data/lib/judges/pack.rb CHANGED
@@ -46,7 +46,7 @@ class Judges::Pack
46
46
  s = File.join(@dir, script)
47
47
  raise "Can't load '#{s}'" unless File.exist?(s)
48
48
  begin
49
- load s
49
+ load(s, true)
50
50
  ensure
51
51
  $fb = $judge = $options = $loog = nil
52
52
  end
@@ -57,10 +57,8 @@ class Judges::Pack
57
57
  File.basename(Dir.glob(File.join(@dir, '*.rb')).first)
58
58
  end
59
59
 
60
- # Iterate over .yml tests.
60
+ # Return all .yml tests files.
61
61
  def tests
62
- Dir.glob(File.join(@dir, '*.yml')).map do |f|
63
- YAML.load_file(f, permitted_classes: [Time])
64
- end
62
+ Dir.glob(File.join(@dir, '*.yml'))
65
63
  end
66
64
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2024 Yegor Bugayenko
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -17,31 +19,24 @@
17
19
  # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
21
  # SOFTWARE.
20
- ---
21
- name: zerocracy
22
- on:
23
- push:
24
- # schedule:
25
- # - cron: '0,10,20,30,50,50 * * * *'
26
- concurrency:
27
- group: zerocracy
28
- cancel-in-progress: true
29
- jobs:
30
- zerocracy:
31
- runs-on: ubuntu-22.04
32
- steps:
33
- - uses: actions/checkout@v4
34
- - uses: actions/cache@v4
35
- with:
36
- path: recent.fb
37
- key: judges
38
- restore-keys: judges
39
- - uses: zerocracy/judges-action@master
40
- with:
41
- factbase: recent.fb
42
- - run: mkdir gh-pages && cp recent.yaml gh-pages
43
- - uses: JamesIves/github-pages-deploy-action@v4.6.0
44
- with:
45
- branch: gh-pages
46
- folder: gh-pages
47
- clean: false
22
+
23
+ require 'pathname'
24
+
25
+ # Adding method +to_rel+ to all Ruby objects.
26
+ # Author:: Yegor Bugayenko (yegor256@gmail.com)
27
+ # Copyright:: Copyright (c) 2024 Yegor Bugayenko
28
+ # License:: MIT
29
+ class Object
30
+ # Generates a relative name of a file (to the current dir).
31
+ def to_rel
32
+ s = File.absolute_path(to_s)
33
+ p = Pathname.new(s).relative_path_from(Dir.getwd)
34
+ t = p.to_s
35
+ t = "\"#{t}\"" if t.include?(' ')
36
+ if p.directory?
37
+ "#{t}/"
38
+ else
39
+ t
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,52 @@
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
+ require 'loog'
25
+ require 'nokogiri'
26
+ require_relative '../../lib/judges'
27
+ require_relative '../../lib/judges/commands/join'
28
+
29
+ # Test.
30
+ # Author:: Yegor Bugayenko (yegor256@gmail.com)
31
+ # Copyright:: Copyright (c) 2024 Yegor Bugayenko
32
+ # License:: MIT
33
+ class TestJoin < Minitest::Test
34
+ def test_simple_join
35
+ Dir.mktmpdir do |d|
36
+ master = File.join(d, 'master.fb')
37
+ fb1 = Factbase.new
38
+ fb1.insert.zz = 5
39
+ File.write(master, fb1.export)
40
+ slave = File.join(d, 'slave.fb')
41
+ fb2 = Factbase.new
42
+ fb2.insert.foo_bar = 42
43
+ File.write(slave, fb2.export)
44
+ Judges::Join.new(Loog::VERBOSE).run({}, [master, slave])
45
+ fb = Factbase.new
46
+ fb.import(File.read(master))
47
+ xml = Nokogiri::XML.parse(fb.to_xml)
48
+ assert(!xml.xpath('/fb/f[zz="5"]').empty?, fb.to_xml)
49
+ assert(!xml.xpath('/fb/f[foo_bar="42"]').empty?, fb.to_xml)
50
+ end
51
+ end
52
+ end
@@ -31,15 +31,31 @@ require_relative '../../lib/judges/commands/update'
31
31
  # Copyright:: Copyright (c) 2024 Yegor Bugayenko
32
32
  # License:: MIT
33
33
  class TestUpdate < Minitest::Test
34
- def test_simple_update
34
+ def test_build_factbase_from_scratch
35
35
  Dir.mktmpdir do |d|
36
- File.write(File.join(d, 'foo.rb'), '$fb.insert.zzz = $options.bar + 1')
36
+ File.write(File.join(d, 'foo.rb'), '$fb.insert.zzz = $options.foo_bar + 1')
37
37
  file = File.join(d, 'base.fb')
38
- Judges::Update.new(Loog::VERBOSE).run({ 'options' => ['bar=42'] }, [d, file])
38
+ Judges::Update.new(Loog::VERBOSE).run({ 'option' => ['foo_bar=42'] }, [d, file])
39
39
  fb = Factbase.new
40
40
  fb.import(File.read(file))
41
41
  xml = Nokogiri::XML.parse(fb.to_xml)
42
42
  assert(!xml.xpath('/fb/f[zzz="43"]').empty?)
43
43
  end
44
44
  end
45
+
46
+ def test_extend_existing_factbase
47
+ Dir.mktmpdir do |d|
48
+ file = File.join(d, 'base.fb')
49
+ fb = Factbase.new
50
+ fb.insert.foo_bar = 42
51
+ File.write(file, fb.export)
52
+ File.write(File.join(d, 'foo.rb'), '$fb.insert.tt = 4')
53
+ Judges::Update.new(Loog::VERBOSE).run({}, [d, file])
54
+ fb = Factbase.new
55
+ fb.import(File.read(file))
56
+ xml = Nokogiri::XML.parse(fb.to_xml)
57
+ assert(!xml.xpath('/fb/f[tt="4"]').empty?)
58
+ assert(!xml.xpath('/fb/f[foo_bar="42"]').empty?)
59
+ end
60
+ end
45
61
  end
data/test/test_options.rb CHANGED
@@ -35,13 +35,32 @@ class TestOptions < Minitest::Test
35
35
  assert_equal(42, opts.max)
36
36
  end
37
37
 
38
+ def test_stips_spaces
39
+ opts = Judges::Options.new([' token=a77 ', 'max = 42'])
40
+ assert_equal('a77', opts.token)
41
+ assert_equal(42, opts.max)
42
+ end
43
+
38
44
  def test_with_nil
39
45
  opts = Judges::Options.new(nil)
40
46
  assert(opts.foo.nil?)
41
47
  end
42
48
 
49
+ def test_with_string
50
+ opts = Judges::Options.new('a=1,b=42')
51
+ assert_equal(1, opts.a)
52
+ assert_equal(42, opts.b)
53
+ end
54
+
43
55
  def test_with_hash
44
- opts = Judges::Options.new('foo' => 42)
56
+ opts = Judges::Options.new('foo' => 42, 'bar' => 'hello')
45
57
  assert_equal(42, opts.foo)
58
+ assert_equal('hello', opts.bar)
59
+ assert(opts.xxx.nil?)
60
+ end
61
+
62
+ def test_converts_to_string
63
+ opts = Judges::Options.new('foo' => 44, 'bar' => 'long-string-maybe-secret')
64
+ assert_equal("foo=44\nbar=long********************", opts.to_s)
46
65
  end
47
66
  end
data/test/test_packs.rb CHANGED
@@ -39,7 +39,7 @@ class TestPacks < Minitest::Test
39
39
  Judges::Packs.new(d, Loog::VERBOSE).each do |p|
40
40
  assert_equal('foo.rb', p.script)
41
41
  found += 1
42
- assert_equal(42, p.tests.first['foo'])
42
+ assert_equal('something.yml', File.basename(p.tests.first))
43
43
  end
44
44
  assert_equal(1, found)
45
45
  end
@@ -0,0 +1,41 @@
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
+ require_relative '../lib/judges'
25
+ require_relative '../lib/judges/to_rel'
26
+
27
+ # Test.
28
+ # Author:: Yegor Bugayenko (yegor256@gmail.com)
29
+ # Copyright:: Copyright (c) 2024 Yegor Bugayenko
30
+ # License:: MIT
31
+ class TestToRel < Minitest::Test
32
+ def test_simple_mapping
33
+ n = File.absolute_path(File.join('.', 'lib/../lib/commands/update.rb'))
34
+ assert_equal('lib/commands/update.rb', n.to_rel)
35
+ end
36
+
37
+ def test_maps_dir_name
38
+ n = File.absolute_path(File.join('.', 'lib/../lib/judges/commands'))
39
+ assert_equal('lib/judges/commands/', n.to_rel)
40
+ end
41
+ end
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.0.11
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
@@ -10,20 +10,34 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2024-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: backtrace
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.3'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.3'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: factbase
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
31
  - - "~>"
18
32
  - !ruby/object:Gem::Version
19
- version: 0.0.11
33
+ version: 0.0.12
20
34
  type: :runtime
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
38
  - - "~>"
25
39
  - !ruby/object:Gem::Version
26
- version: 0.0.11
40
+ version: 0.0.12
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: gli
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -87,7 +101,6 @@ files:
87
101
  - ".github/workflows/rake.yml"
88
102
  - ".github/workflows/xcop.yml"
89
103
  - ".github/workflows/yamllint.yml"
90
- - ".github/workflows/zerocracy.yml"
91
104
  - ".gitignore"
92
105
  - ".pdd"
93
106
  - ".rubocop.yml"
@@ -108,6 +121,7 @@ files:
108
121
  - fixtures/reward_for_good_bug/simple-reward.yml
109
122
  - judges.gemspec
110
123
  - lib/judges.rb
124
+ - lib/judges/commands/join.rb
111
125
  - lib/judges/commands/print.rb
112
126
  - lib/judges/commands/test.rb
113
127
  - lib/judges/commands/update.rb
@@ -115,7 +129,9 @@ files:
115
129
  - lib/judges/options.rb
116
130
  - lib/judges/pack.rb
117
131
  - lib/judges/packs.rb
132
+ - lib/judges/to_rel.rb
118
133
  - renovate.json
134
+ - test/commands/test_join.rb
119
135
  - test/commands/test_print.rb
120
136
  - test/commands/test_test.rb
121
137
  - test/commands/test_update.rb
@@ -125,6 +141,7 @@ files:
125
141
  - test/test_options.rb
126
142
  - test/test_pack.rb
127
143
  - test/test_packs.rb
144
+ - test/test_to_rel.rb
128
145
  homepage: http://github.com/yegor256/judges
129
146
  licenses:
130
147
  - MIT