i18n-migrations 1.0.1 → 1.0.3
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/lib/i18n/migrations/migrator.rb +18 -6
- data/lib/i18n/migrations/version.rb +1 -1
- 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: 5f059dbfd5097a87bb672d4e7f902ce214eb7e66fb0db5ff6cbb4aa2b59fe40f
|
4
|
+
data.tar.gz: 40c5225ca8a4de47b99e35cfe6403e74dfa8e4a96944c9f31d814634aeaa0cf5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5f51b3db8bf668c05fa02e2c57b6288d4a3d29bbfd35fa6625ab43cb4acc42e61cec864fb9f87b833386c768213ecf6594385f5adc60c8a60b92d3a87dbbeec
|
7
|
+
data.tar.gz: 1a920ec93aedeb53c803fbcdabb8a344e20b5dce79f4b3ee0c4b25ac373ea26b5a62c571cd0da13ac11ad0381da540e8865612a9f160401ddcfbba23cf96f5c0
|
@@ -11,6 +11,8 @@ require 'config'
|
|
11
11
|
require 'locale'
|
12
12
|
require 'migration_factory'
|
13
13
|
|
14
|
+
CONCURRENT_THREADS = 4
|
15
|
+
|
14
16
|
# this class knows how to do all the things the cli needs done.
|
15
17
|
# it mostly delegates to locale to do it, often asking multiple locales to do the same thing
|
16
18
|
module I18n
|
@@ -104,7 +106,7 @@ end
|
|
104
106
|
end
|
105
107
|
|
106
108
|
def validate(locale_or_all)
|
107
|
-
each_locale(locale_or_all) do |locale|
|
109
|
+
each_locale(locale_or_all, async: false) do |locale|
|
108
110
|
next if locale.main_locale?
|
109
111
|
locale.update_info do |data, notes|
|
110
112
|
locale.validate(data, notes)
|
@@ -114,12 +116,22 @@ end
|
|
114
116
|
|
115
117
|
private
|
116
118
|
|
117
|
-
def each_locale(name = 'all')
|
118
|
-
|
119
|
-
|
120
|
-
|
119
|
+
def each_locale(name = 'all', async: true)
|
120
|
+
locale_names = name == 'all' ? all_locale_names : [name]
|
121
|
+
|
122
|
+
if async
|
123
|
+
locale_names.each_slice(CONCURRENT_THREADS) do |some_locale_names|
|
124
|
+
threads = some_locale_names.map do |l|
|
125
|
+
locale = locale_for(l)
|
126
|
+
Thread.new {yield locale}
|
127
|
+
end
|
128
|
+
threads.each(&:join)
|
129
|
+
end
|
130
|
+
else
|
131
|
+
locale_names.each do |l|
|
132
|
+
yield locale_for(l)
|
133
|
+
end
|
121
134
|
end
|
122
|
-
threads.each(&:join)
|
123
135
|
end
|
124
136
|
|
125
137
|
def all_locale_names
|