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.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +27 -28
  3. data/lib/sgtn-client/api/source.rb +10 -66
  4. data/lib/sgtn-client/api/t.rb +20 -18
  5. data/lib/sgtn-client/api/translation.rb +82 -116
  6. data/lib/sgtn-client/cldr/core_ext.rb +4 -1
  7. data/lib/sgtn-client/cldr/localized_date.rb +4 -1
  8. data/lib/sgtn-client/cldr/localized_datetime.rb +4 -1
  9. data/lib/sgtn-client/cldr/localized_str.rb +4 -1
  10. data/lib/sgtn-client/cldr/localized_time.rb +4 -1
  11. data/lib/sgtn-client/common/data.rb +30 -0
  12. data/lib/sgtn-client/common/single_operation.rb +34 -0
  13. data/lib/sgtn-client/core/cache.rb +14 -80
  14. data/lib/sgtn-client/core/config.rb +42 -3
  15. data/lib/sgtn-client/core/exceptions.rb +3 -0
  16. data/lib/sgtn-client/core/logging.rb +3 -1
  17. data/lib/sgtn-client/exceptions.rb +6 -0
  18. data/lib/sgtn-client/formatters/plurals/plural_formatter.rb +4 -1
  19. data/lib/sgtn-client/loader/cache.rb +71 -0
  20. data/lib/sgtn-client/loader/chain_loader.rb +49 -0
  21. data/lib/sgtn-client/loader/consts.rb +15 -0
  22. data/lib/sgtn-client/loader/loader_factory.rb +33 -0
  23. data/lib/sgtn-client/loader/local_translation.rb +49 -0
  24. data/lib/sgtn-client/loader/server.rb +94 -0
  25. data/lib/sgtn-client/loader/single_loader.rb +48 -0
  26. data/lib/sgtn-client/loader/source.rb +56 -0
  27. data/lib/sgtn-client/loader/source_comparer.rb +58 -0
  28. data/lib/sgtn-client/sgtn-client.rb +11 -1
  29. data/lib/sgtn-client/util/cache-util.rb +33 -44
  30. data/lib/sgtn-client/util/locale-util.rb +67 -28
  31. data/lib/sgtn-client/util/string-util.rb +12 -0
  32. data/lib/sgtn-client/util/validate-util.rb +4 -7
  33. data/lib/singleton-client.rb +15 -0
  34. data/lib/singleton-ruby.rb +5 -0
  35. data/lib/version.rb +2 -0
  36. metadata +43 -147
  37. data/lib/sgtn-client/core/request.rb +0 -21
  38. 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