ad_localize 6.1.0 → 6.2.0

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: b70487e0e8087dbbdb3c6873b025748b9fc97e68ac2abc5c13a0fe71a1a1011c
4
- data.tar.gz: c82fe7eeb8bc946411c094f51d69df40a35bc9b9e5c5805203a976c4d2aba9c0
3
+ metadata.gz: 7b585dde72ed5b4a9ac463be22847e032b21acd1c68f301a14c3fa43ce784c1f
4
+ data.tar.gz: 5384452ad53c7f8255d1660bbed6d25a9067d42e5f407bb5256ed6c77f047fdc
5
5
  SHA512:
6
- metadata.gz: 8acdef650f29ede65b72fed96666be542f078337dd6e7b950a8be2ec18b1ff55ee65279dcd5736e5b4d229fed9796b30480cee9b72194ad1bdbba87fa388d81b
7
- data.tar.gz: cad8b9ba73f3055cb7d000fdda14eb45f59a418d6e563a5d272855ff86000779c221282b07e8f33f07f793ecaec6e9150dc9b889c485e8a1496ee1839a5b9daa
6
+ metadata.gz: 3724f3e75a3336fc82a5e21a6ca2b35bd3351732c78abe7926b8b7f22b145ff15141992e3a292afc419dcf788baf040f8841bf8fab782a79855d708cb5e770b9
7
+ data.tar.gz: 1b0a33037f0d559c83ec1373043ae930a42bc1b13304c9033464e179b8239534bbf31c813ee2b880aace99b075bcbc7a5d924f1c0b88e1d69cfc70d48c555975
@@ -22,3 +22,12 @@ jobs:
22
22
  run: bundle exec rubocop
23
23
  - name: Run tests
24
24
  run: bundle exec rake test
25
+ - run: 'echo "$GOOGLE_APPLICATION_CREDENTIALS" > account_secret.json'
26
+ shell: bash
27
+ env:
28
+ GOOGLE_APPLICATION_CREDENTIALS: ${{secrets.GOOGLE_APPLICATION_CREDENTIALS}}
29
+ - name: Run private google sheet tests
30
+ if: matrix.ruby == '3.2.0' # Limit execution on latest ruby version to prevent reaching rate limits
31
+ run: bundle exec rake test_private_google_sheet
32
+ env:
33
+ GOOGLE_APPLICATION_CREDENTIALS: 'account_secret.json'
data/.gitignore CHANGED
@@ -11,3 +11,4 @@ ad_localize/tmp/
11
11
  .ruby-version
12
12
  pkg/
13
13
  exports/
14
+ account_secret.json
data/.rubocop_todo.yml CHANGED
@@ -1,12 +1,12 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2023-02-02 13:39:01 UTC using RuboCop version 1.43.0.
3
+ # on 2023-12-12 15:16:08 UTC using RuboCop version 1.58.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 4
9
+ # Offense count: 1
10
10
  # This cop supports safe autocorrection (--autocorrect).
11
11
  # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
12
12
  # Include: **/*.gemspec
@@ -14,25 +14,11 @@ Gemspec/OrderedDependencies:
14
14
  Exclude:
15
15
  - 'ad_localize.gemspec'
16
16
 
17
- # Offense count: 1
18
- # Configuration parameters: Severity, Include.
19
- # Include: **/*.gemspec
20
- Gemspec/RequiredRubyVersion:
21
- Exclude:
22
- - 'ad_localize.gemspec'
23
-
24
- # Offense count: 86
17
+ # Offense count: 87
25
18
  # This cop supports safe autocorrection (--autocorrect).
26
19
  Layout/EmptyLineAfterMagicComment:
27
20
  Enabled: false
28
21
 
29
- # Offense count: 1
30
- # This cop supports safe autocorrection (--autocorrect).
31
- # Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
32
- Lint/UnusedBlockArgument:
33
- Exclude:
34
- - 'lib/ad_localize/mappers/locale_wording_to_hash.rb'
35
-
36
22
  # Offense count: 4
37
23
  # This cop supports safe autocorrection (--autocorrect).
38
24
  # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods.
@@ -41,30 +27,30 @@ Lint/UnusedMethodArgument:
41
27
  - 'lib/ad_localize/interactors/base_generate_files.rb'
42
28
  - 'lib/ad_localize/serializers/templated_serializer.rb'
43
29
 
