singleton-client 0.7.4 → 0.7.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +27 -28
- data/lib/sgtn-client/api/source.rb +10 -66
- data/lib/sgtn-client/api/t.rb +20 -18
- data/lib/sgtn-client/api/translation.rb +82 -116
- data/lib/sgtn-client/cldr/core_ext.rb +4 -1
- data/lib/sgtn-client/cldr/localized_date.rb +4 -1
- data/lib/sgtn-client/cldr/localized_datetime.rb +4 -1
- data/lib/sgtn-client/cldr/localized_str.rb +4 -1
- data/lib/sgtn-client/cldr/localized_time.rb +4 -1
- data/lib/sgtn-client/common/data.rb +30 -0
- data/lib/sgtn-client/common/single_operation.rb +34 -0
- data/lib/sgtn-client/core/cache.rb +14 -80
- data/lib/sgtn-client/core/config.rb +42 -3
- data/lib/sgtn-client/core/exceptions.rb +3 -0
- data/lib/sgtn-client/core/logging.rb +3 -1
- data/lib/sgtn-client/exceptions.rb +6 -0
- data/lib/sgtn-client/formatters/plurals/plural_formatter.rb +4 -1
- data/lib/sgtn-client/loader/cache.rb +71 -0
- data/lib/sgtn-client/loader/chain_loader.rb +49 -0
- data/lib/sgtn-client/loader/consts.rb +15 -0
- data/lib/sgtn-client/loader/loader_factory.rb +33 -0
- data/lib/sgtn-client/loader/local_translation.rb +49 -0
- data/lib/sgtn-client/loader/server.rb +94 -0
- data/lib/sgtn-client/loader/single_loader.rb +48 -0
- data/lib/sgtn-client/loader/source.rb +56 -0
- data/lib/sgtn-client/loader/source_comparer.rb +58 -0
- data/lib/sgtn-client/sgtn-client.rb +11 -1
- data/lib/sgtn-client/util/cache-util.rb +33 -44
- data/lib/sgtn-client/util/locale-util.rb +67 -28
- data/lib/sgtn-client/util/string-util.rb +12 -0
- data/lib/sgtn-client/util/validate-util.rb +4 -7
- data/lib/singleton-client.rb +15 -0
- data/lib/singleton-ruby.rb +5 -0
- data/lib/version.rb +2 -0
- metadata +43 -147
- data/lib/sgtn-client/core/request.rb +0 -21
- data/lib/sgtn-client/util/file-util.rb +0 -34
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'erb'
|
2
|
-
require 'yaml'
|
3
|
-
|
4
|
-
module SgtnClient
|
5
|
-
|
6
|
-
class FileUtil
|
7
|
-
|
8
|
-
@mutex = Mutex.new
|
9
|
-
|
10
|
-
def self.read_json(bundlepath)
|
11
|
-
SgtnClient.logger.debug "[FileUtil]read json file from: " + bundlepath
|
12
|
-
@mutex.synchronize do
|
13
|
-
data_hash = nil
|
14
|
-
begin
|
15
|
-
file = File.read(bundlepath)
|
16
|
-
data_hash = MultiJson.load(file)
|
17
|
-
rescue => exception
|
18
|
-
SgtnClient.logger.error exception.message
|
19
|
-
end
|
20
|
-
return data_hash
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def self.read_yml(file_name)
|
25
|
-
SgtnClient.logger.debug "[FileUtil]read yml file from: " + file_name
|
26
|
-
@mutex.synchronize do
|
27
|
-
erb = ERB.new(File.read(file_name))
|
28
|
-
erb.filename = file_name
|
29
|
-
YAML.load(erb.result)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|