i18n-migrations 1.0.1 → 1.0.3

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: 0435f2ba21c8596bf88ee279017a289029603c30af5be9c33602aceca4eb2777
4
- data.tar.gz: fd5a0c1c8a67005b2eb324e0f5b8c2ddab9f17961bf2226e83aed06c8a33abc0
3
+ metadata.gz: 5f059dbfd5097a87bb672d4e7f902ce214eb7e66fb0db5ff6cbb4aa2b59fe40f
4
+ data.tar.gz: 40c5225ca8a4de47b99e35cfe6403e74dfa8e4a96944c9f31d814634aeaa0cf5
5
5
  SHA512:
6
- metadata.gz: '09a7c7e52e1ca71e5cc8789ffaf6804a49d44ea9957bb36fc635f525ce734d4e0c9df9e23c99770b06acd1488843f7f969d558768d96897d4eb192130486bfc6'
7
- data.tar.gz: 4b6a2dbff550a597c4afca6d2df8c89512ab0aa120115d2ac8ed54505a2b429f5d4c8ff5f68d96302bd588ae9c22af677571479f718f26385c2df09815e50deb
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
- threads = (name == 'all' ? all_locale_names : [name]).map do |l|
119
- locale = locale_for(l)
120
- Thread.new {yield locale}
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
@@ -1,5 +1,5 @@
1
1
  module I18n
2
2
  module Migrations
3
- VERSION = "1.0.1"
3
+ VERSION = "1.0.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n-migrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Lightsmith