lokalise_manager 3.3.0 → 5.0.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: eec5391729d2e75849846e323f88ca9817b01b0fa67c3293c7a14a23edbfea7a
4
- data.tar.gz: 8ce91e9c150e5a7c93c7009f027160ceeab4b3e5ebcec3928cf4cfd51476bfc8
3
+ metadata.gz: 31b3524b3186c5fa2f6ff2f915cf45dc2cc26f69c615ff6d44fffd6581286222
4
+ data.tar.gz: 324ce28075eb3d6cacfda2076ac5b0d9b18a0750026e464e99ebb8b9aafa70d5
5
5
  SHA512:
6
- metadata.gz: cb1433d03eb8c52017600dd6833c8cb0214de4ffdaf0215c4bbe700794f3a10ea260f787e56a6393796943d48973e93161314e78f0f330120f3e0478b8895a07
7
- data.tar.gz: f109171b02e72eee8ded4aa43c549815170903e0dd6a4b14cc37b20a2b93282dc1f588e8be75c5cceb0e92ac77ec41ee1ad9888e65009d7997d1c61938bf73da
6
+ metadata.gz: 207900d1455053cc5246892f53ceed6027d2335ced167702e8f9c2eb977b0ce037f089cf447d8b4941bcd49d940de9d66a88c078df147c7ad23cad30e001b230
7
+ data.tar.gz: 14cc73a9f1a2fe3cad5716e9fe11bb68ad991eb239fc0d2aac45322b3237faf7644b7da403b2124733107e7f29a3e78cba3c510c77993d8f8339753112cd2b16
data/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.0.0 (09-Nov-2023)
4
+
5
+ * **Breaking change**: require Ruby 3+. Version 2.7 has reached end-of-life and thus we are not planning to support it anymore. If you need support for Ruby 2.7, please stay on 4.0.0.
6
+ * **Potential breaking change**: lambda returned by the `lang_iso_inferer` method has been slightly enhanced. It now accepts not only the file data but also the full path to the file. Therefore, if you redefine the `lang_iso_inferer` option please make sure that the returned lambda accepts two params, not one. This way, you can be more flexible when inferring the locale. For example:
7
+
8
+ ```ruby
9
+ lang_iso_inferer: ->(_data, path) { path.basename('.yml').to_s }
10
+ ```
11
+
12
+ * Use ruby-lokalise-api v9.0.0
13
+
14
+ ## 4.0.0 (27-Jul-2023)
15
+
16
+ * **Use ruby-lokalise-api version 8**. It should not introduce any breaking changes (as main methods have similar signatures) but you should be aware that v8 is a complete rewrite of the original SDK so please make sure your tests pass.
17
+ * Replace VCR with WebMock in tests
18
+ * Various minor updates
19
+ * Do not test with Ruby 2.7 (EOL)
20
+
3
21
  ## 3.3.0 (18-Nov-22)
4
22
 
5
23
  * Use newer ruby-lokalise-api
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2022 Lokalise team, Ilya Krukowski
3
+ Copyright (c) 2023 Ilya Krukowski
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -2,7 +2,8 @@
2
2
 
