ad_localize 4.0.0 → 4.0.5

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: 1581d41a8d5a3f41dc91cf69f4b8abfdf8c2121695cf116a46c738825818cbd9
4
- data.tar.gz: 64af1cc80f9e9247514c334e13f6252e267283e3c38ade2d3111a4deb252164b
3
+ metadata.gz: 9b804cc7ea11e917f21e49070d5677aac22f642445906825735cccc7f651d167
4
+ data.tar.gz: 6e78a8ac87a098836436bff04fadf77da9e979cb2a665da30fe8e708a7f3acf0
5
5
  SHA512:
6
- metadata.gz: 0ebfdd0a7746acdaa06b713c6f129b04b7a81fb0441bf5975a47b415b892dd135b87c3e99e0610a98584adb2317f4d170a64230f932db3a3c0c3ecf8d00eabee
7
- data.tar.gz: bd9a7140d68dc5f76c6c9e0dc19342180083205079d6d4e6022c0039176ae36f9e8c50441dec84bd5ea89f6596812c998be246163c3a9942e5fd9661379c3c30
6
+ metadata.gz: 7f7d5c2d82c023bce6ea8309fcdcf3cfb3e29878585cec31fecbc35db3c264cccf474c12cf58847297874684304537e35c469ea401b7eb4dd623e1baedff8db5
7
+ data.tar.gz: 0ceca200f147a4cf93231a4e8bf846c32ee909e199008c512671f1c12d3653e621e70d4417b12de648758ffcecd3a67dd58d8854292c3b7c50069f649a376e7b
@@ -4,12 +4,37 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [4.0.5] - 2020-11-12
8
+ ### Fixed
9
+ - Fix csv file type check (also add compatibility with macOS Big Sur)
10
+
11
+ ## [4.0.4] - 2020-11-09
12
+ ### Fixed
13
+ - Fix android special character escaping [#56](https://github.com/applidium/ad_localize/issues/56)
14
+ - Fix platform filter on export [#55](https://github.com/applidium/ad_localize/issues/55)
15
+
16
+ ### Changed
17
+ - Use default terminal color for debug log
18
+
19
+ ## [4.0.3] - 2020-10-27
20
+ ### Fixed
21
+ - Fix CSV detection and remove dependency to MimeType gem
22
+ - Fix drive key detection in options
23
+
24
+ ## [4.0.2] - 2020-10-26
25
+ ### Fixed
26
+ - Use percent HTML char for escaping '%' on android. [#49](https://github.com/applidium/ad_localize/pull/49) by [flolom](https://github.com/flolom)
27
+
28
+ ## [4.0.1] - 2020-10-19
29
+ ### Fixed
30
+ - delete downloaded files even when any of them is a CSV file
31
+
7
32
  ## [4.0.0] - 2020-10-19
8
33
  ### Breaking change
9
34
  - Precedence to csv files. Only CSV files will be exported if both csv file and google spreadsheet are provided
10
35
  - In case of multiple CSVs or sheet ids, you should be aware that all sources will be merged. By default the merge policy to keep the first wording translation for each key
11
36
  - New architecture. Separate export process responsibilities in dedicated classes. Fixes [#48](https://github.com/applidium/ad_localize/issues/48), [#20](https://github.com/applidium/ad_localize/issues/20)
12
-
37
+
13
38
  ### Changed
14
39
  - it is now possible to provide an output path path that does not exist
15
40
  - if a service account configuration is provided, there won't be any files downloaded
@@ -20,8 +45,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
20
45
  - tests for ad_localize class are restricted to the minimum
21
46
  - No more file generated when there are no data to export
22
47
  - Less verbose logs. Now, they only describe the different steps of the export process
23
- - do not add `InfoPlist` translations to android `strings.xml`
24
-
48
+ - do not add `InfoPlist` translations to android `strings.xml`
49
+
25
50
  ### Added
26
51
  - -e, -export_all_sheets option export all sheets from a spreadsheet by [@sjcqs](https://github.com/sjcqs)
27
52
  - -m, --merge-option to select the merge policy (`keep` or `replace`) by [@sjcqs](https://github.com/sjcqs)
@@ -33,7 +58,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
33
58
  - dedicated folder for fixture files
34
59
  - add ability to use AdLocalize in a Ruby program
35
60
  - add documentation for JSON and YAML support. Fixes [#23](https://github.com/applidium/ad_localize/issues/23)
36
-
61
+
37
62
  ### Fixed
38
63
  - comments will now be added to iOS and Android plural files
39
64
  - do not remove existing files in export output folder. Fixes [#40](https://github.com/applidium/ad_localize/issues/40)
@@ -42,8 +67,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
42
67
  - no more option -a option to indicate that a service account configuration will be provided. If set, the environment variable `GCLOUD_CLIENT_SECRET` content will be used
43
68
  - no more substitution of empty wording with by "Missing Translation" when using the option -d
44
69
  - no more Makefile, the Rakefile is sufficient. Use `bundle exec rake -T` to display the available commands
45
- - no more check for ordered interpolation variables in translations
46
-
70
+ - no more check for ordered interpolation variables in translations
71
+
47
72
  ## [3.6.0] - 2020-06-23
48
73
  ### Added
49
74
  - add documentation for service account usage by [@sjcqs](https://github.com/sjcqs)
@@ -1,18 +1,17 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ad_localize (4.0.0)
4
+ ad_localize (4.0.5)
5
5
  activesupport (>= 5.2, < 7.0)
6
6
  colorize (~> 0.8)
7
7
  google-api-client (~> 0.34)
8
8
  googleauth (~> 0.12)
9
- mime-types (~> 3.3)
10
9
  nokogiri (~> 1.10)
11
10
 
12
11
  GEM
13
12
  remote: https://rubygems.org/
14
13
  specs:
15
- activesupport (6.0.3.3)
14
+ activesupport (6.0.3.4)
16
15
  concurrent-ruby (~> 1.0, >= 1.0.2)
17
16
  i18n (>= 0.7, < 2)
18
17
  minitest (~> 5.1)
@@ -28,17 +27,19 @@ GEM
28
27
  declarative (0.0.20)
29
28
  declarative-option (0.1.0)
30
29
  diffy (3.3.0)
31
- faraday (1.0.1)
30
+ faraday (1.1.0)
32
31
  multipart-post (>= 1.2, < 3)
33
- google-api-client (0.44.1)
32
+ ruby2_keywords
33
+ google-api-client (0.46.2)
34
34
  addressable (~> 2.5, >= 2.5.1)
35
35
  googleauth (~> 0.9)
36
36
  httpclient (>= 2.8.1, < 3.0)
37
37
  mini_mime (~> 1.0)
38
38
  representable (~> 3.0)
39
39
  retriable (>= 2.0, < 4.0)
40
+ rexml
40
41
  signet (~> 0.12)
41
- googleauth (0.13.1)
42
+ googleauth (0.14.0)
42
43
  faraday (>= 0.17.3, < 2.0)
43
44
  jwt (>= 1.4, < 3.0)
44
45
  memoist (~> 0.16)
@@ -50,9 +51,6 @@ GEM
50
51
  concurrent-ruby (~> 1.0)
51
52
  jwt (2.2.2)
52
53
  memoist (0.16.2)
53
- mime-types (3.3.1)
54
- mime-types-data (~> 3.2015)
55
- mime-types-data (3.2020.0512)
56
54
  mini_mime (1.0.2)
57
55
  mini_portile2 (2.4.0)
58
56
  minitest (5.14.0)
@@ -73,7 +71,9 @@ GEM
73
71
  declarative-option (< 0.2.0)
74
72
  uber (< 0.2.0)
75
73
  retriable (3.1.2)
74
+ rexml (3.2.4)
76
75
  ruby-progressbar (1.10.1)
76
+ ruby2_keywords (0.0.2)
77
77
  signet (0.14.0)
78
78
  addressable (~> 2.3)
79
79
  faraday (>= 0.17.3, < 2.0)
data/README.md CHANGED
@@ -91,7 +91,7 @@ To use a private google spreasheet you need to use a Google Cloud Service Accoun
91
91
  - Go to *IAM & Admin / Service Account* and create a new service account.
92
92
  - Store the created `client-secret.json` (in a password manager for example)
93
93
  2. Enable Google Spreadsheet API for the project
94
- - Go to *API / Library* and enable the **Drive API** there.
94
+ - Go to *API / Library* and enable the **Google Spreadsheet API** there.
95
95
  3. Add the service account to a spreadsheet.
96
96
  - In *IAM & Admin / Service Account*, the service account's email is listed. Invite it to the spreadsheet to export.
97
97
 
@@ -51,7 +51,6 @@ Gem::Specification.new do |spec|
51
51
  spec.add_dependency 'colorize', '~> 0.8'
52
52
  spec.add_dependency 'google-api-client', '~> 0.34'
53
53
  spec.add_dependency 'googleauth', '~> 0.12'
54
- spec.add_dependency 'mime-types', '~> 3.3'
55
54
 
56
55
  spec.required_ruby_version = '~> 2.3'
57
56
  end
@@ -9,7 +9,6 @@ require 'logger'
9
9
  require 'colorize'
10
10
  require 'optparse'
11
11
  require 'nokogiri'
12
- require 'mime/types'
13
12
  require 'erb'
14
13
  require 'googleauth'
15
14
  require 'google/apis/sheets_v4'
@@ -18,7 +18,7 @@ module AdLocalize
18
18
  end
19
19
 
20
20
  def debug(text)
21
- log(level: Logger::DEBUG, text: text.black)
21
+ log(level: Logger::DEBUG, text: text)
22
22
  end
23
23
 
24
24
  def info!
@@ -33,13 +33,13 @@ module AdLocalize
33
33
  export_request.csv_paths = downloaded_files.map(&:path)
34
34
  if export_request.has_csv_files?
35
35
  ExportCSVFiles.new.call(export_request: export_request)
36
- downloaded_files.select { |downloaded_file| File.exist?(downloaded_file.path) }.each do |downloaded_file|
37
- downloaded_file.close
38
- downloaded_file.unlink
39
- end
40
36
  else
41
37
  LOGGER.error("invalid export request. check the spreadsheet share configuration")
42
38
  end
39
+ downloaded_files.select { |downloaded_file| File.exist?(downloaded_file.path) }.each do |downloaded_file|
40
+ downloaded_file.close
41
+ downloaded_file.unlink
42
+ end
43
43
  end
44
44
 
45
45
  def download_public_sheet(url:)
@@ -5,12 +5,16 @@ module AdLocalize
5
5
 
6
6
  def sanitize_value(value:)
7
7
  return if value.blank?
8
- processedValue = value.gsub(/(?<!\\)'/, "\\\\'") # match ' unless there is a \ before
9
- processedValue = processedValue.gsub(/(?<!\\)\"/, "\\\"") # match " unless there is a \ before
8
+ processedValue = value.gsub(/(?<!\\)'/, '&#39;') # match ' unless there is a \ before
9
+ processedValue = processedValue.gsub(/(?<!\\)\"/, '&#34;') # match " unless there is a \ before
10
+ processedValue = processedValue.gsub(">", '&gt;')
11
+ processedValue = processedValue.gsub("<", '&lt;')
10
12
  processedValue = processedValue.gsub(/(%(\d+\$)?@)/, '%\2s') # should match values like %1$s and %s
11
13
  processedValue = processedValue.gsub(/(%((\d+\$)?(\d+)?)i)/, '%\2d') # should match values like %i, %3$i, %01i, %1$02i
12
- processedValue = processedValue.gsub(/%(?!((\d+\$)?(s|(\d+)?d)))/, '%%') # negative lookahead: identifies when user really wants to display a %
14
+ processedValue = processedValue.gsub(/%(?!((\d+\$)?(s|(\d+)?d)))/, '&#37;') # negative lookahead: identifies when user really wants to display a %
13
15
  processedValue = processedValue.gsub("\\U", "\\u")
16
+ processedValue = processedValue.gsub(/&(?!((#\d+)|(\w+));)/, '&#38;')
17
+ processedValue = processedValue.gsub(/&/) { |match| match.replace('\&') }
14
18
  "\"#{processedValue}\""
15
19
  end
16
20
  end
@@ -3,7 +3,7 @@ module AdLocalize
3
3
  class OptionsToExportRequest
4
4
  def map(options:)
5
5
  Requests::ExportRequest.new(
6
- platform_codes: options[:only],
6
+ platforms: options[:only],
7
7
  g_spreadsheet_options: map_g_spreadsheet_options(options: options),
8
8
  verbose: options[:debug],
9
9
  output_path: options[:'target-dir'],
@@ -15,7 +15,7 @@ module AdLocalize
15
15
  private
16
16
 
17
17
  def map_g_spreadsheet_options(options:)
18
- return unless options[:drive_key]
18
+ return unless options[:'drive-key']
19
19
  Requests::GSpreadsheetOptions.new(
20
20
  spreadsheet_id: options[:'drive-key'],
21
21
  sheet_ids: options[:'sheets'],
@@ -3,7 +3,7 @@ module AdLocalize
3
3
  class ExportRequest
4
4
  SUPPORTED_PLATFORMS = %w(ios android yml json properties).freeze
5
5
  DEFAULT_EXPORT_FOLDER = 'exports'.freeze
6
- CSV_CONTENT_TYPES = %w(text/csv text/plain).freeze
6
+ CSV_CONTENT_TYPES = %w(text/csv text/plain application/csv).freeze
7
7
 
8
8
  def initialize(**args)
9
9
  @locales = Array(args[:locales].presence)
@@ -61,7 +61,7 @@ module AdLocalize
61
61
  end
62
62
 
63
63
  def is_csv?(path:)
64
- (MIME::Types.of(path).map(&:content_type) & CSV_CONTENT_TYPES).present?
64
+ CSV_CONTENT_TYPES.include?(`file --brief --mime-type "#{path}"`.strip)
65
65
  end
66
66
 
67
67
  def valid_g_spreadsheet_options?
@@ -1,3 +1,3 @@
1
1
  module AdLocalize
2
- VERSION = "4.0.0"
2
+ VERSION = "4.0.5"
3
3
  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: 4.0.0
4
+ version: 4.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edouard Siegel
@@ -188,20 +188,6 @@ dependencies:
188
188
  - - "~>"
189
189
  - !ruby/object:Gem::Version
190
190
  version: '0.12'
191
- - !ruby/object:Gem::Dependency
192
- name: mime-types
193
- requirement: !ruby/object:Gem::Requirement
194
- requirements:
195
- - - "~>"
196
- - !ruby/object:Gem::Version
197
- version: '3.3'
198
- type: :runtime
199
- prerelease: false
200
- version_requirements: !ruby/object:Gem::Requirement
201
- requirements:
202
- - - "~>"
203
- - !ruby/object:Gem::Version
204
- version: '3.3'
205
191
  description: |-
206
192
  AdLocalize produces localization files from platform agnostic wording.
207
193
  Supported wording format : CSV. Supported export format: iOS, Android, JSON and YAML