278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
|
# File 'supply/lib/supply/uploader.rb', line 278
def upload_images(language)
Supply::IMAGES_TYPES.each do |image_type|
search = File.join(metadata_path, language, Supply::IMAGES_FOLDER_NAME, image_type) + ".#{IMAGE_FILE_EXTENSIONS}"
path = Dir.glob(search, File::FNM_CASEFOLD).last
next unless path
if Supply.config[:sync_image_upload]
UI.message("🔍 Checking #{image_type} checksum...")
existing_images = client.fetch_images(image_type: image_type, language: language)
sha256 = Digest::SHA256.file(path).hexdigest
if existing_images.map(&:sha256).include?(sha256)
UI.message("🟰 Skipping upload of screenshot #{path} as remote sha256 matches.")
next
end
end
UI.message("⬆️ Uploading image file #{path}...")
client.upload_image(image_path: File.expand_path(path),
image_type: image_type,
language: language)
end
end
|