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

- old
+ new

@@ -2,61 +2,68 @@ class SubmitForReview def submit!(options) app = options[:app] select_build(options) - Helper.log.info "Submitting the app for review..." + UI.message("Submitting the app for review...") submission = app.create_submission # Set app submission information # Default Values submission.content_rights_contains_third_party_content = false submission.content_rights_has_rights = true submission.add_id_info_uses_idfa = false # User Values if options[:submission_information] - raise "`submission_information` must be a hash" unless options[:submission_information].kind_of?(Hash) options[:submission_information].each do |key, value| - Helper.log.info "Setting '#{key}' to '#{value}'..." + UI.message("Setting '#{key}' to '#{value}'...") submission.send("#{key}=", value) end end # Finalize app submission submission.complete! - Helper.log.info "Successfully submitted the app for review!".green + UI.success("Successfully submitted the app for review!") end def select_build(options) - Helper.log.info "Selecting the latest build..." app = options[:app] v = app.edit_version - build = wait_for_build(app) - Helper.log.info "Selecting build #{build.train_version} (#{build.build_version})..." + if options[:build_number] and options[:build_number] != "latest" + UI.message("Selecting existing build-number: #{options[:build_number]}") + build = v.candidate_builds.detect { |a| a.build_version == options[:build_number] } + unless build + UI.user_error!("Build number: #{options[:build_number]} does not exist") + end + else + UI.message("Selecting the latest build...") + build = wait_for_build(app) + end + UI.message("Selecting build #{build.train_version} (#{build.build_version})...") v.select_build(build) v.save! - Helper.log.info "Successfully selected build".green + UI.success("Successfully selected build") end def wait_for_build(app) - raise "Could not find app with app identifier #{WatchBuild.config[:app_identifier]}".red unless app + UI.user_error!("Could not find app with app identifier #{WatchBuild.config[:app_identifier]}") unless app start = Time.now loop do build = find_build(app) return build if build.processing == false - Helper.log.info "Waiting iTunes Connect processing for build #{build.train_version} (#{build.build_version})... this might take a while..." + UI.message("Waiting iTunes Connect processing for build #{build.train_version} (#{build.build_version})... this might take a while...") if (Time.now - start) > (60 * 5) - Helper.log.info "" - Helper.log.info "You can tweet: \"iTunes Connect #iosprocessingtime #{((Time.now - start) / 60).round} minutes\"" + UI.message("") + UI.message("You can tweet: \"iTunes Connect #iosprocessingtime #{((Time.now - start) / 60).round} minutes\"") end sleep 30 end nil end @@ -68,11 +75,11 @@ build = b end end unless build - Helper.log.fatal app.latest_version.candidate_builds - raise "Could not find build".red + UI.error(app.latest_version.candidate_builds) + UI.crash!("Could not find build") end return build end end