lib/i18n/migrations/migrator.rb in i18n-migrations-1.0.1 vs lib/i18n/migrations/migrator.rb in i18n-migrations-1.0.2
- old
+ new
@@ -9,10 +9,12 @@
require 'google_spreadsheet'
require 'config'
require 'locale'
require 'migration_factory'
+ASYNC = false
+
# this class knows how to do all the things the cli needs done.
# it mostly delegates to locale to do it, often asking multiple locales to do the same thing
module I18n
module Migrations
class Migrator
@@ -113,14 +115,20 @@
end
private
def each_locale(name = 'all')
- threads = (name == 'all' ? all_locale_names : [name]).map do |l|
- locale = locale_for(l)
- Thread.new {yield locale}
+ locale_names = name == 'all' ? all_locale_names : [name]
+
+ if ASYNC
+ threads = locale_names.map do |l|
+ locale = locale_for(l)
+ Thread.new {yield locale}
+ end
+ threads.each(&:join)
+ else
+ locale_names.each {|l| yield locale_for(l)}
end
- threads.each(&:join)
end
def all_locale_names
[config.main_locale] + config.other_locales
end