44
- # Offense count: 6
45
- # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
30
+ # Offense count: 7
31
+ # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
46
32
  Metrics/AbcSize:
47
- Max: 35
33
+ Max: 31
48
34
 
49
- # Offense count: 2
35
+ # Offense count: 4
50
36
  # Configuration parameters: CountComments, CountAsOne.
51
37
  Metrics/ClassLength:
52
38
  Max: 139
53
39
 
54
40
  # Offense count: 1
55
- # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
41
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
56
42
  Metrics/CyclomaticComplexity:
57
- Max: 11
43
+ Max: 9
58
44
 
59
- # Offense count: 11
60
- # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
45
+ # Offense count: 13
46
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
61
47
  Metrics/MethodLength:
62
- Max: 40
48
+ Max: 27
63
49
 
64
50
  # Offense count: 1
65
- # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
51
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
66
52
  Metrics/PerceivedComplexity:
67
- Max: 11
53
+ Max: 9
68
54
 
69
55
  # Offense count: 1
70
56
  # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
@@ -101,7 +87,7 @@ Naming/VariableName:
101
87
 
102
88
  # Offense count: 1
103
89
  # This cop supports safe autocorrection (--autocorrect).
104
- # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, IgnoredMethods, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
90
+ # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
105
91
  # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
106
92
  # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
107
93
  # FunctionalMethods: let, let!, subject, watch
@@ -143,7 +129,7 @@ Style/FormatString:
143
129
 
144
130
  # Offense count: 3
145
131
  # This cop supports safe autocorrection (--autocorrect).
146
- # Configuration parameters: MaxUnannotatedPlaceholdersAllowed, AllowedMethods, AllowedPatterns, IgnoredMethods.
132
+ # Configuration parameters: MaxUnannotatedPlaceholdersAllowed, AllowedMethods, AllowedPatterns.
147
133
  # SupportedStyles: annotated, template, unannotated
148
134
  Style/FormatStringToken:
149
135
  EnforcedStyle: template
@@ -161,13 +147,16 @@ Style/GuardClause:
161
147
  Exclude:
162
148
  - 'lib/ad_localize/repositories/drive_repository.rb'
163
149
 
164
- # Offense count: 57
150
+ # Offense count: 15
165
151
  # This cop supports safe autocorrection (--autocorrect).
166
152
  # Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
167
153
  # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
168
154
  # SupportedShorthandSyntax: always, never, either, consistent
169
155
  Style/HashSyntax:
170
- Enabled: false
156
+ Exclude:
157
+ - 'Rakefile'
158
+ - 'lib/ad_localize/option_handler.rb'
159
+ - 'test/interactors/process_export_request_test.rb'
171
160
 
172
161
  # Offense count: 4
173
162
  # This cop supports unsafe autocorrection (--autocorrect-all).
@@ -197,13 +186,13 @@ Style/NegatedIf:
197
186
 
198
187
  # Offense count: 3
199
188
  # This cop supports unsafe autocorrection (--autocorrect-all).
200
- # Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns, IgnoredMethods.
189
+ # Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns.
201
190
  # SupportedStyles: predicate, comparison
202
191
  Style/NumericPredicate:
203
192
  Exclude:
204
193
  - 'spec/**/*'
205
- - 'test/interactors/process_export_request_test.rb'
206
194
  - 'test/repositories/drive_repository_test.rb'
195
+ - 'test/repositories/private_drive_repository_test.rb'
207
196
 
208
197
  # Offense count: 1
209
198
  # This cop supports safe autocorrection (--autocorrect).
@@ -218,13 +207,13 @@ Style/RedundantAssignment:
218
207
  Exclude:
219
208
  - 'lib/ad_localize/parsers/csv_parser.rb'
220
209
 
221
- # Offense count: 1
210
+ # Offense count: 2
222
211
  # This cop supports safe autocorrection (--autocorrect).
223
212
  Style/RedundantBegin:
224
213
  Exclude:
225
214
  - 'lib/ad_localize/repositories/drive_repository.rb'
226
215
 
227
- # Offense count: 18
216
+ # Offense count: 15
228
217
  # This cop supports safe autocorrection (--autocorrect).
229
218
  Style/RedundantFreeze:
230
219
  Exclude:
@@ -234,7 +223,6 @@ Style/RedundantFreeze:
234
223
  - 'lib/ad_localize/interactors/generate_strings.rb'
