lib/deliver/upload_screenshots.rb in deliver-1.9.0 vs lib/deliver/upload_screenshots.rb in deliver-1.10.0

- old
+ new

@@ -5,13 +5,13 @@ return if options[:skip_screenshots] app = options[:app] v = app.edit_version - raise "Could not find a version to edit for app '#{app.name}'".red unless v + UI.user_error!("Could not find a version to edit for app '#{app.name}'") unless v - Helper.log.info "Starting with the upload of screenshots..." + UI.message("Starting with the upload of screenshots...") # First, clear all previously uploaded screenshots, but only where we have new ones # screenshots.each do |screenshot| # to_remove = v.screenshots[screenshot.language].find_all do |current| # current.device_type == screenshot.device_type @@ -23,34 +23,34 @@ # Now, fill in the new ones indized = {} # per language and device type screenshots_per_language = screenshots.group_by(&:language) screenshots_per_language.each do |language, screenshots_for_language| - Helper.log.info "Uploading #{screenshots_for_language.length} screenshots for language #{language}" + UI.message("Uploading #{screenshots_for_language.length} screenshots for language #{language}") screenshots_for_language.each do |screenshot| indized[screenshot.language] ||= {} indized[screenshot.language][screenshot.device_type] ||= 0 indized[screenshot.language][screenshot.device_type] += 1 # we actually start with 1... wtf iTC index = indized[screenshot.language][screenshot.device_type] if index > 5 - Helper.log.error "Too many screenshots found for device '#{screenshot.device_type}' in '#{screenshot.language}'" + UI.error("Too many screenshots found for device '#{screenshot.device_type}' in '#{screenshot.language}'") next end - Helper.log.info "Uploading '#{screenshot.path}'..." + UI.message("Uploading '#{screenshot.path}'...") v.upload_screenshot!(screenshot.path, index, screenshot.language, screenshot.device_type) end # ideally we should only save once, but itunes server can't cope it seems # so we save per language. See issue #349 - Helper.log.info "Saving changes" + UI.message("Saving changes") v.save! end - Helper.log.info "Successfully uploaded screenshots to iTunes Connect".green + UI.success("Successfully uploaded screenshots to iTunes Connect") end def collect_screenshots(options) return [] if options[:skip_screenshots] return collect_screenshots_for_languages(options[:screenshots_path])