lokalise_manager 2.1.0 → 2.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: f3a7da094cb7939fd6826c89afbbbc525dff59b553a23fba7b49ed38046e68b9
4
- data.tar.gz: c0a323464c864d12042f126d765a483adc128a4397604d012cdeadee31003fcf
3
+ metadata.gz: fa7eb812b614ec768710c4f085879dfaf6cf89f72e25b1a777f34af3e9cd8be5
4
+ data.tar.gz: afdd4c08bf9672302c279cd88b4c4caf63317b1aca98036a5e8c1dad361289f0
5
5
  SHA512:
6
- metadata.gz: 79c0b5a93767b5ffa8cd55dbf6591a90cafbb586043e8e75ca040761b8fa882882971783358e6d342afab96e298d34c67ca5d414d376c909fa564e8ad03d2466
7
- data.tar.gz: ed2ad8e59fb6e15db8ba7c60de48e808c2eab0ff94b8f287c54bb2e618e1c930d5d3244a2483a6e61e69b7094943a05db59ea54ef32fc3596ef344f5956553ee
6
+ metadata.gz: 5857c35bde158e85bdec5c2e4618ebf1ddc7768f5822d5492109347fa93907434869d23c5053f6c7b98da8016e4e22c40fa8fa4b513c347630aeb18288f8d18d
7
+ data.tar.gz: 02bbc800a21396c6f106b2c18df5eee2f7247d43fac80da656496d4a8ec6a50c8d9438bb3514d13b57647f29aebfb1caf1e633a79d97eb37e30ae6bbb2634ecd
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.2.0 (23-Feb-22)
4
+
5
+ * Use ruby-lokalise-api v5
6
+ * Don't use any compression options (compression is now enabled by default)
7
+ * Update tests
8
+
3
9
  ## 2.1.0 (27-Jan-22)
4
10
 
5
11
  * **Breaking change**: `export!` will now return an array of objects responding to the following methods:
data/README.md CHANGED
@@ -43,7 +43,7 @@ importer = LokaliseManager.importer api_token: '1234abc', project_id: '123.abc'
43
43
  exporter = LokaliseManager.exporter api_token: '1234abc', project_id: '123.abc'
44
44
  ```
45
45
 
46
- You *must* provide an API token and a project ID (your project ID can be found under Lokalise project settings). [Other options can be customized as well (see below)](https://github.com/bodrovis/lokalise_manager#configuration) but they have sensible defaults.
46
+ You *must* provide an API token and a project ID (your project ID can be found under Lokalise project settings). [Other options can be customized as well (see below)](#configuration) but they have sensible defaults.
47
47
 
48
48
  ### Importing files from Lokalise into your project
49
49
 
@@ -55,7 +55,7 @@ result = importer.import!
55
55
 
56
56
  The `result` will contain a boolean value which says whether the operation was successfull or not.
57
57
 
58
- Please note that upon importing translations any duplicating files inside the `locales` directory (or any other directory that you've specified in the options) will be overwritten! You can enable [safe mode](https://github.com/bodrovis/lokalise_manager#import-config) to check whether the folder is empty or not.
58
+ Please note that upon importing translations any duplicating files inside the `locales` directory (or any other directory that you've specified in the options) **will be overwritten**! You can enable [safe mode](#import-config) to check whether the folder is empty or not.
59
59
 
60
60
  ### Exporting files from your project to Lokalise
61
61
 
@@ -65,19 +65,21 @@ To upload your translation files from a local directory (defaults to `locales/`)
65
65
  processes = exporter.export!
66
66
  ```
67
67
 
68
+ The uploading process is multi-threaded.
69
+
68
70
  `processes` will contain an array of objects responding to the following methods:
69
71
 
