i18n-migrations 1.0.2 → 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: b742b520e0c42a29cbed11f435eaf57293a4c958de7ed2eed8be1ed802bfc7da
4
- data.tar.gz: b69d6b18f29f0290810322c8e051f5895ffd69982725b3cb8ea9b01630094af1
3
+ metadata.gz: 5f059dbfd5097a87bb672d4e7f902ce214eb7e66fb0db5ff6cbb4aa2b59fe40f
4
+ data.tar.gz: 40c5225ca8a4de47b99e35cfe6403e74dfa8e4a96944c9f31d814634aeaa0cf5
5
5
  SHA512:
6
- metadata.gz: 36e7b155f30d24c24fc84c181860595dbb995c7cf53f9ca6c7b693794b7b7cfa1a1f9a287c996c3ed75e7fe897b8a870946a37ec73c47bf25c2ea7c005fb766a
7
- data.tar.gz: e5957eb775f2592d38824141e5c67cf42e8889c71c6cf239c98bb1ffeb0250529963ddc8f58d5df4a2a5dde0a51ca6a7c0cb848fae73c5648194a4989b7993bf
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
- ASYNC = false
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 ASYNC
123
- threads = locale_names.map do |l|
124
- locale = locale_for(l)
125
- Thread.new {yield locale}
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 {|l| yield locale_for(l)}
131
+ locale_names.each do |l|
132
+ yield locale_for(l)
133
+ end
130
134
  end
131
135
  end
132
136
 
@@ -1,5 +1,5 @@
1
1
  module I18n
2
2
  module Migrations
3
- VERSION = "1.0.2"
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.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Lightsmith