judges 0.38.0 → 0.38.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/judges.gemspec +1 -1
- data/lib/judges/judge.rb +6 -0
- data/lib/judges/judges.rb +8 -3
- data/lib/judges.rb +1 -1
- data/test/test_judges.rb +17 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 353058d96072ebe04e9e5f71c51be5905e113e6af9406eb8ad1c05eb61b72921
|
4
|
+
data.tar.gz: 04df0fe98d3933ca745928b3cf4802145393b2ea734635d0dff2ba1c96e96213
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec6197e9fb2109bce6adf440aa3b770b0e8bc09117c8002f7e1c931f7759d6127161bba8d91e2cd8602ca98fb94309e8aec1a6f3fb7621898193510b3e1cafb6
|
7
|
+
data.tar.gz: 391300ee4ddfe82e9f967cea2b43f05db42439540ebf3a45a784f286df8eeb8adcb25548c614567320ac7fa674d3878dd3c565967e7b4a6d1d66f2d9645e2dbb
|
data/judges.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
10
10
|
s.required_ruby_version = '>=3.2'
|
11
11
|
s.name = 'judges'
|
12
|
-
s.version = '0.38.
|
12
|
+
s.version = '0.38.1'
|
13
13
|
s.license = 'MIT'
|
14
14
|
s.summary = 'Command-Line Tool for a Factbase'
|
15
15
|
s.description =
|
data/lib/judges/judge.rb
CHANGED
data/lib/judges/judges.rb
CHANGED
@@ -57,13 +57,18 @@ class Judges::Judges
|
|
57
57
|
list.sort_by!(&:name)
|
58
58
|
all = list.each_with_index.to_a
|
59
59
|
good = all.dup
|
60
|
-
|
61
|
-
|
60
|
+
mapping = all
|
61
|
+
.map { |a| [a[0].name, a[1], a[1]] }
|
62
|
+
.reject { |a| a[0].start_with?(@shuffle) }
|
63
|
+
.to_h { |a| [a[1], a[2]] }
|
64
|
+
positions = mapping.values.shuffle
|
65
|
+
mapping.keys.zip(positions).to_h.each do |before, after|
|
66
|
+
good[after] = all[before]
|
62
67
|
end
|
63
68
|
good.map { |a| a[0] }.each(&)
|
64
69
|
end
|
65
70
|
|
66
|
-
# Iterate over them all.
|
71
|
+
# Iterate over them all, with an index.
|
67
72
|
# @yield [(Judge, Integer)]
|
68
73
|
def each_with_index
|
69
74
|
idx = 0
|
data/lib/judges.rb
CHANGED
data/test/test_judges.rb
CHANGED
@@ -45,6 +45,23 @@ class TestJudges < Minitest::Test
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
+
def test_keeps_them_all
|
49
|
+
colors = %w[blue orange yellow black white pink magenta]
|
50
|
+
['', 'b', 'ye'].each do |pfx|
|
51
|
+
Dir.mktmpdir do |d|
|
52
|
+
names = colors.sort
|
53
|
+
names.each do |n|
|
54
|
+
dir = File.join(d, n)
|
55
|
+
save_it(File.join(dir, "#{n}.rb"), 'puts 1')
|
56
|
+
end
|
57
|
+
after = Judges::Judges.new(d, nil, Loog::NULL, shuffle: pfx).each.to_a.map(&:name)
|
58
|
+
assert_equal(names.size, after.size)
|
59
|
+
names.each { |n| assert_includes(after, n, "#{n.inspect} is missing, with #{pfx.inspect}") }
|
60
|
+
after.each { |n| assert_includes(names, n, "#{n.inspect} is extra, with #{pfx.inspect}") }
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
48
65
|
def test_get_one
|
49
66
|
Dir.mktmpdir do |d|
|
50
67
|
save_it(File.join(d, 'boo/boo.rb'), 'hey')
|