Class: Deliver::ItunesTransporter
- Inherits:
-
Object
- Object
- Deliver::ItunesTransporter
- Defined in:
- lib/deliver/itunes_transporter.rb
Class Method Summary collapse
-
.hide_transporter_output ⇒ Object
This will be called from the Deliverfile, and disables the logging of the transpoter output.
Instance Method Summary collapse
-
#download(app, dir = nil) ⇒ Bool
Downloads the latest version of the app metadata package from iTC.
-
#initialize(user = nil, password = nil) ⇒ ItunesTransporter
constructor
Returns a new instance of the iTunesTranspoter.
-
#upload(app, dir) ⇒ Bool
Uploads the modified package back to iTunesConnect.
Constructor Details
#initialize(user = nil, password = nil) ⇒ ItunesTransporter
Returns a new instance of the iTunesTranspoter. If no username or password given, it will be taken from the #PasswordManager
30 31 32 33 |
# File 'lib/deliver/itunes_transporter.rb', line 30 def initialize(user = nil, password = nil) @user = (user || PasswordManager.shared_manager.username) @password = (password || PasswordManager.shared_manager.password) end |
Class Method Details
.hide_transporter_output ⇒ Object
This will be called from the Deliverfile, and disables the logging of the transpoter output
23 24 25 |
# File 'lib/deliver/itunes_transporter.rb', line 23 def self.hide_transporter_output @@hide_transporter_output = true end |
Instance Method Details
#download(app, dir = nil) ⇒ Bool
Downloads the latest version of the app metadata package from iTC.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/deliver/itunes_transporter.rb', line 42 def download(app, dir = nil) dir ||= "/tmp" raise TransporterInputError.new("No valid Deliver::App given") unless app.kind_of?Deliver::App Helper.log.info "Going to download app metadata from iTunesConnect" dir ||= app. command = build_download_command(@user, @password, app.apple_id, dir) result = execute_transporter(command) itmsp_path = [dir, "#{app.apple_id}.itmsp"].join('/') if result and File.directory?itmsp_path Helper.log.info "Successfully downloaded the latest package from iTunesConnect.".green else Helper.log.fatal "Could not download metadata from iTunes Connect. Do you have special characters in your password (Like ' or \")?" end result end |
#upload(app, dir) ⇒ Bool
Uploads the modified package back to iTunesConnect
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/deliver/itunes_transporter.rb', line 69 def upload(app, dir) raise TransporterInputError.new("No valid Deliver::App given") unless app.kind_of?Deliver::App dir ||= app. dir += "/#{app.apple_id}.itmsp" Helper.log.info "Going to upload updated app to iTunesConnect" command = build_upload_command(@user, @password, dir) result = execute_transporter(command) if result Helper.log.info "Successfully uploaded package to iTunesConnect. It might take a few minutes until it's visible online.".green end result end |