235
224
  - 'lib/ad_localize/interactors/merge_wordings.rb'
236
225
  - 'lib/ad_localize/parsers/csv_parser.rb'
237
- - 'lib/ad_localize/parsers/key_parser.rb'
238
226
  - 'lib/ad_localize/serializers/info_plist_serializer.rb'
239
227
  - 'lib/ad_localize/serializers/localizable_strings_serializer.rb'
240
228
  - 'lib/ad_localize/serializers/localizable_stringsdict_serializer.rb'
@@ -245,6 +233,12 @@ Style/RedundantPercentQ:
245
233
  Exclude:
246
234
  - 'ad_localize.gemspec'
247
235
 
236
+ # Offense count: 1
237
+ # This cop supports safe autocorrection (--autocorrect).
238
+ Style/RedundantRegexpArgument:
239
+ Exclude:
240
+ - 'lib/ad_localize/sanitizers/ios_to_android_sanitizer.rb'
241
+
248
242
  # Offense count: 2
249
243
  # This cop supports safe autocorrection (--autocorrect).
250
244
  Style/RedundantRegexpEscape:
@@ -290,30 +284,24 @@ Style/StringConcatenation:
290
284
  - 'lib/ad_localize/serializers/strings_serializer.rb'
291
285
  - 'lib/ad_localize/serializers/templated_serializer.rb'
292
286
 
293
- # Offense count: 85
287
+ # Offense count: 146
294
288
  # This cop supports safe autocorrection (--autocorrect).
295
289
  # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
296
290
  # SupportedStyles: single_quotes, double_quotes
297
291
  Style/StringLiterals:
298
292
  Enabled: false
299
293
 
300
- # Offense count: 3
301
- # This cop supports safe autocorrection (--autocorrect).
302
- Style/SymbolLiteral:
303
- Exclude:
304
- - 'lib/ad_localize/mappers/options_to_export_request.rb'
305
- - 'test/option_handler_test.rb'
306
-
307
- # Offense count: 3
294
+ # Offense count: 4
308
295
  # This cop supports unsafe autocorrection (--autocorrect-all).
309
296
  Style/ZeroLengthPredicate:
310
297
  Exclude:
311
298
  - 'lib/ad_localize/mappers/locale_wording_to_hash.rb'
312
299
  - 'test/repositories/drive_repository_test.rb'
300
+ - 'test/repositories/private_drive_repository_test.rb'
313
301
 
314
- # Offense count: 10
302
+ # Offense count: 15
315
303
  # This cop supports safe autocorrection (--autocorrect).
316
- # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
304
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
317
305
  # URISchemes: http, https
318
306
  Layout/LineLength:
319
307
  Max: 153
data/CHANGELOG.md CHANGED
@@ -7,12 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## Unreleased
9
9
 
10
- ## 6.1.0
10
+ ## [6.2.0] - 2023-12-12
11
+
12
+ ### Added
13
+
14
+ - new option `--skip-value-stripping` that disable the leading and trailing whitespaces removal on wording values. The value stripping was introduced with version 6.0.0.
15
+
16
+ ### Changed
17
+
18
+ - Updated dependencies
19
+ - Increase number of retries to 5 and timeout delay to 120s when accessing Google APIs. This reduces the amount of rate limit error when using private Google spreadsheet.
20
+
21
+ ## [6.1.0] - 2023-09-12
22
+
11
23
  ### Added
12
24
 
13
25
  - new option (iOS only) `--auto-escape-percent` that escapes % character in wording. This option should be used if the wording is intended to be used with `String(format:)`.
14
26
 
15
- ## 6.0.0
27
+ ## [6.0.0] - 2023-07-17
28
+
16
29
  ### Added
17
30
 
18
31
  - Remove extra spaces before and after key/translation contents
data/Gemfile CHANGED
@@ -3,3 +3,11 @@ source "https://rubygems.org"
3
3
 
4
4
  # Specify your gem's dependencies in ad_localize.gemspec
5
5
  gemspec
6
+
7
+ gem 'bundler', '>= 1.12.0', '< 3.0.0'
8
+ gem 'debug', ">= 1.0.0", '< 2.0'
9
+ gem 'diffy', '~> 3.3'
10
+ gem 'minitest', '~> 5.11'
11
+ gem 'minitest-reporters', '~> 1.3'
12
+ gem 'rake', '>= 12.3.0', '< 14.0.0'
13
+ gem 'rubocop', "~> 1.0"
data/Gemfile.lock CHANGED
@@ -3,35 +3,46 @@ PATH
3
3
  specs:
