i18n-migrations 1.0.2 → 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 +13 -9
- 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,7 +11,7 @@ require 'config'
|
|
11
11
|
require 'locale'
|
12
12
|
require 'migration_factory'
|
13
13
|
|
14
|
-
|
14
|
+
CONCURRENT_THREADS = 4
|
15
15
|
|
16
16
|
# this class knows how to do all the things the cli needs done.
|
17
17
|
# it mostly delegates to locale to do it, often asking multiple locales to do the same thing
|
@@ -106,7 +106,7 @@ end
|
|
106
106
|
end
|
107
107
|
|
108
108
|
def validate(locale_or_all)
|
109
|
-
each_locale(locale_or_all) do |locale|
|
109
|
+
each_locale(locale_or_all, async: false) do |locale|
|
110
110
|
next if locale.main_locale?
|
111
111
|
locale.update_info do |data, notes|
|
112
112
|
locale.validate(data, notes)
|
@@ -116,17 +116,21 @@ end
|
|
116
116
|
|
117
117
|
private
|
118
118
|
|
119
|
-
def each_locale(name = 'all')
|
119
|
+
def each_locale(name = 'all', async: true)
|
120
120
|
locale_names = name == 'all' ? all_locale_names : [name]
|
121
121
|
|
122
|
-
if
|
123
|
-
|
124
|
-
|
125
|
-
|
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)
|
126
129
|
end
|
127
|
-
threads.each(&:join)
|
128
130
|
else
|
129
|
-
locale_names.each
|
131
|
+
locale_names.each do |l|
|
132
|
+
yield locale_for(l)
|
133
|
+
end
|
130
134
|
end
|
131
135
|
end
|
132
136
|
|