emerge 0.7.1 → 0.7.2

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: 409fec8581e499747b3c9ca5cd80e0f9c9e491ca0d94688bc1e0d299a974a95b
4
- data.tar.gz: 64863c523c84b25f5ff21a9bbda0863f13ef7a5165d5437aeb66d60211e7fe84
3
+ metadata.gz: 65f13db01f807a85200615394b091f5bfea4cd3bf4cf4f94ec0a742d5b93c597
4
+ data.tar.gz: 322a6582fd941518f080ae8d38af3555a404e295a99658083d5032a0127640d9
5
5
  SHA512:
6
- metadata.gz: 5a6dc2be9e2ad1f3078c9f6703d35c2f1e70d5630d14a2f682216fb949c1111b7bc236702e2e9698714f4662e5e7a70bcb67118c510542b61d1b58c00f13dc1e
7
- data.tar.gz: 76f622ef6797a7c420d1406e9f43ddceb9f075180641ae6e5b78cbb63a3a18489d883d63346d973f9ff8e6b225281d2d0671e6ad33d5ff667b5c7d347c8ba769
6
+ metadata.gz: 6e7adb6bafb19cec3408a3e866d9a148ebe99cf80dde147c47f9133fad0a6d8e7e655a2bfdce7ece4be9596235c650d7abf60ef07f899f30a0a700ef40eccb03
7
+ data.tar.gz: 9ee165532fb1443fda2f5dce215bb545b9a9997d6684cc5e36d3b18de416a73496779dad9685fac1a03735d327077f040dcd4b17050027abe1accaf7ec1562f8
@@ -68,7 +68,7 @@ module EmergeCLI
68
68
 
69
69
  image_files = @profiler.measure('find_image_files') { find_image_files(client) }
70
70
 
71
- @profiler.measure('check_duplicate_files') { check_duplicate_files(image_files, client) }
71
+ check_duplicate_files(image_files, client)
72
72
 
73
73
  run_id = @profiler.measure('create_run') { create_run }
74
74
 
@@ -130,18 +130,26 @@ module EmergeCLI
130
130
  found_images
131
131
  end
132
132
 
133
- def check_duplicate_files(image_files, client)
133
+ def check_duplicate_files(image_files, _client)
134
134
  seen_files = {}
135
+ duplicate_files = {}
136
+
135
137
  image_files.each do |image_path|
136
- file_name = client.parse_file_info(image_path)[:file_name]
138
+ file_name = File.basename(image_path)
137
139
 
138
140
  if seen_files[file_name]
139
- Logger.warn "Duplicate file name detected: '#{file_name}'. " \
140
- "Previous occurrence: '#{seen_files[file_name]}'. " \
141
- 'This upload will overwrite the previous one.'
141
+ duplicate_files[file_name] ||= []
142
+ duplicate_files[file_name] << image_path
143
+ else
144
+ seen_files[file_name] = image_path
142
145
  end
143
- seen_files[file_name] = image_path
144
146
  end
147
+
148
+ duplicate_files.each do |filename, paths|
149
+ Logger.warn "Found #{paths.length} duplicate(s) of '#{filename}'. Duplicates: #{paths.join(', ')}"
150
+ end
151
+
152
+ [seen_files, duplicate_files]
145
153
  end
146
154
 
147
155
  def create_run
@@ -201,6 +209,8 @@ module EmergeCLI
201
209
  errors: []
202
210
  }
203
211
 
212
+ used_filenames, = check_duplicate_files(image_files, client)
213
+
204
214
  @profiler.measure('process_image_metadata') do
205
215
  image_files.each do |image_path|
206
216
  metadata_semaphore.async do
@@ -236,8 +246,9 @@ module EmergeCLI
236
246
  zipfile.get_output_stream('manifest.json') { |f| f.write(JSON.generate(image_metadata)) }
237
247
 
238
248
  image_files.each do |image_path|
239
- image_name = File.basename(image_path)
240
- zipfile.add(image_name, image_path)
249
+ filename = File.basename(image_path)
250
+ # Only add files we haven't seen before
251
+ zipfile.add(filename, image_path) if used_filenames[filename] == image_path
241
252
  end
242
253
  end
243
254
  end
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module EmergeCLI
2
- VERSION = '0.7.1'.freeze
2
+ VERSION = '0.7.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emerge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emerge Tools