4
4
  ad_localize (6.1.0)
5
5
  activesupport (>= 6.1.3.2, < 8.0)
6
- colorize (~> 0.8)
6
+ colorize (~> 1.0)
7
7
  google-apis-drive_v3 (~> 0.33.0)
8
8
  google-apis-sheets_v4 (~> 0.9)
9
9
 
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activesupport (7.0.4)
13
+ activesupport (7.1.2)
14
+ base64
15
+ bigdecimal
14
16
  concurrent-ruby (~> 1.0, >= 1.0.2)
17
+ connection_pool (>= 2.2.5)
18
+ drb
15
19
  i18n (>= 1.6, < 2)
16
20
  minitest (>= 5.1)
21
+ mutex_m
17
22
  tzinfo (~> 2.0)
18
- addressable (2.8.1)
23
+ addressable (2.8.5)
19
24
  public_suffix (>= 2.0.2, < 6.0)
20
25
  ansi (1.5.0)
21
26
  ast (2.4.2)
27
+ base64 (0.2.0)
28
+ bigdecimal (3.1.4)
22
29
  builder (3.2.4)
23
- colorize (0.8.1)
24
- concurrent-ruby (1.1.10)
25
- debug (1.7.1)
30
+ colorize (1.1.0)
31
+ concurrent-ruby (1.2.2)
32
+ connection_pool (2.4.1)
33
+ debug (1.8.0)
26
34
  irb (>= 1.5.0)
27
35
  reline (>= 0.3.1)
28
36
  declarative (0.0.20)
29
37
  diffy (3.4.2)
30
- faraday (2.7.2)
38
+ drb (2.2.0)
39
+ ruby2_keywords
40
+ faraday (2.7.12)
41
+ base64
31
42
  faraday-net_http (>= 2.0, < 3.1)
32
43
  ruby2_keywords (>= 0.0.4)
33
44
  faraday-net_http (3.0.2)
34
- google-apis-core (0.9.4)
45
+ google-apis-core (0.11.2)
35
46
  addressable (~> 2.5, >= 2.5.1)
36
47
  googleauth (>= 0.16.2, < 2.a)
37
48
  httpclient (>= 2.8.1, < 3.a)
@@ -42,76 +53,85 @@ GEM
42
53
  webrick
43
54
  google-apis-drive_v3 (0.33.0)
44
55
  google-apis-core (>= 0.9.1, < 2.a)
45
- google-apis-sheets_v4 (0.21.0)
46
- google-apis-core (>= 0.9.1, < 2.a)
47
- googleauth (1.3.0)
56
+ google-apis-sheets_v4 (0.26.0)
57
+ google-apis-core (>= 0.11.0, < 2.a)
58
+ googleauth (1.8.1)
48
59
  faraday (>= 0.17.3, < 3.a)
49
60
  jwt (>= 1.4, < 3.0)
50
- memoist (~> 0.16)
51
61
  multi_json (~> 1.11)
52
62
  os (>= 0.9, < 2.0)
53
63
  signet (>= 0.16, < 2.a)
54
64
  httpclient (2.8.3)
55
- i18n (1.12.0)
65
+ i18n (1.14.1)
56
66
  concurrent-ruby (~> 1.0)
57
67
  io-console (0.6.0)
58
- irb (1.6.2)
59
- reline (>= 0.3.0)
60
- json (2.6.3)
61
- jwt (2.6.0)
62
- memoist (0.16.2)
63
- mini_mime (1.1.2)
64
- minitest (5.17.0)
65
- minitest-reporters (1.5.0)
68
+ irb (1.10.1)
69
+ rdoc
70
+ reline (>= 0.3.8)
71
+ json (2.7.1)
72
+ jwt (2.7.1)
73
+ language_server-protocol (3.17.0.3)
74
+ mini_mime (1.1.5)
75
+ minitest (5.20.0)
76
+ minitest-reporters (1.6.1)
66
77
  ansi
67
78
  builder
68
79
  minitest (>= 5.0)
69
80
  ruby-progressbar
70
81
  multi_json (1.15.0)
82
+ mutex_m (0.2.0)
71
83
  os (1.1.4)
