lokalise_manager 6.1.0 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b3c30a729a77e6a27fef710604138f0fed6f0f48c019bba7cc3017ba9a70f5a8
4
- data.tar.gz: db85f6500fbbe0e5728c00abb2b51290353b5a6b47a18f160ec2dbaab39a37c5
3
+ metadata.gz: ce9b9b942692532290c3ce12a3ff3bd10be3307b5dc02d260c39ae5eaad57c1f
4
+ data.tar.gz: 5d34cbe4085559ff97546bc4c631384d66850b40f77f0ab75793470bd9f53e4f
5
5
  SHA512:
6
- metadata.gz: 19a205ecd21020dee1d506e0194be6ca964d0555cb7954d2eeb40ba14ab843870e056fc8e52a7ca306f791398d9e62589f272adc3419040d476e054d7435114d
7
- data.tar.gz: f768da94e78938fabd30a6080e9b0cfa97510b6b07e35598951e5bd85cd831910f859f70abe5efa33473cd3d5f402349a1cadefe3147135a37a947a95edcdfaf
6
+ metadata.gz: 03a95203f89fea97d053c2dab70cc2b8fba87f85f79a6ed52e0805f73d9cca5a6c0a1edd6016e45faf2882764db45e7578fa2ceb37c07f6b98483fbfdaea511a
7
+ data.tar.gz: 866d8609f239f884b7a24caad7cdd58564156cc6f3358e2f8e94b5945b36629839bd931c42340c66736b281e67b22d08915fa3eae55e687b9c749f8ef4f84f80
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 6.2.0 (25-Feb-2025)
4
+
5
+ * Strengthened configuration merging logic for `import_opts` and `export_opts` to retain default values when overridden.
6
+
7
+ ## 6.1.1 (20-Feb-2025)
8
+
9
+ * Prevent error swallowing in rare cases
10
+
3
11
  ## 6.1.0 (19-Feb-2025)
4
12
 
5
13
  * Added support for `import_async` option (default to `false`). When enabled, the [import process will happen in the background](https://developers.lokalise.com/reference/download-files-async) and the gem will use exponential backoff to wait for its completion according to the `max_retries_import` option.
@@ -64,7 +64,7 @@ module LokaliseManager
64
64
 
65
65
  # Return import options with defaults
66
66
  def import_opts
67
- @import_opts || {
67
+ defaults = {
68
68
  format: 'ruby_yaml',
69
69
  placeholder_format: :icu,
70
70
  yaml_include_root: true,
@@ -72,6 +72,8 @@ module LokaliseManager
72
72
  directory_prefix: '',
73
73
  indentation: '2sp'
74
74
  }
75
+
76
+ defaults.merge(@import_opts || {})
75
77
  end
76
78
 
77
79
  # Return export options
@@ -9,6 +9,8 @@ module LokaliseManager
9
9
  # Maximum number of concurrent uploads to avoid exceeding Lokalise API rate limits.
10
10
  MAX_THREADS = 6
11
11
 
12
+ ProcessResult = Struct.new(:success, :process, :path, :error, keyword_init: true)
13
+
12
14
  # Exports translation files to Lokalise in batches to optimize performance.
13
15
  #
14
16
  # - Validates configuration.
@@ -49,7 +51,7 @@ module LokaliseManager
49
51
  def raise_on_fail(thread)
50
52
  return if thread.success
51
53
 
52
- raise thread.error.class, "Error while trying to upload #{thread.path}: #{thread.error.message}"
54
+ raise thread.error
53
55
  end
54
56
 
55
57
  # Uploads a single file to Lokalise.
@@ -60,15 +62,13 @@ module LokaliseManager
60
62
  # @param r_path [Pathname] Relative file path within the project.
61
63
  # @return [Struct] Struct containing upload status, process details, and error (if any).
62
64
  def do_upload(f_path, r_path)
63
- proc_klass = Struct.new(:success, :process, :path, :error, keyword_init: true)
64
-
65
65
  process = with_exp_backoff(config.max_retries_export) do
66
66
  api_client.upload_file(project_id_with_branch, opts(f_path, r_path))
67
67
  end
68
68
 
69
- proc_klass.new(success: true, process: process, path: f_path)
69
+ ProcessResult.new(success: true, process: process, path: f_path)
70
70
  rescue StandardError => e
71
- proc_klass.new(success: false, path: f_path, error: e)
71
+ ProcessResult.new(success: false, path: f_path, error: e)
72
72
  end
73
73
 
74
74
  # Prints a message indicating that the export process is complete.
@@ -99,8 +99,6 @@ module LokaliseManager
99
99
  Zip::File.open_buffer(open_file_or_remote(path)) do |zip|
100
100
  zip.each { |entry| process_entry(entry) if proper_ext?(entry.name) }
101
101
  end
102
- rescue StandardError => e
103
- raise e.class, "Error processing ZIP file: #{e.message}"
104
102
  end
105
103
 
106
104
  # Extracts data from a ZIP entry and writes it to the correct directory.
@@ -116,8 +114,6 @@ module LokaliseManager
116
114
  FileUtils.mkdir_p File.dirname(full_path)
117
115
 
118
116
  File.write(full_path, config.translations_converter.call(data), mode: 'w+:UTF-8')
119
- rescue StandardError => e
120
- raise e.class, "Error processing entry #{zip_entry.name}: #{e.message}"
121
117
  end
122
118
 
123
119
  # Checks whether the import should proceed under safe mode constraints.
@@ -157,8 +153,6 @@ module LokaliseManager
157
153
  # @return [Object] The result of the successful operation.
158
154
  def fetch_with_retry(&block)
159
155
  with_exp_backoff(config.max_retries_import, &block)
160
- rescue StandardError => e
161
- raise e.class, "Error during file download: #{e.message}"
162
156
  end
163
157
  end
164
158
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LokaliseManager
4
- VERSION = '6.1.0'
4
+ VERSION = '6.2.0'
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lokalise_manager
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
  - Ilya Krukowski
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-02-19 00:00:00.000000000 Z
10
+ date: 2025-02-25 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: base64
@@ -250,7 +250,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
250
250
  - !ruby/object:Gem::Version
251
251
  version: '0'
252
252
  requirements: []
253
- rubygems_version: 3.6.3
253
+ rubygems_version: 3.6.5
254
254
  specification_version: 4
255
255
  summary: Lokalise integration for Ruby
256
256
  test_files: []