Class: Deliver::IpaUploader
- Inherits:
-
AppMetadata
- Object
- AppMetadata
- Deliver::IpaUploader
- Defined in:
- lib/deliver/ipa_uploader.rb
Overview
This class takes care of preparing and uploading the given ipa file Metadata + IPA file can not be handled in one file
Constant Summary
Constants inherited from AppMetadata
AppMetadata::INVALID_LANGUAGE_ERROR, AppMetadata::ITUNES_NAMESPACE
Instance Attribute Summary collapse
-
#app ⇒ Object
Returns the value of attribute app.
Attributes inherited from AppMetadata
Uploading the ipa file collapse
-
#upload!(submit_information = nil) ⇒ Object
Actually upload the ipa file to Apple.
Instance Method Summary collapse
-
#fetch_app_identifier ⇒ Object
Fetches the app identifier (e.g. com.facebook.Facebook) from the given ipa file.
-
#fetch_app_version ⇒ Object
Fetches the app version from the given ipa file.
-
#initialize(app, dir, ipa_path, is_beta_build) ⇒ IpaUploader
constructor
Create a new uploader for one ipa file.
Methods inherited from AppMetadata
#add_new_locale, #add_screenshot, #clear_all_screenshots, #fetch_value, #set_all_screenshots, #set_all_screenshots_from_path, #set_screenshots_for_each_language, #update_changelog, #update_description, #update_keywords, #update_marketing_url, #update_privacy_url, #update_support_url, #update_title, #verify_version
Constructor Details
#initialize(app, dir, ipa_path, is_beta_build) ⇒ IpaUploader
Create a new uploader for one ipa file. This will only upload the ipa and no other app metadata.
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/deliver/ipa_uploader.rb', line 20 def initialize(app, dir, ipa_path, is_beta_build) ipa_path.strip! # remove unused white spaces raise IpaUploaderError.new("IPA on path '#{ipa_path}' not found") unless File.exists?(ipa_path) raise IpaUploaderError.new("IPA on path '#{ipa_path}' is not a valid IPA file") unless ipa_path.include?".ipa" super(app, dir, false) @ipa_file = Deliver::MetadataItem.new(ipa_path) @is_beta_build = is_beta_build end |
Instance Attribute Details
#app ⇒ Object
Returns the value of attribute app.
11 12 13 |
# File 'lib/deliver/ipa_uploader.rb', line 11 def app @app end |
Instance Method Details
#fetch_app_identifier ⇒ Object
Fetches the app identifier (e.g. com.facebook.Facebook) from the given ipa file.
32 33 34 35 36 |
# File 'lib/deliver/ipa_uploader.rb', line 32 def fetch_app_identifier plist = fetch_info_plist_file return plist['CFBundleIdentifier'] if plist return nil end |
#fetch_app_version ⇒ Object
Fetches the app version from the given ipa file.
39 40 41 42 43 |
# File 'lib/deliver/ipa_uploader.rb', line 39 def fetch_app_version plist = fetch_info_plist_file return plist['CFBundleShortVersionString'] if plist return nil end |
#upload!(submit_information = nil) ⇒ Object
Actually upload the ipa file to Apple
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/deliver/ipa_uploader.rb', line 52 def upload!(submit_information = nil) Helper.log.info "Uploading ipa file to iTunesConnect" build_document # Write the current XML state to disk folder_name = "#{@app.apple_id}.itmsp" path = "#{@metadata_dir}/#{folder_name}/" FileUtils.mkdir_p path File.write("#{path}/#{METADATA_FILE_NAME}", @data.to_xml) @ipa_file.store_file_inside_package(path) is_okay = true begin transporter.upload(@app, ) rescue Exception => ex is_okay = ex.to_s.include?"ready exists a binary upload with build" # this just means, the ipa is already online end if is_okay unless Helper.is_test? `rm -rf ./#{@app.apple_id}.itmsp` # we don't need that any more return publish_on_itunes_connect(submit_information) end end return is_okay end |