72
- parallel (1.22.1)
73
- parser (3.2.0.0)
84
+ parallel (1.23.0)
85
+ parser (3.2.2.4)
74
86
  ast (~> 2.4.1)
75
- public_suffix (5.0.1)
87
+ racc
88
+ psych (5.1.1.1)
89
+ stringio
90
+ public_suffix (5.0.4)
91
+ racc (1.7.3)
76
92
  rainbow (3.1.1)
77
- rake (13.0.6)
78
- regexp_parser (2.6.1)
79
- reline (0.3.2)
93
+ rake (13.1.0)
94
+ rdoc (6.6.1)
95
+ psych (>= 4.0.0)
96
+ regexp_parser (2.8.3)
97
+ reline (0.4.1)
80
98
  io-console (~> 0.5)
81
99
  representable (3.2.0)
82
100
  declarative (< 0.1.0)
83
101
  trailblazer-option (>= 0.1.1, < 0.2.0)
84
102
  uber (< 0.2.0)
85
103
  retriable (3.1.2)
86
- rexml (3.2.5)
87
- rubocop (1.43.0)
104
+ rexml (3.2.6)
105
+ rubocop (1.58.0)
88
106
  json (~> 2.3)
107
+ language_server-protocol (>= 3.17.0)
89
108
  parallel (~> 1.10)
90
- parser (>= 3.2.0.0)
109
+ parser (>= 3.2.2.4)
91
110
  rainbow (>= 2.2.2, < 4.0)
92
111
  regexp_parser (>= 1.8, < 3.0)
93
112
  rexml (>= 3.2.5, < 4.0)
94
- rubocop-ast (>= 1.24.1, < 2.0)
113
+ rubocop-ast (>= 1.30.0, < 2.0)
95
114
  ruby-progressbar (~> 1.7)
96
115
  unicode-display_width (>= 2.4.0, < 3.0)
97
- rubocop-ast (1.24.1)
98
- parser (>= 3.1.1.0)
99
- ruby-progressbar (1.11.0)
116
+ rubocop-ast (1.30.0)
117
+ parser (>= 3.2.1.0)
118
+ ruby-progressbar (1.13.0)
100
119
  ruby2_keywords (0.0.5)
101
- signet (0.17.0)
120
+ signet (0.18.0)
102
121
  addressable (~> 2.8)
103
122
  faraday (>= 0.17.5, < 3.a)
104
123
  jwt (>= 1.5, < 3.0)
105
124
  multi_json (~> 1.10)
125
+ stringio (3.1.0)
106
126
  trailblazer-option (0.1.2)
107
- tzinfo (2.0.5)
127
+ tzinfo (2.0.6)
108
128
  concurrent-ruby (~> 1.0)
109
129
  uber (0.1.0)
110
- unicode-display_width (2.4.2)
111
- webrick (1.7.0)
130
+ unicode-display_width (2.5.0)
131
+ webrick (1.8.1)
112
132
 
113
133
  PLATFORMS
114
- arm64-darwin-21
134
+ ruby
115
135
 
116
136
  DEPENDENCIES
117
137
  ad_localize!
data/Makefile ADDED
@@ -0,0 +1,14 @@
1
+ build:
2
+ gem build ad_localize.gemspec
3
+
4
+ install: clean build
5
+ gem install ad_localize-*.gem
6
+
7
+ publish: clean build
8
+ gem push ad_localize-*.gem
9
+
10
+ clean:
11
+ rm -f ad_localize-*.gem
12
+
13
+ tests:
14
+ bundle exec rake test
data/README.md CHANGED
@@ -86,6 +86,11 @@ $ ad_localize --auto-escape-percent
86
86
  $ ad_localize -l fr,en
