wca_i18n 0.3.0 → 0.4.0
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/Gemfile.lock +3 -1
- data/exe/wca_i18n +25 -12
- data/lib/wca_i18n/version.rb +1 -1
- data/wca_i18n.gemspec +1 -0
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d81a519daa516d4bb71890b9805fc929f96225f2
|
4
|
+
data.tar.gz: 824d4dd501949c961272a0738fb43ac01f66f0f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10acd68e49dbe4cf26474b4558e8a2a3791fa18849c30cfa95b0d2b81549d8c923ec84a0486ecf4cded3299b1d6d2ae7625563784aa788d8f7357423785c51de
|
7
|
+
data.tar.gz: a6ae0c401e3ac2c584b4b87dbd8f020b6a8f7c3fc9a2ceb5ea15ef1afdf199312210c306c81f64dcd476b4d1aad9820e222079f8c3e96f3218cafc7cb02b766b
|
data/Gemfile.lock
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
wca_i18n (0.
|
4
|
+
wca_i18n (0.4.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
9
|
byebug (9.1.0)
|
10
|
+
colorize (0.8.1)
|
10
11
|
diff-lcs (1.3)
|
11
12
|
rake (10.5.0)
|
12
13
|
rspec (3.7.0)
|
@@ -29,6 +30,7 @@ PLATFORMS
|
|
29
30
|
DEPENDENCIES
|
30
31
|
bundler (~> 1.16)
|
31
32
|
byebug (~> 9.0)
|
33
|
+
colorize (~> 0.8)
|
32
34
|
rake (~> 10.0)
|
33
35
|
rspec (~> 3.0)
|
34
36
|
wca_i18n!
|
data/exe/wca_i18n
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'optparse'
|
4
4
|
require 'wca_i18n'
|
5
|
+
require 'colorize'
|
5
6
|
|
6
7
|
def main
|
7
8
|
verbose = false
|
@@ -22,7 +23,8 @@ def main
|
|
22
23
|
base_translation = load_translation(base_translation_file)
|
23
24
|
translations = translation_files.map { |f| load_translation(f) }.reject { |t| t.locale == base_translation.locale }
|
24
25
|
|
25
|
-
compare_base_with_translations(base_translation, translations.sort_by!(&:locale), verbose)
|
26
|
+
perfect = compare_base_with_translations(base_translation, translations.sort_by!(&:locale), verbose)
|
27
|
+
exit (perfect ? 0 : 1)
|
26
28
|
end
|
27
29
|
|
28
30
|
def load_translation(filename)
|
@@ -31,26 +33,37 @@ def load_translation(filename)
|
|
31
33
|
end
|
32
34
|
|
33
35
|
def compare_base_with_translations(base_translation, translations, verbose)
|
36
|
+
total_issue_count = 0
|
34
37
|
translations.each do |translation|
|
35
38
|
diff = translation.compare_to(base_translation)
|
36
|
-
|
39
|
+
translation_issue_count = diff.values.map(&:length).sum
|
40
|
+
total_issue_count += translation_issue_count
|
41
|
+
|
42
|
+
prefix = (translation_issue_count == 0 ? "✔".green : "✗".red)
|
43
|
+
puts "#{prefix} #{translation.locale}:#{indent(format_diff(diff, verbose), 1)}"
|
37
44
|
end
|
45
|
+
|
46
|
+
total_issue_count == 0
|
38
47
|
end
|
39
48
|
|
40
49
|
def format_diff(diff, verbose=false)
|
41
50
|
types = [:missing, :outdated, :unused]
|
51
|
+
total = diff.values.map(&:length).sum
|
42
52
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
53
|
+
if total == 0
|
54
|
+
"Up to date"
|
55
|
+
elsif verbose
|
56
|
+
pretty_counts = types.map do |type|
|
57
|
+
contexts = diff[type]
|
58
|
+
pretty = "• #{contexts.length} #{type.to_s}"
|
59
|
+
if contexts.length > 0
|
60
|
+
pretty += ":\n#{indent(format_contexts(contexts), 1)}"
|
61
|
+
end
|
62
|
+
pretty
|
63
|
+
end
|
64
|
+
"#{total} total\n" + pretty_counts.join("\n")
|
52
65
|
else
|
53
|
-
|
66
|
+
pretty_counts = types.map { |type| "#{diff[type].length} #{type.to_s}" }
|
54
67
|
"#{total} total = #{pretty_counts.join(" + ")}"
|
55
68
|
end
|
56
69
|
end
|
data/lib/wca_i18n/version.rb
CHANGED
data/wca_i18n.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wca_i18n
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Fleischman
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '9.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: colorize
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.8'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.8'
|
69
83
|
description:
|
70
84
|
email:
|
71
85
|
- software@worldcubeassociation.org
|