singleton-client-test 0.7.0.33 → 0.7.0.36
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 +1 -10
- data/lib/sgtn-client/api/translation.rb +84 -81
- data/lib/sgtn-client/cldr/localized_str.rb +1 -0
- data/lib/sgtn-client/common/data.rb +30 -0
- data/lib/sgtn-client/common/single_operation.rb +1 -0
- data/lib/sgtn-client/core/config.rb +35 -2
- data/lib/sgtn-client/exceptions.rb +6 -0
- data/lib/sgtn-client/loader/cache.rb +58 -34
- 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 +51 -0
- data/lib/sgtn-client/loader/server.rb +94 -0
- data/lib/sgtn-client/loader/single_loader.rb +46 -0
- data/lib/sgtn-client/loader/source.rb +55 -0
- data/lib/sgtn-client/loader/source_comparer.rb +48 -28
- data/lib/sgtn-client/sgtn-client.rb +1 -0
- data/lib/sgtn-client/util/cache-util.rb +0 -3
- data/lib/sgtn-client/util/locale-util.rb +22 -18
- data/lib/sgtn-client/util/validate-util.rb +1 -6
- data/lib/singleton-client.rb +15 -0
- data/lib/singleton-ruby.rb +2 -0
- metadata +36 -119
- data/lib/sgtn-client/core/request.rb +0 -24
- data/lib/sgtn-client/loader/local_bundle.rb +0 -13
- data/lib/sgtn-client/loader/local_source_bundle.rb +0 -29
- data/lib/sgtn-client/loader/server_bundle.rb +0 -22
- data/lib/sgtn-client/util/file-util.rb +0 -24
metadata
CHANGED
@@ -1,71 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: singleton-client-test
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.0.
|
4
|
+
version: 0.7.0.36
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- VMware G11n Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: request_store
|
14
|
+
name: rdoc
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
30
16
|
requirements:
|
31
|
-
- - "
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '1.1'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
17
|
+
- - ">="
|
39
18
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
41
|
-
-
|
42
|
-
name: twitter_cldr
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
19
|
+
version: 2.4.2
|
20
|
+
- - "<"
|
46
21
|
- !ruby/object:Gem::Version
|
47
|
-
version: '6.
|
22
|
+
version: '6.0'
|
48
23
|
type: :development
|
49
24
|
prerelease: false
|
50
25
|
version_requirements: !ruby/object:Gem::Requirement
|
51
26
|
requirements:
|
52
|
-
- - "
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '6.6'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: webmock
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
27
|
+
- - ">="
|
60
28
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
62
|
-
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
29
|
+
version: 2.4.2
|
30
|
+
- - "<"
|
67
31
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
32
|
+
version: '6.0'
|
69
33
|
- !ruby/object:Gem::Dependency
|
70
34
|
name: rspec
|
71
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,26 +44,6 @@ dependencies:
|
|
80
44
|
- - "~>"
|
81
45
|
- !ruby/object:Gem::Version
|
82
46
|
version: '3.0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rdoc
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 2.4.2
|
90
|
-
- - "<"
|
91
|
-
- !ruby/object:Gem::Version
|
92
|
-
version: '6.0'
|
93
|
-
type: :development
|
94
|
-
prerelease: false
|
95
|
-
version_requirements: !ruby/object:Gem::Requirement
|
96
|
-
requirements:
|
97
|
-
- - ">="
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
version: 2.4.2
|
100
|
-
- - "<"
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: '6.0'
|
103
47
|
- !ruby/object:Gem::Dependency
|
104
48
|
name: rubocop
|
105
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -115,79 +59,47 @@ dependencies:
|
|
115
59
|
- !ruby/object:Gem::Version
|
116
60
|
version: '0.49'
|
117
61
|
- !ruby/object:Gem::Dependency
|
118
|
-
name:
|
62
|
+
name: webmock
|
119
63
|
requirement: !ruby/object:Gem::Requirement
|
120
64
|
requirements:
|
121
|
-
- - "
|
122
|
-
- !ruby/object:Gem::Version
|
123
|
-
version: 1.7.0
|
124
|
-
- - "<"
|
65
|
+
- - "~>"
|
125
66
|
- !ruby/object:Gem::Version
|
126
67
|
version: '2.0'
|
127
|
-
type: :
|
68
|
+
type: :development
|
128
69
|
prerelease: false
|
129
70
|
version_requirements: !ruby/object:Gem::Requirement
|
130
71
|
requirements:
|
131
|
-
- - "
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
version: 1.7.0
|
134
|
-
- - "<"
|
72
|
+
- - "~>"
|
135
73
|
- !ruby/object:Gem::Version
|
136
74
|
version: '2.0'
|
137
75
|
- !ruby/object:Gem::Dependency
|
138
|
-
name:
|
76
|
+
name: faraday
|
139
77
|
requirement: !ruby/object:Gem::Requirement
|
140
78
|
requirements:
|
141
79
|
- - ">="
|
142
80
|
- !ruby/object:Gem::Version
|
143
|
-
version:
|
144
|
-
- - "<"
|
145
|
-
- !ruby/object:Gem::Version
|
146
|
-
version: '2.0'
|
81
|
+
version: '0'
|
147
82
|
type: :runtime
|
148
83
|
prerelease: false
|
149
84
|
version_requirements: !ruby/object:Gem::Requirement
|
150
85
|
requirements:
|
151
86
|
- - ">="
|
152
87
|
- !ruby/object:Gem::Version
|
153
|
-
version:
|
154
|
-
- - "<"
|
155
|
-
- !ruby/object:Gem::Version
|
156
|
-
version: '2.0'
|
88
|
+
version: '0'
|
157
89
|
- !ruby/object:Gem::Dependency
|
158
|
-
name:
|
90
|
+
name: faraday_middleware
|
159
91
|
requirement: !ruby/object:Gem::Requirement
|
160
92
|
requirements:
|
161
93
|
- - ">="
|
162
94
|
- !ruby/object:Gem::Version
|
163
|
-
version: '
|
164
|
-
- - "<"
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
version: '4.0'
|
95
|
+
version: '0'
|
167
96
|
type: :runtime
|
168
97
|
prerelease: false
|
169
98
|
version_requirements: !ruby/object:Gem::Requirement
|
170
99
|
requirements:
|
171
100
|
- - ">="
|
172
101
|
- !ruby/object:Gem::Version
|
173
|
-
version: '
|
174
|
-
- - "<"
|
175
|
-
- !ruby/object:Gem::Version
|
176
|
-
version: '4.0'
|
177
|
-
- !ruby/object:Gem::Dependency
|
178
|
-
name: netrc
|
179
|
-
requirement: !ruby/object:Gem::Requirement
|
180
|
-
requirements:
|
181
|
-
- - "~>"
|
182
|
-
- !ruby/object:Gem::Version
|
183
|
-
version: '0.8'
|
184
|
-
type: :runtime
|
185
|
-
prerelease: false
|
186
|
-
version_requirements: !ruby/object:Gem::Requirement
|
187
|
-
requirements:
|
188
|
-
- - "~>"
|
189
|
-
- !ruby/object:Gem::Version
|
190
|
-
version: '0.8'
|
102
|
+
version: '0'
|
191
103
|
- !ruby/object:Gem::Dependency
|
192
104
|
name: multi_json
|
193
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -203,19 +115,19 @@ dependencies:
|
|
203
115
|
- !ruby/object:Gem::Version
|
204
116
|
version: '1.0'
|
205
117
|
- !ruby/object:Gem::Dependency
|
206
|
-
name:
|
118
|
+
name: request_store
|
207
119
|
requirement: !ruby/object:Gem::Requirement
|
208
120
|
requirements:
|
209
|
-
- - "
|
121
|
+
- - ">="
|
210
122
|
- !ruby/object:Gem::Version
|
211
|
-
version: '
|
123
|
+
version: '0'
|
212
124
|
type: :runtime
|
213
125
|
prerelease: false
|
214
126
|
version_requirements: !ruby/object:Gem::Requirement
|
215
127
|
requirements:
|
216
|
-
- - "
|
128
|
+
- - ">="
|
217
129
|
- !ruby/object:Gem::Version
|
218
|
-
version: '
|
130
|
+
version: '0'
|
219
131
|
- !ruby/object:Gem::Dependency
|
220
132
|
name: twitter_cldr
|
221
133
|
requirement: !ruby/object:Gem::Requirement
|
@@ -246,24 +158,29 @@ files:
|
|
246
158
|
- lib/sgtn-client/cldr/localized_datetime.rb
|
247
159
|
- lib/sgtn-client/cldr/localized_str.rb
|
248
160
|
- lib/sgtn-client/cldr/localized_time.rb
|
161
|
+
- lib/sgtn-client/common/data.rb
|
249
162
|
- lib/sgtn-client/common/single_operation.rb
|
250
163
|
- lib/sgtn-client/core/cache.rb
|
251
164
|
- lib/sgtn-client/core/config.rb
|
252
165
|
- lib/sgtn-client/core/exceptions.rb
|
253
166
|
- lib/sgtn-client/core/logging.rb
|
254
|
-
- lib/sgtn-client/
|
167
|
+
- lib/sgtn-client/exceptions.rb
|
255
168
|
- lib/sgtn-client/formatters/plurals/plural_formatter.rb
|
256
169
|
- lib/sgtn-client/loader/cache.rb
|
257
|
-
- lib/sgtn-client/loader/
|
258
|
-
- lib/sgtn-client/loader/
|
259
|
-
- lib/sgtn-client/loader/
|
170
|
+
- lib/sgtn-client/loader/chain_loader.rb
|
171
|
+
- lib/sgtn-client/loader/consts.rb
|
172
|
+
- lib/sgtn-client/loader/loader_factory.rb
|
173
|
+
- lib/sgtn-client/loader/local_translation.rb
|
174
|
+
- lib/sgtn-client/loader/server.rb
|
175
|
+
- lib/sgtn-client/loader/single_loader.rb
|
176
|
+
- lib/sgtn-client/loader/source.rb
|
260
177
|
- lib/sgtn-client/loader/source_comparer.rb
|
261
178
|
- lib/sgtn-client/sgtn-client.rb
|
262
179
|
- lib/sgtn-client/util/cache-util.rb
|
263
|
-
- lib/sgtn-client/util/file-util.rb
|
264
180
|
- lib/sgtn-client/util/locale-util.rb
|
265
181
|
- lib/sgtn-client/util/string-util.rb
|
266
182
|
- lib/sgtn-client/util/validate-util.rb
|
183
|
+
- lib/singleton-client.rb
|
267
184
|
- lib/singleton-ruby.rb
|
268
185
|
- lib/version.rb
|
269
186
|
homepage: https://github.com/vmware/singleton
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# Copyright 2022 VMware, Inc.
|
2
|
-
# SPDX-License-Identifier: EPL-2.0
|
3
|
-
|
4
|
-
require 'rest-client'
|
5
|
-
require 'multi_json'
|
6
|
-
|
7
|
-
module SgtnClient::Core
|
8
|
-
class Request
|
9
|
-
def self.get(url)
|
10
|
-
SgtnClient.logger.debug "[Request][get]url=#{url}"
|
11
|
-
res = RestClient::Resource.new(
|
12
|
-
url,
|
13
|
-
:verify_ssl => false
|
14
|
-
).get
|
15
|
-
begin
|
16
|
-
obj = MultiJson.load(res)
|
17
|
-
rescue MultiJson::ParseError => exception
|
18
|
-
exception.data
|
19
|
-
exception.cause
|
20
|
-
end
|
21
|
-
return obj
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# Copyright 2022 VMware, Inc.
|
2
|
-
# SPDX-License-Identifier: EPL-2.0
|
3
|
-
|
4
|
-
module SgtnClient::TranslationLoader::LocalBundle
|
5
|
-
def load_bundle(component, locale)
|
6
|
-
env = SgtnClient::Config.default_environment
|
7
|
-
product_name = SgtnClient::Config.configurations[env]['product_name']
|
8
|
-
version = SgtnClient::Config.configurations[env]['version'].to_s
|
9
|
-
translation_bundle = SgtnClient::Config.configurations[env]['translation_bundle']
|
10
|
-
bundlepath = translation_bundle + '/' + product_name + '/' + version + '/' + component + '/messages_' + locale + '.json'
|
11
|
-
SgtnClient::FileUtil.read_json(bundlepath)
|
12
|
-
end
|
13
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
# Copyright 2022 VMware, Inc.
|
2
|
-
# SPDX-License-Identifier: EPL-2.0
|
3
|
-
|
4
|
-
module SgtnClient
|
5
|
-
class Source
|
6
|
-
def self.load_bundle(component)
|
7
|
-
SgtnClient.logger.debug "[Source][getBundle]component=#{component}"
|
8
|
-
env = SgtnClient::Config.default_environment
|
9
|
-
source_bundle = SgtnClient::Config.configurations[env]['source_bundle']
|
10
|
-
component_path = "#{source_bundle}/#{component}"
|
11
|
-
total_messages = nil
|
12
|
-
Dir.glob('**/*.{yml, yaml}', base: component_path) do |f|
|
13
|
-
bundle = SgtnClient::FileUtil.read_yml("#{component_path}/#{f}")
|
14
|
-
if total_messages.nil?
|
15
|
-
total_messages = bundle&.first&.last
|
16
|
-
else
|
17
|
-
total_messages.merge!(bundle&.first&.last)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
if total_messages
|
22
|
-
return { 'component' => component, 'locale' => SgtnClient::LocaleUtil.get_source_locale, 'messages' => total_messages }
|
23
|
-
end
|
24
|
-
rescue StandardError => e
|
25
|
-
SgtnClient.logger.error e.message
|
26
|
-
nil
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# Copyright 2022 VMware, Inc.
|
2
|
-
# SPDX-License-Identifier: EPL-2.0
|
3
|
-
|
4
|
-
module SgtnClient::Core
|
5
|
-
autoload :Request, 'sgtn-client/core/request'
|
6
|
-
end
|
7
|
-
|
8
|
-
module SgtnClient::TranslationLoader::ServerBundle
|
9
|
-
def load_bundle(component, locale)
|
10
|
-
env = SgtnClient::Config.default_environment
|
11
|
-
product_name = SgtnClient::Config.configurations[env]['product_name']
|
12
|
-
vip_server = SgtnClient::Config.configurations[env]['vip_server']
|
13
|
-
version = SgtnClient::Config.configurations[env]['version'].to_s
|
14
|
-
url = vip_server + '/i18n/api/v2/translation/products/' + product_name + '/versions/' + version + '/locales/' + locale + '/components/' + component + '?checkTranslationStatus=false&machineTranslation=false&pseudo=false'
|
15
|
-
begin
|
16
|
-
obj = SgtnClient::Core::Request.get(url)
|
17
|
-
rescue StandardError => e
|
18
|
-
SgtnClient.logger.error e.message
|
19
|
-
end
|
20
|
-
obj && obj['data']
|
21
|
-
end
|
22
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# Copyright 2022 VMware, Inc.
|
2
|
-
# SPDX-License-Identifier: EPL-2.0
|
3
|
-
|
4
|
-
autoload :YAML, 'yaml'
|
5
|
-
autoload :MultiJson, 'multi_json'
|
6
|
-
|
7
|
-
module SgtnClient
|
8
|
-
|
9
|
-
class FileUtil
|
10
|
-
def self.read_json(bundlepath)
|
11
|
-
SgtnClient.logger.debug "[FileUtil]read json file from: " + bundlepath
|
12
|
-
begin
|
13
|
-
return MultiJson.load(File.read(bundlepath))
|
14
|
-
rescue => exception
|
15
|
-
SgtnClient.logger.error exception.message
|
16
|
-
end
|
17
|
-
nil
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.read_yml(file_name)
|
21
|
-
YAML::load(File.read(file_name))
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|