87
87
  ```
88
88
 
89
+ * Keep extra spaces before and after translated values
90
+ ```
91
+ $ ad_localize --skip-value-stripping
92
+ ```
93
+
89
94
  ### In a Ruby program
90
95
  There are many possibilities when using AdLocalize in a ruby program. You can add support to your own wording format, support other platforms, select which locales you want to export, generate wording file content without writing on the disk and many more.
91
96
 
@@ -283,6 +288,15 @@ To see all available commands run `bundle exec rake -T` .
283
288
 
284
289
  Bug reports and pull requests are welcome on GitHub at https://github.com/applidium/ad_localize. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
285
290
 
291
+ ## How to release a new version
292
+
293
+ 1. After all your changes are reviewed and merged
294
+ 2. Create a `release` branch
295
+ 3. Update the version in `lib/ad_localize/version.rb`
296
+ 4. Execute `make publish`
297
+
298
+ You may need to configure your account at step `4.` if you've never pushed any gem. You can find all the informations you need on [the official documentation](https://guides.rubygems.org/make-your-own-gem/#your-first-gem).
299
+
286
300
  ## License
287
301
 
288
302
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile CHANGED
@@ -5,7 +5,13 @@ require "rake/testtask"
5
5
  Rake::TestTask.new(:test) do |t|
6
6
  t.libs << "test"
7
7
  t.libs << "lib"
8
- t.test_files = FileList["test/**/*_test.rb"]
8
+ t.test_files = FileList["test/**/*_test.rb"].exclude("**/private_drive_repository_test.rb")
9
+ end
10
+
11
+ Rake::TestTask.new(:test_private_google_sheet) do |t|
12
+ t.libs << "test"
13
+ t.libs << "lib"
14
+ t.test_files = FileList["test/**/private_drive_repository_test.rb"]
9
15
  end
10
16
 
11
17
  task :default => :test
data/ad_localize.gemspec CHANGED
@@ -39,16 +39,8 @@ Gem::Specification.new do |spec|
39
39
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
40
40
  spec.require_paths = ['lib']
41
41
 
42
- spec.add_development_dependency 'bundler', '>= 1.12.0', '< 3.0.0'
43
- spec.add_development_dependency 'rake', '>= 12.3.0', '< 14.0.0'
44
- spec.add_development_dependency 'minitest', '~> 5.11'
45
- spec.add_development_dependency 'minitest-reporters', '~> 1.3'
46
- spec.add_development_dependency 'diffy', '~> 3.3'
47
- spec.add_development_dependency 'debug', ">= 1.0.0", '< 2.0'
48
- spec.add_development_dependency 'rubocop', "~> 1.0"
49
-
50
42
  spec.add_dependency 'activesupport', '>= 6.1.3.2', '< 8.0'
51
- spec.add_dependency 'colorize', '~> 0.8'
43
+ spec.add_dependency 'colorize', '~> 1.0'
52
44
  spec.add_dependency 'google-apis-sheets_v4', '~> 0.9'
53
45
  spec.add_dependency 'google-apis-drive_v3', '~> 0.33.0'
54
46
 
@@ -23,7 +23,7 @@ module AdLocalize
23
23
 
24
24
  def map_plurals(coumpound_wordings:)
25
25
  result = {}
26
- coumpound_wordings.each do |label, simple_wordings|
26
+ coumpound_wordings.each_value do |simple_wordings|
27
27
  variants_hash = map_translations(translations: simple_wordings.values) do |keys, translation|
28
28
  dotted_key_to_hash(keys, { translation.key.variant_name => translation.value })
29
29
  end
@@ -7,6 +7,7 @@ module AdLocalize
7
7
  request.locales = options[:locales]
8
8
  request.bypass_empty_values = options[:'non-empty-values']
9
9
  request.auto_escape_percent = options[:'auto-escape-percent']
10
+ request.skip_value_stripping = options[:'skip-value-stripping']
10
11
  request.csv_paths = options[:csv_paths]
11
12
  request.merge_policy = options[:'merge-policy']
12
13
  request.output_path = options[:'target-dir']
@@ -5,6 +5,7 @@ module AdLocalize
5
5
  locales: Requests::ExportRequest::DEFAULTS[:locales],
6
6
  :'non-empty-values' => Requests::ExportRequest::DEFAULTS[:bypass_empty_values],
7
7
  :'auto-escape-percent' => Requests::ExportRequest::DEFAULTS[:auto_escape_percent],
8
+ :'skip-value-stripping' => Requests::ExportRequest::DEFAULTS[:skip_value_stripping],
8
9
  csv_paths: Requests::ExportRequest::DEFAULTS[:csv_paths],
9
10
  :'merge-policy' => Requests::ExportRequest::DEFAULTS[:merge_policy],
10
11
  :'target-dir' => Requests::ExportRequest::DEFAULTS[:output_path],
@@ -39,6 +40,7 @@ module AdLocalize
39
40
  end
40
41
  parser.on("-x", "--non-empty-values", TrueClass, 'Do not export keys with empty values (iOS only)')
41
42
  parser.on("--auto-escape-percent", TrueClass, 'Add escaping for % symbol to support wording use with String formatting (iOS only)')
43
+ parser.on("--skip-value-stripping", TrueClass, 'Disable the removal of leading and trailing whitespaces on wording values')
42
44
  end.parse!(options, into: args)
43
45
 
44
46
  args[:csv_paths] = options
@@ -73,7 +73,8 @@ module AdLocalize
73
73
  next if export_request.bypass_empty_values && value.blank?
74
74
 
75
75
  comment = row["#{COMMENT_KEY_COLUMN_IDENTIFIER} #{locale}"]
76
- wording[locale].add_wording(key: key, value: value&.strip, comment: comment)
76
+ value = value&.strip unless export_request.skip_value_stripping
77
+ wording[locale].add_wording(key: key, value: value, comment: comment)
77
78
  end
78
79
  added_keys[raw_key] = true
79
80
  end
@@ -17,7 +17,7 @@ module AdLocalize
17
17
  sheet_ids.filter_map do |sheet_id|
18
18
  begin
19
19
  url = export_url(spreadsheet_id: spreadsheet_id, sheet_id: sheet_id)
20
- string = @drive_service.http(:get, url, options: { retries: 3, max_elapsed_time: 60 })
20
+ string = @drive_service.http(:get, url, options: { retries: 5, max_elapsed_time: 120 })
21
21
  next unless string
22
22
 
23
23
  tempfile = Tempfile.new
@@ -6,6 +6,7 @@ module AdLocalize
6
6
  locales: [],
7
7
  bypass_empty_values: false,
8
8
  auto_escape_percent: false,
9
+ skip_value_stripping: false,
9
10
  csv_paths: [],
10
11
  merge_policy: Interactors::MergeWordings::DEFAULT_POLICY,
11
12
  output_path: Pathname.new('exports'),
@@ -23,6 +24,7 @@ module AdLocalize
23
24
  :locales,
24
25
  :bypass_empty_values,
25
26
  :auto_escape_percent,
27
+ :skip_value_stripping,
26
28
  :csv_paths,
27
29
  :merge_policy,
28
30
  :output_path,
@@ -38,6 +40,7 @@ module AdLocalize
38
40
  @locales = DEFAULTS[:locales]
39
41
  @bypass_empty_values = DEFAULTS[:bypass_empty_values]
40
42
  @auto_escape_percent = DEFAULTS[:auto_escape_percent]
43
+ @skip_value_stripping = DEFAULTS[:skip_value_stripping]
41
44
  @csv_paths = DEFAULTS[:csv_paths]
42
45
  @merge_policy = DEFAULTS[:merge_policy]
43
46
  @output_path = DEFAULTS[:output_path]
@@ -63,6 +66,10 @@ module AdLocalize
63
66
  @auto_escape_percent = [true, 'true'].include?(value)
64
67
  end
65
68
 
69
+ def skip_value_stripping=(value)
70
+ @skip_value_stripping = [true, 'true'].include?(value)
71
+ end
72
+
66
73
  def csv_paths=(value)
67
74
  return unless value.is_a? Array
68
75
 
@@ -127,6 +134,7 @@ module AdLocalize
127
134
  "locales: #{locales}, " \
128
135
  "bypass_empty_values: #{bypass_empty_values}, " \
129
136
  "auto_escape_percent: #{auto_escape_percent}, " \
137
+ "skip_value_stripping: #{skip_value_stripping}, " \
130
138
  "csv_paths: #{csv_paths}, " \
131
139
  "merge_policy: #{merge_policy}, " \
132
140
  "output_path: #{output_path}, " \
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module AdLocalize
3
- VERSION = "6.1.0"
3
+ VERSION = "6.2.0"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ad_localize
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.0
4
+ version: 6.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edouard Siegel
@@ -21,124 +21,8 @@ authors:
21
21
  autorequire:
22
22
  bindir: exe
23
23
  cert_chain: []
24
- date: 2023-09-12 00:00:00.000000000 Z
24
+ date: 2023-12-14 00:00:00.000000000 Z
25
25
  dependencies:
26
- - !ruby/object:Gem::Dependency
27
- name: bundler
28
- requirement: !ruby/object:Gem::Requirement
29
- requirements:
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: 1.12.0
33
- - - "<"
34
- - !ruby/object:Gem::Version
35
- version: 3.0.0
36
- type: :development
37
- prerelease: false
38
- version_requirements: !ruby/object:Gem::Requirement
39
- requirements:
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- version: 1.12.0
43
- - - "<"
44
- - !ruby/object:Gem::Version
45
- version: 3.0.0
46
- - !ruby/object:Gem::Dependency
47
- name: rake
48
- requirement: !ruby/object:Gem::Requirement
49
- requirements:
50
- - - ">="
51
- - !ruby/object:Gem::Version
52
- version: 12.3.0
53
- - - "<"
54
- - !ruby/object:Gem::Version
55
- version: 14.0.0
56
- type: :development
57
- prerelease: false
58
- version_requirements: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- version: 12.3.0
63
- - - "<"
64
- - !ruby/object:Gem::Version
65
- version: 14.0.0
66
- - !ruby/object:Gem::Dependency
67
- name: minitest
68
- requirement: !ruby/object:Gem::Requirement
69
- requirements:
70
- - - "~>"
71
- - !ruby/object:Gem::Version
72
- version: '5.11'
73
- type: :development
74
- prerelease: false
75
- version_requirements: !ruby/object:Gem::Requirement
76
- requirements:
77
- - - "~>"
78
- - !ruby/object:Gem::Version
79
- version: '5.11'
80
- - !ruby/object:Gem::Dependency
81
- name: minitest-reporters
82
- requirement: !ruby/object:Gem::Requirement
83
- requirements:
84
- - - "~>"
85
- - !ruby/object:Gem::Version
86
- version: '1.3'
87
- type: :development
88
- prerelease: false
89
- version_requirements: !ruby/object:Gem::Requirement
90
- requirements:
91
- - - "~>"
92
- - !ruby/object:Gem::Version
93
- version: '1.3'
94
- - !ruby/object:Gem::Dependency
95
- name: diffy
96
- requirement: !ruby/object:Gem::Requirement
97
- requirements:
98
- - - "~>"
99
- - !ruby/object:Gem::Version
100
- version: '3.3'
101
- type: :development
102
- prerelease: false
103
- version_requirements: !ruby/object:Gem::Requirement
104
- requirements:
105
- - - "~>"
106
- - !ruby/object:Gem::Version
107
- version: '3.3'
108
- - !ruby/object:Gem::Dependency
109
- name: debug
110
- requirement: !ruby/object:Gem::Requirement
111
- requirements:
112
- - - ">="
113
- - !ruby/object:Gem::Version
114
- version: 1.0.0
115
- - - "<"
116
- - !ruby/object:Gem::Version
117
- version: '2.0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: 1.0.0
125
- - - "<"
126
- - !ruby/object:Gem::Version
127
- version: '2.0'
128
- - !ruby/object:Gem::Dependency
129
- name: rubocop
130
- requirement: !ruby/object:Gem::Requirement
131
- requirements:
132
- - - "~>"
133
- - !ruby/object:Gem::Version
134
- version: '1.0'
135
- type: :development
136
- prerelease: false
137
- version_requirements: !ruby/object:Gem::Requirement
138
- requirements:
139
- - - "~>"
140
- - !ruby/object:Gem::Version
141
- version: '1.0'
142
26
  - !ruby/object:Gem::Dependency
143
27
  name: activesupport
144
28
  requirement: !ruby/object:Gem::Requirement
@@ -165,14 +49,14 @@ dependencies:
165
49
  requirements:
166
50
  - - "~>"
167
51
  - !ruby/object:Gem::Version
168
- version: '0.8'
52
+ version: '1.0'
169
53
  type: :runtime
170
54
  prerelease: false
171
55
  version_requirements: !ruby/object:Gem::Requirement
172
56
  requirements:
173
57
  - - "~>"
174
58
  - !ruby/object:Gem::Version
175
- version: '0.8'
59
+ version: '1.0'
176
60
  - !ruby/object:Gem::Dependency
177
61
  name: google-apis-sheets_v4
178
62
  requirement: !ruby/object:Gem::Requirement
@@ -223,6 +107,7 @@ files:
223
107
  - Gemfile
224
108
  - Gemfile.lock
225
109
  - LICENSE.txt
110
+ - Makefile
226
111
  - README.md
227
112
  - Rakefile
228
113
  - ad_localize.gemspec