70
- * `success` — usually returns `true` (to learn more, check documentation for the `:raise_on_export_fail` option below)
71
- * `process` — returns an object (an instance of the `Lokalise::Resources::QueuedProcess`) representing a [queued background process](https://lokalise.github.io/ruby-lokalise-api/api/queued-processes) as uploading is done in the background on Lokalise.
72
- * `path` — returns an instance of the `Pathname` class which represent the file being uploaded.
72
+ * `#success` — usually returns `true` (to learn more, check documentation for the `:raise_on_export_fail` option below)
73
+ * `#process` — returns an object (an instance of the `Lokalise::Resources::QueuedProcess`) representing a [queued background process](https://lokalise.github.io/ruby-lokalise-api/api/queued-processes) as uploading is done in the background on Lokalise.
74
+ * `#path` — returns an instance of the `Pathname` class which represent the file being uploaded.
73
75
 
74
76
  You can perform periodic checks to read the status of the process. Here's a very simple example:
75
77
 
76
78
  ```ruby
77
79
  def uploaded?(process)
78
80
  5.times do # try to check the status 5 times
79
- process = process.reload_data # load new data
80
- return(true) if process.status == 'finished' # return true is the upload has finished
81
+ process = process.reload_data # load new info about this process
82
+ return(true) if process.status == 'finished' # return true if the upload has finished
81
83
  sleep 1 # wait for 1 second, adjust this number with regards to the upload size
82
84
  end
83
85
 
@@ -169,7 +171,7 @@ In this case the `export_opts` will have `detect_icu_plurals` set to `true` and
169
171
  c.skip_file_export = ->(file) { f.split[1].to_s.include?('fr') }
170
172
  ```
171
173
 
172
- * `max_retries_export` (`integer`) — this option is introduced to properly handle Lokalise API rate limiting. If the HTTP status code 429 (too many requests) has been received, LokaliseRails will apply an exponential backoff mechanism with a very simple formula: `2 ** retries` (initially `retries` is `0`). If the maximum number of retries has been reached, a `Lokalise::Error::TooManyRequests` exception will be raised and the export operation will be halted. By default, LokaliseManager will make up to `5` retries which potentially means `1 + 2 + 4 + 8 + 16 + 32 = 63` seconds of waiting time. If the `max_retries_export` is less than `1`, LokaliseRails will not perform any retries and give up immediately after receiving error 429.
174
+ * `max_retries_export` (`integer`) — this option is introduced to properly handle Lokalise API rate limiting. If the HTTP status code 429 (too many requests) has been received, LokaliseManager will apply an exponential backoff mechanism with a very simple formula: `2 ** retries` (initially `retries` is `0`). If the maximum number of retries has been reached, a `Lokalise::Error::TooManyRequests` exception will be raised and the export operation will be halted. By default, LokaliseManager will make up to `5` retries which potentially means `1 + 2 + 4 + 8 + 16 + 32 = 63` seconds of waiting time. If the `max_retries_export` is less than `1`, LokaliseManager will not perform any retries and give up immediately after receiving error 429.
173
175
  * `raise_on_export_fail` (`boolean`) — default is `true`. When this option is enabled, LokaliseManager will re-raise any exceptions that happened during the file uploading. In other words, if any uploading thread raised an exception, your exporting process will exit with an exception. Suppose, you are uploading 12 translation files; these files will be split in 2 groups with 6 files each, and each group will be uploaded in parallel (using threads). However, suppose some exception happens when uploading the first group. By default this exception will be re-raised for the whole process and the script will never try to upload the second group. If you would like to continue uploading even if an exception happened, set the `raise_on_export_fail` to `false`. In this case the `export!` method will return an array with scheduled processes and with information about processes that were not successfully scheduled. This information is represented as an object with three methods: `path` (contains an instance of the `Pathname` class which says which file could not be uploaded), `error` (the actual exception), and `success` (returns `false`). So, you can use the following snippet to check your processes:
174
176
 
175
177
  ```ruby
@@ -222,7 +224,7 @@ importer = LokaliseManager.importer api_token: '1234abc',
222
224
 
223
225
  These options will be merged with the default ones. Please note that per-client config has the highest priority.
224
226
 
225
- You can also adjust individual options later using the `#config` instance variable (it contains an OpenStruct object):
227
+ You can also adjust individual options later using the `#config` instance variable (it contains a Struct object):
226
228
 
227
229
  ```
228
230
  importer.config.project_id = '678xyz'
@@ -35,8 +35,8 @@ module LokaliseManager
35
35
  #
36
36
  # @return [Lokalise::Client]
37
37
  def api_client
38
- client_opts = [config.api_token, {enable_compression: true}.merge(config.timeouts)]
39
- client_method = config.use_oauth2_token ? :oauth_client : :client
38
+ client_opts = [config.api_token, config.timeouts]
39
+ client_method = config.use_oauth2_token ? :oauth2_client : :client
40
40
 
41
41
  @api_client = ::Lokalise.send(client_method, *client_opts)
42
42
  end
@@ -44,7 +44,7 @@ module LokaliseManager
44
44
  # Resets API client
45
45
  def reset_api_client!
46
46
  ::Lokalise.reset_client!
47
- ::Lokalise.reset_oauth_client!
47
+ ::Lokalise.reset_oauth2_client!
48
48
  @api_client = nil
49
49
  end
50
50
 
@@ -5,8 +5,7 @@ require 'base64'
5
5
  module LokaliseManager
6
6
  module TaskDefinitions
7
7
  class Exporter < Base
8
- using LokaliseManager::Utils::ArrayUtils
9
-
8
+ # Lokalise allows no more than 6 requests per second
10
9
  MAX_THREADS = 6
11
10
 
12
11
  # Performs translation file export to Lokalise and returns an array of queued processes
@@ -17,7 +16,7 @@ module LokaliseManager
17
16
 
18
17
  queued_processes = []
19
18
 
20
- all_files.in_groups_of(MAX_THREADS) do |files_group|
19
+ all_files.each_slice(MAX_THREADS) do |files_group|
21
20
  parallel_upload(files_group).each do |thr|
22
21
  raise_on_fail(thr) if config.raise_on_export_fail
23
22
 
@@ -33,7 +32,7 @@ module LokaliseManager
33
32
  private
34
33
 
35
34
  def parallel_upload(files_group)
36
- files_group.compact.map do |file_data|
35
+ files_group.map do |file_data|
37
36
  do_upload(*file_data)
38
37
  end.map(&:value)
39
38
  end
@@ -59,18 +58,16 @@ module LokaliseManager
59
58
 
60
59
  # Gets translation files from the specified directory
61
60
  def all_files
62
- files = []
63
61
  loc_path = config.locales_path
64
- Dir["#{loc_path}/**/*"].sort.each do |f|
62
+ Dir["#{loc_path}/**/*"].map do |f|
65
63
  full_path = Pathname.new f
66
64
 
67
65
  next unless file_matches_criteria? full_path
68
66
 
69
67
  relative_path = full_path.relative_path_from Pathname.new(loc_path)
70
68
 
71
- files << [full_path, relative_path]
72
- end
73
- files
69
+ [full_path, relative_path]
70
+ end.compact
74
71
  end
75
72
 
76
73
  # Generates export options
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LokaliseManager
4
- VERSION = '2.1.0'
4
+ VERSION = '2.2.0'
5
5
  end
@@ -3,7 +3,6 @@
3
3
  require 'yaml'
4
4
 
5
5
  require 'lokalise_manager/utils/hash_utils'
6
- require 'lokalise_manager/utils/array_utils'
7
6
 
8
7
  require 'lokalise_manager/version'
9
8
  require 'lokalise_manager/error'
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.extra_rdoc_files = ['README.md']
24
24
  spec.require_paths = ['lib']
25
25
 
26
- spec.add_dependency 'ruby-lokalise-api', '~> 4.0'
26
+ spec.add_dependency 'ruby-lokalise-api', '~> 5.0'
27
27
  spec.add_dependency 'rubyzip', '~> 2.3'
28
28
 
29
29
  spec.add_development_dependency 'codecov', '~> 0.2'
@@ -63,14 +63,14 @@ describe LokaliseManager::TaskDefinitions::Base do
63
63
  it 'raises an error when the API key is not set' do
64
64
  allow(LokaliseManager::GlobalConfig).to receive(:api_token).and_return(nil)
65
65
 
66
- expect(-> { described_object.send(:check_options_errors!) }).to raise_error(LokaliseManager::Error, /API token is not set/i)
66
+ expect { described_object.send(:check_options_errors!) }.to raise_error(LokaliseManager::Error, /API token is not set/i)
67
67
 
68
68
  expect(LokaliseManager::GlobalConfig).to have_received(:api_token)
69
69
  end
70
70
 
71
71
  it 'returns an error when the project_id is not set' do
72
72
  allow_project_id described_object, nil do
73
- expect(-> { described_object.send(:check_options_errors!) }).to raise_error(LokaliseManager::Error, /ID is not set/i)
73
+ expect { described_object.send(:check_options_errors!) }.to raise_error(LokaliseManager::Error, /ID is not set/i)
74
74
  end
75
75
  end
76
76
  end
@@ -96,7 +96,7 @@ describe LokaliseManager::TaskDefinitions::Base do
96
96
 
97
97
  client = described_object.api_client
98
98
  expect(client).to be_an_instance_of(Lokalise::Client)
99
- expect(client).not_to be_an_instance_of(Lokalise::OAuthClient)
99
+ expect(client).not_to be_an_instance_of(Lokalise::OAuth2Client)
100
100
  expect(client.open_timeout).to eq(100)
101
101
  expect(client.timeout).to eq(500)
102
102
  end
@@ -106,7 +106,7 @@ describe LokaliseManager::TaskDefinitions::Base do
106
106
 
107
107
  client = described_object.api_client
108
108
 
109
- expect(client).to be_an_instance_of(Lokalise::OAuthClient)
109
+ expect(client).to be_an_instance_of(Lokalise::OAuth2Client)
110
110
  expect(client).not_to be_an_instance_of(Lokalise::Client)
111
111
  end
112
112
  end
@@ -27,7 +27,7 @@ describe LokaliseManager::TaskDefinitions::Exporter do
27
27
  process = nil
28
28
 
29
29
  VCR.use_cassette('upload_files_multiple') do
30
- expect(-> { process = described_object.export!.first.process }).to output(/complete!/).to_stdout
30
+ expect { process = described_object.export!.first.process }.to output(/complete!/).to_stdout
31
31
  end
32
32
 
33
33
  expect(process.project_id).to eq(project_id)
@@ -43,7 +43,7 @@ describe LokaliseManager::TaskDefinitions::Exporter do
43
43
  allow(fake_client).to receive(:upload_file).with(any_args).and_raise(Lokalise::Error::TooManyRequests)
44
44
  allow(described_object).to receive(:api_client).and_return(fake_client)
45
45
 
46
- expect(-> { described_object.export! }).to raise_error(Lokalise::Error::TooManyRequests, /Gave up after 1 retries/i)
46
+ expect { described_object.export! }.to raise_error(Lokalise::Error::TooManyRequests, /Gave up after 1 retries/i)
47
47
 
48
48
  expect(described_object).to have_received(:sleep).exactly(6).times
49
49
  expect(described_object).to have_received(:api_client).at_least(12).times
@@ -60,9 +60,8 @@ describe LokaliseManager::TaskDefinitions::Exporter do
60
60
  allow(fake_client).to receive(:upload_file).with(any_args).and_raise(Lokalise::Error::TooManyRequests)
61
61
  allow(described_object).to receive(:api_client).and_return(fake_client)
62
62
  processes = []
63
- expect(-> { processes = described_object.export! }).not_to raise_error
63
+ expect { processes = described_object.export! }.not_to raise_error
64
64
 
65
- expect(processes[0].path.to_s).to include('en_0')
66
65
  expect(processes[0].success).to be false
67
66
  expect(processes[1].error.class).to eq(Lokalise::Error::TooManyRequests)
68
67
  expect(processes.count).to eq(7)
@@ -90,7 +89,7 @@ describe LokaliseManager::TaskDefinitions::Exporter do
90
89
  process = nil
91
90
 
92
91
  VCR.use_cassette('upload_files') do
93
- expect(-> { process = described_object.export!.first.process }).not_to output(/complete!/).to_stdout
92
+ expect { process = described_object.export!.first.process }.not_to output(/complete!/).to_stdout
94
93
  end
95
94
 
96
95
  expect(process.status).to eq('queued')
@@ -126,20 +125,20 @@ describe LokaliseManager::TaskDefinitions::Exporter do
126
125
  it 'halts when the API key is not set' do
127
126
  allow(described_object.config).to receive(:api_token).and_return(nil)
128
127
 
129
- expect(-> { described_object.export! }).to raise_error(LokaliseManager::Error, /API token is not set/i)
128
+ expect { described_object.export! }.to raise_error(LokaliseManager::Error, /API token is not set/i)
130
129
  expect(described_object.config).to have_received(:api_token)
131
130
  end
132
131
 
133
132
  it 'halts when the project_id is not set' do
134
133
  allow_project_id described_object, nil do
135
- expect(-> { described_object.export! }).to raise_error(LokaliseManager::Error, /ID is not set/i)
134
+ expect { described_object.export! }.to raise_error(LokaliseManager::Error, /ID is not set/i)
136
135
  end
137
136
  end
138
137
  end
139
138
 
140
139
  describe '#all_files' do
141
140
  it 'yield proper arguments' do
142
- expect(described_object.send(:all_files).first).to include(
141
+ expect(described_object.send(:all_files).flatten).to include(
143
142
  Pathname.new(path),
144
143
  Pathname.new(relative_name)
145
144
  )
@@ -209,14 +208,14 @@ describe LokaliseManager::TaskDefinitions::Exporter do
209
208
  end
210
209
  end
211
210
 
212
- describe '#each_file' do
211
+ describe '#all_files' do
213
212
  it 'returns all files' do
214
- files = described_object.send(:all_files)
215
- expect(files[0]).to include(
213
+ files = described_object.send(:all_files).flatten
214
+ expect(files).to include(
216
215
  Pathname.new(path),
217
216
  Pathname.new(relative_name)
218
217
  )
219
- expect(files[1]).to include(
218
+ expect(files).to include(
220
219
  Pathname.new(path_ru),
221
220
  Pathname.new(filename_ru)
222
221
  )
@@ -226,7 +225,7 @@ describe LokaliseManager::TaskDefinitions::Exporter do
226
225
  allow(described_object.config).to receive(:skip_file_export).twice.and_return(
227
226
  ->(f) { f.split[1].to_s.include?('ru') }
228
227
  )
229
- files = described_object.send(:all_files)
228
+ files = described_object.send(:all_files).sort
230
229
  expect(files[0]).to include(
231
230
  Pathname.new(path),
232
231
  Pathname.new(relative_name)
@@ -15,14 +15,14 @@ describe LokaliseManager::TaskDefinitions::Importer do
15
15
  entry = double
16
16
  allow(entry).to receive(:name).and_return('fail.yml')
17
17
  allow(described_object).to receive(:data_from).with(entry).and_raise(EncodingError)
18
- expect(-> { described_object.send(:process!, entry) }).
18
+ expect { described_object.send(:process!, entry) }.
19
19
  to raise_error(EncodingError, /Error when trying to process fail\.yml/)
20
20
 
21
21
  expect(described_object).to have_received(:data_from)
22
22
  end
23
23
 
24
24
  it 're-raises errors during file opening' do
25
- expect(-> { described_object.send(:open_and_process_zip, 'http://fake.url/wrong/path.zip') }).
25
+ expect { described_object.send(:open_and_process_zip, 'http://fake.url/wrong/path.zip') }.
26
26
  to raise_error(SocketError, /Failed to open TCP connection/)
27
27
  end
28
28
  end
@@ -35,14 +35,13 @@ describe LokaliseManager::TaskDefinitions::Importer do
35
35
 
36
36
  expect(response['project_id']).to eq('672198945b7d72fc048021.15940510')
37
37
  expect(response['bundle_url']).to include('s3-eu-west-1.amazonaws.com')
38
- expect(described_object.api_client.enable_compression).to eq(true)
39
38
  end
40
39
 
41
40
  it 're-raises errors during file download' do
42
41
  allow_project_id described_object, 'invalid'
43
42
 
44
43
  VCR.use_cassette('download_files_error') do
45
- expect(-> { described_object.send :download_files }).
44
+ expect { described_object.send :download_files }.
46
45
  to raise_error(Lokalise::Error::BadRequest, /Invalid `project_id` parameter/)
47
46
  end
48
47
  end
@@ -57,7 +56,7 @@ describe LokaliseManager::TaskDefinitions::Importer do
57
56
  allow(fake_client).to receive(:download_files).and_raise(Lokalise::Error::TooManyRequests)
58
57
  allow(described_object).to receive(:api_client).and_return(fake_client)
59
58
 
60
- expect(-> { described_object.import! }).to raise_error(Lokalise::Error::TooManyRequests, /Gave up after 2 retries/i)
59
+ expect { described_object.import! }.to raise_error(Lokalise::Error::TooManyRequests, /Gave up after 2 retries/i)
61
60
 
62
61
  expect(described_object).to have_received(:sleep).exactly(2).times
63
62
  expect(described_object).to have_received(:api_client).exactly(3).times
@@ -66,14 +65,14 @@ describe LokaliseManager::TaskDefinitions::Importer do
66
65
 
67
66
  it 'halts when the API key is not set' do
68
67
  allow(described_object.config).to receive(:api_token).and_return(nil)
69
- expect(-> { described_object.import! }).to raise_error(LokaliseManager::Error, /API token is not set/i)
68
+ expect { described_object.import! }.to raise_error(LokaliseManager::Error, /API token is not set/i)
70
69
  expect(described_object.config).to have_received(:api_token)
71
70
  expect(count_translations).to eq(0)
72
71
  end
73
72
 
74
73
  it 'halts when the project_id is not set' do
75
74
  allow_project_id described_object, nil do
76
- expect(-> { described_object.import! }).to raise_error(LokaliseManager::Error, /ID is not set/i)
75
+ expect { described_object.import! }.to raise_error(LokaliseManager::Error, /ID is not set/i)
77
76
  expect(count_translations).to eq(0)
78
77
  end
79
78
  end
@@ -110,7 +109,7 @@ describe LokaliseManager::TaskDefinitions::Importer do
110
109
  result = nil
111
110
 
112
111
  VCR.use_cassette('import') do
113
- expect(-> { result = described_object.import! }).to output(/complete!/).to_stdout
112
+ expect { result = described_object.import! }.to output(/complete!/).to_stdout
114
113
  end
115
114
 
116
115
  expect(result).to be true
@@ -125,7 +124,7 @@ describe LokaliseManager::TaskDefinitions::Importer do
125
124
  result = nil
126
125
 
127
126
  VCR.use_cassette('import') do
128
- expect(-> { result = described_object.import! }).not_to output(/complete!/).to_stdout
127
+ expect { result = described_object.import! }.not_to output(/complete!/).to_stdout
129
128
  end
130
129
 
131
130
  expect(result).to be true
@@ -164,7 +163,7 @@ describe LokaliseManager::TaskDefinitions::Importer do
164
163
  )
165
164
 
166
165
  allow($stdin).to receive(:gets).and_return('Y')
167
- expect(-> { safe_mode_obj.import! }).to output(/is not empty/).to_stdout
166
+ expect { safe_mode_obj.import! }.to output(/is not empty/).to_stdout
168
167
 
169
168
  expect(count_translations).to eq(5)
170
169
  expect($stdin).to have_received(:gets)
@@ -177,7 +176,7 @@ describe LokaliseManager::TaskDefinitions::Importer do
177
176
  it 'import halts when a user chooses not to proceed' do
178
177
  allow(safe_mode_obj).to receive(:download_files).at_most(0).times
179
178
  allow($stdin).to receive(:gets).and_return('N')
180
- expect(-> { safe_mode_obj.import! }).to output(/cancelled/).to_stdout
179
+ expect { safe_mode_obj.import! }.to output(/cancelled/).to_stdout
181
180
 
182
181
  expect(safe_mode_obj).not_to have_received(:download_files)
183
182
  expect($stdin).to have_received(:gets)
@@ -188,7 +187,7 @@ describe LokaliseManager::TaskDefinitions::Importer do
188
187
  allow(safe_mode_obj.config).to receive(:silent_mode).and_return(true)
189
188
  allow(safe_mode_obj).to receive(:download_files).at_most(0).times
190
189
  allow($stdin).to receive(:gets).and_return('N')
191
- expect(-> { safe_mode_obj.import! }).not_to output(/cancelled/).to_stdout
190
+ expect { safe_mode_obj.import! }.not_to output(/cancelled/).to_stdout
192
191
 
193
192
  expect(safe_mode_obj).not_to have_received(:download_files)
194
193
  expect(safe_mode_obj.config).to have_received(:silent_mode)
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: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilya Bodrov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-27 00:00:00.000000000 Z
11
+ date: 2022-02-23 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: '4.0'
19
+ version: '5.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: '4.0'
26
+ version: '5.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rubyzip
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -187,7 +187,6 @@ files:
187
187
  - lib/lokalise_manager/task_definitions/base.rb
188
188
  - lib/lokalise_manager/task_definitions/exporter.rb
189
189
  - lib/lokalise_manager/task_definitions/importer.rb
190
- - lib/lokalise_manager/utils/array_utils.rb
191
190
  - lib/lokalise_manager/utils/hash_utils.rb
192
191
  - lib/lokalise_manager/version.rb
193
192
  - lokalise_manager.gemspec
@@ -196,7 +195,6 @@ files:
196
195
  - spec/lib/lokalise_manager/task_definitions/exporter_spec.rb
197
196
  - spec/lib/lokalise_manager/task_definitions/importer_spec.rb
198
197
  - spec/lib/lokalise_manager_spec.rb
199
- - spec/lib/utils/array_utils_spec.rb
200
198
  - spec/lib/utils/hash_utils_spec.rb
201
199
  - spec/spec_helper.rb
202
200
  - spec/support/file_manager.rb
@@ -222,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
220
  - !ruby/object:Gem::Version
223
221
  version: '0'
224
222
  requirements: []
225
- rubygems_version: 3.3.5
223
+ rubygems_version: 3.3.7
226
224
  signing_key:
227
225
  specification_version: 4
228
226
  summary: Lokalise integration for Ruby
@@ -232,7 +230,6 @@ test_files:
232
230
  - spec/lib/lokalise_manager/task_definitions/exporter_spec.rb
233
231
  - spec/lib/lokalise_manager/task_definitions/importer_spec.rb
234
232
  - spec/lib/lokalise_manager_spec.rb
235
- - spec/lib/utils/array_utils_spec.rb
236
233
  - spec/lib/utils/hash_utils_spec.rb
237
234
  - spec/spec_helper.rb
238
235
  - spec/support/file_manager.rb
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Taken from https://github.com/rails/rails/blob/6bfc637659248df5d6719a86d2981b52662d9b50/activesupport/lib/active_support/core_ext/array/grouping.rb
4
-
5
- module LokaliseManager
6
- module Utils
7
- module ArrayUtils
8
- refine Array do
9
- def in_groups_of(number, fill_with = nil, &block)
10
- if number.to_i <= 0
11
- raise ArgumentError,
12
- "Group size must be a positive integer, was #{number.inspect}"
13
- end
14
-
15
- if fill_with == false
16
- collection = self
17
- else
18
- padding = (number - (size % number)) % number
19
- collection = dup.concat(Array.new(padding, fill_with))
20
- end
21
-
22
- collection.each_slice(number, &block)
23
- end
24
- end
25
- end
26
- end
27
- end
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe LokaliseManager::Utils::ArrayUtils do
4
- using described_class
5
- let(:arr) { (1..8).to_a }
6
-
7
- describe '#in_groups_of' do
8
- it 'raises an exception when the number is less than 1' do
9
- expect(-> { arr.in_groups_of(-1) }).to raise_error(ArgumentError)
10
- end
11
-
12
- it 'uses collection itself if fill_with is false' do
13
- enum = arr.in_groups_of(5, false)
14
- enum.next
15
- expect(enum.next.count).to eq(3)
16
- end
17
- end
18
- end