3
3
  ![Gem](https://img.shields.io/gem/v/lokalise_manager)
4
4
  ![CI](https://github.com/bodrovis/lokalise_manager/actions/workflows/ci.yml/badge.svg)
5
- [![Test Coverage](https://codecov.io/gh/bodrovis/lokalise_manager/graph/badge.svg)](https://codecov.io/gh/bodrovis/lokalise_manager)
5
+ [![Coverage Status](https://coveralls.io/repos/github/bodrovis/lokalise_manager/badge.svg?branch=master)](https://coveralls.io/github/bodrovis/lokalise_manager?branch=master)
6
+ [![Maintainability](https://api.codeclimate.com/v1/badges/9b682367a274ee3dcdee/maintainability)](https://codeclimate.com/github/bodrovis/lokalise_manager/maintainability)
6
7
  ![Downloads total](https://img.shields.io/gem/dt/lokalise_manager)
7
8
 
8
9
  This gem provides [Lokalise](http://lokalise.com) integration for Ruby and allows to exchange translation files between your project and TMS easily. It relies on [ruby-lokalise-api](https://lokalise.github.io/ruby-lokalise-api) to send APIv2 requests.
@@ -202,7 +203,7 @@ If your translation files are not in YAML format, you will need to adjust the fo
202
203
  * `file_ext_regexp` (`regexp`) — regular expression applied to file extensions to determine which files should be imported and exported. Defaults to `/\.ya?ml\z/i` (YAML files).
203
204
  * `translations_loader` (`lambda` or `proc`) — loads translations data and makes sure they are valid before saving them to a translation file. Defaults to `->(raw_data) { YAML.safe_load raw_data }`. In the simplest case you may just return the data back, for example `-> (raw_data) { raw_data }`.
204
205
  * `translations_converter` (`lambda` or `proc`) — converts translations data to a proper format before saving them to a translation file. Defaults to `->(raw_data) { YAML.dump(raw_data).gsub(/\\\\n/, '\n') }`. In the simplest case you may just return the data back, for example `-> (raw_data) { raw_data }`.
205
- * `lang_iso_inferer` (`lambda` or `proc`) — infers language ISO code based on the translation file data before uploading it to Lokalise. Defaults to `->(data) { YAML.safe_load(data)&.keys&.first }`.
206
+ * `lang_iso_inferer` (`lambda` or `proc`) — infers language ISO code based on the translation file data and path before uploading it to Lokalise. Defaults to `->(data, _path) { YAML.safe_load(data)&.keys&.first }`. To infer locale based on the filename, you can use something like `->(_data, path) { path.basename('.yml').to_s }`. `path` is an instance of the `Pathname` class.
206
207
 
207
208
  ### Customizing JSON parser and network adapter
208
209
 
@@ -297,9 +298,9 @@ importer.import!
297
298
 
298
299
  ## Running tests
299
300
 
300
- 1. Copypaste `.env.example` file as `.env`. Put your Lokalise API token and project ID inside. The `.env` file is excluded from version control so your data is safe. All in all, we use pre-recorded VCR cassettes, so the actual API requests won’t be sent. However, providing at least some values is required.
301
+ 1. Copypaste `.env.example` file as `.env`. Put your Lokalise API token and project ID inside. The `.env` file is excluded from version control so your data is safe. All in all, we use stubs, so the actual API requests won’t be sent. However, providing at least some values is required.
301
302
  2. Run `rspec .`. Observe test results and code coverage.
302
303
 
303
304
  ## License
304
305
 
305
- Copyright (c) [Lokalise team](http://lokalise.com), [Ilya Krukowski](http://bodrovis.tech). License type is [MIT](https://github.com/bodrovis/lokalise_manager/blob/master/LICENSE).
306
+ Copyright (c) [Ilya Krukowski](http://bodrovis.tech). License type is [MIT](https://github.com/bodrovis/lokalise_manager/blob/master/LICENSE).
@@ -95,12 +95,14 @@ module LokaliseManager
95
95
 
96
96
  # Converts translations data to the proper format
97
97
  def translations_converter
98
- @translations_converter || ->(raw_data) { YAML.dump(raw_data).gsub(/\\\\n/, '\n') }
98
+ @translations_converter || ->(raw_data) { YAML.dump(raw_data).gsub('\\\\n', '\n') }
99
99
  end
100
100
 
101
101
  # Infers lang ISO for the given translation file
102
+ # The lambda expects to accept the raw contents of the translation file
103
+ # and the full path to the file (instance of the `Pathname` class)
102
104
  def lang_iso_inferer
103
- @lang_iso_inferer || ->(data) { YAML.safe_load(data)&.keys&.first }
105
+ @lang_iso_inferer || ->(data, _path) { YAML.safe_load(data)&.keys&.first }
104
106
  end
105
107
  end
106
108
  end
@@ -17,10 +17,10 @@ module LokaliseManager
17
17
  # @param custom_opts [Hash]
18
18
  # @param global_config [Object]
19
19
  def initialize(custom_opts = {}, global_config = LokaliseManager::GlobalConfig)
20
- primary_opts = global_config.
21
- singleton_methods.
22
- filter { |m| m.to_s.end_with?('=') }.
23
- each_with_object({}) do |method, opts|
20
+ primary_opts = global_config
21
+ .singleton_methods
22
+ .filter { |m| m.to_s.end_with?('=') }
23
+ .each_with_object({}) do |method, opts|
24
24
  reader = method.to_s.delete_suffix('=')
25
25
  opts[reader.to_sym] = global_config.send(reader)
26
26
  end
@@ -84,7 +84,7 @@ module LokaliseManager
84
84
  initial_opts = {
85
85
  data: Base64.strict_encode64(content.strip),
86
86
  filename: relative_p,
87
- lang_iso: config.lang_iso_inferer.call(content)
87
+ lang_iso: config.lang_iso_inferer.call(content, full_p)
88
88
  }
89
89
 
90
90
  initial_opts.merge config.export_opts
@@ -19,7 +19,7 @@ module LokaliseManager
19
19
  return false
20
20
  end
21
21
 
22
- open_and_process_zip download_files['bundle_url']
22
+ open_and_process_zip download_files.bundle_url
23
23
 
24
24
  $stdout.print('Task complete!') unless config.silent_mode
25
25
  true
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LokaliseManager
4
- VERSION = '3.3.0'
4
+ VERSION = '5.0.0'
5
5
  end
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'zeitwerk'
4
4
  require 'yaml'
5
- require 'psych'
6
5
 
7
6
  loader = Zeitwerk::Loader.for_gem
8
7
  loader.setup
@@ -8,11 +8,12 @@ Gem::Specification.new do |spec|
8
8
  spec.authors = ['Ilya Krukowski']
9
9
  spec.email = ['golosizpru@gmail.com']
10
10
  spec.summary = 'Lokalise integration for Ruby'
11
- spec.description = 'This gem contains a collection of some common tasks for Lokalise. Specifically, it allows to import/export translation files from/to Lokalise TMS.'
11
+ spec.description = 'This gem contains a collection of some common tasks for Lokalise. Specifically, ' \
12
+ 'it allows to import/export translation files from/to Lokalise TMS.'
12
13
  spec.homepage = 'https://github.com/bodrovis/lokalise_manager'
13
14
  spec.license = 'MIT'
14
15
  spec.platform = Gem::Platform::RUBY
15
- spec.required_ruby_version = '>= 2.7'
16
+ spec.required_ruby_version = '>= 3.0'
16
17
 
17
18
  spec.files = Dir['README.md', 'LICENSE',
18
19
  'CHANGELOG.md', 'lib/**/*.rb',
@@ -22,11 +23,10 @@ Gem::Specification.new do |spec|
22
23
  spec.extra_rdoc_files = ['README.md']
23
24
  spec.require_paths = ['lib']
24
25
 
25
- spec.add_dependency 'ruby-lokalise-api', '~> 7'
26
+ spec.add_dependency 'ruby-lokalise-api', '~> 9.0'
26
27
  spec.add_dependency 'rubyzip', '~> 2.3'
27
28
  spec.add_dependency 'zeitwerk', '~> 2.4'
28
29
 
29
- spec.add_development_dependency 'codecov', '~> 0.2'
30
30
  spec.add_development_dependency 'dotenv', '~> 2.5'
31
31
  spec.add_development_dependency 'rake', '~> 13.0'
32
32
  spec.add_development_dependency 'rspec', '~> 3.6'
@@ -35,7 +35,8 @@ Gem::Specification.new do |spec|
35
35
  spec.add_development_dependency 'rubocop-rake', '~> 0.6'
36
36
  spec.add_development_dependency 'rubocop-rspec', '~> 2.6'
37
37
  spec.add_development_dependency 'simplecov', '~> 0.16'
38
- spec.add_development_dependency 'vcr', '~> 6.0'
38
+ spec.add_development_dependency 'simplecov-lcov', '~> 0.8'
39
+ spec.add_development_dependency 'webmock', '~> 3.18'
39
40
  spec.metadata = {
40
41
  'rubygems_mfa_required' => 'true'
41
42
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lokalise_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilya Krukowski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-18 00:00:00.000000000 Z
11
+ date: 2023-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-lokalise-api
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '7'
19
+ version: '9.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '7'
26
+ version: '9.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rubyzip
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '2.4'
55
- - !ruby/object:Gem::Dependency
56
- name: codecov
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '0.2'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '0.2'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: dotenv
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -179,19 +165,33 @@ dependencies:
179
165
  - !ruby/object:Gem::Version
180
166
  version: '0.16'
181
167
  - !ruby/object:Gem::Dependency
182
- name: vcr
168
+ name: simplecov-lcov
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '0.8'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '0.8'
181
+ - !ruby/object:Gem::Dependency
182
+ name: webmock
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
185
  - - "~>"
186
186
  - !ruby/object:Gem::Version
187
- version: '6.0'
187
+ version: '3.18'
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - "~>"
193
193
  - !ruby/object:Gem::Version
194
- version: '6.0'
194
+ version: '3.18'
195
195
  description: This gem contains a collection of some common tasks for Lokalise. Specifically,
196
196
  it allows to import/export translation files from/to Lokalise TMS.
197
197
  email:
@@ -231,14 +231,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
231
231
  requirements:
232
232
  - - ">="
233
233
  - !ruby/object:Gem::Version
234
- version: '2.7'
234
+ version: '3.0'
235
235
  required_rubygems_version: !ruby/object:Gem::Requirement
236
236
  requirements:
237
237
  - - ">="
238
238
  - !ruby/object:Gem::Version
239
239
  version: '0'
240
240
  requirements: []
241
- rubygems_version: 3.3.26
241
+ rubygems_version: 3.4.21
242
242
  signing_key:
243
243
  specification_version: 4
244
244
  summary: Lokalise integration for Ruby