Class: Deliver::SubmitForReview
- Inherits:
-
Object
- Object
- Deliver::SubmitForReview
- Defined in:
- deliver/lib/deliver/submit_for_review.rb
Instance Method Summary collapse
- #find_build(candidate_builds) ⇒ Object
- #select_build(options) ⇒ Object
- #submit!(options) ⇒ Object
- #wait_for_build(app) ⇒ Object
Instance Method Details
#find_build(candidate_builds) ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'deliver/lib/deliver/submit_for_review.rb', line 73 def find_build(candidate_builds) if (candidate_builds || []).count == 0 UI.user_error!("Could not find any available candidate builds on iTunes Connect to submit") end build = candidate_builds.first candidate_builds.each do |b| if b.upload_date > build.upload_date build = b end end return build end |
#select_build(options) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'deliver/lib/deliver/submit_for_review.rb', line 32 def select_build() app = [:app] v = app.edit_version if [:build_number] && [:build_number] != "latest" UI.("Selecting existing build-number: #{[:build_number]}") build = v.candidate_builds.detect { |a| a.build_version == [:build_number] } unless build UI.user_error!("Build number: #{[:build_number]} does not exist") end else UI.("Selecting the latest build...") build = wait_for_build(app) end UI.("Selecting build #{build.train_version} (#{build.build_version})...") v.select_build(build) v.save! UI.success("Successfully selected build") end |
#submit!(options) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'deliver/lib/deliver/submit_for_review.rb', line 5 def submit!() app = [:app] select_build() UI.("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 [:submission_information] [:submission_information].each do |key, value| UI.("Setting '#{key}' to '#{value}'...") submission.send("#{key}=", value) end end # Finalize app submission submission.complete! UI.success("Successfully submitted the app for review!") end |
#wait_for_build(app) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'deliver/lib/deliver/submit_for_review.rb', line 54 def wait_for_build(app) UI.user_error!("Could not find app with app identifier") unless app start = Time.now loop do build = find_build(app.latest_version.candidate_builds) return build if build.processing == false UI.("Waiting iTunes Connect processing for build #{build.train_version} (#{build.build_version})... this might take a while...") if (Time.now - start) > (60 * 5) UI.("") UI.("You can tweet: \"iTunes Connect #iosprocessingtime #{((Time.now - start) / 60).round} minutes\"") end sleep(30) end nil end |