Class: FastlaneCore::ItunesTransporter
- Inherits:
-
Object
- Object
- FastlaneCore::ItunesTransporter
- Defined in:
- fastlane_core/lib/fastlane_core/itunes_transporter.rb
Constant Summary collapse
- TWO_STEP_HOST_PREFIX =
"deliver.appspecific"
Class Method Summary collapse
-
.hide_transporter_output ⇒ Object
This will be called from the Deliverfile, and disables the logging of the transporter output.
- .hide_transporter_output? ⇒ Boolean
Instance Method Summary collapse
-
#download(app_id, dir = nil) ⇒ Bool
Downloads the latest version of the app metadata package from iTC.
-
#initialize(user = nil, password = nil, use_shell_script = false, provider_short_name = nil) ⇒ ItunesTransporter
constructor
Returns a new instance of the iTunesTransporter.
-
#upload(app_id, dir) ⇒ Bool
Uploads the modified package back to App Store Connect.
Constructor Details
#initialize(user = nil, password = nil, use_shell_script = false, provider_short_name = nil) ⇒ ItunesTransporter
Returns a new instance of the iTunesTransporter. If no username or password given, it will be taken from the #CredentialsManager::AccountManager
323 324 325 326 327 328 329 330 331 332 333 334 335 |
# File 'fastlane_core/lib/fastlane_core/itunes_transporter.rb', line 323 def initialize(user = nil, password = nil, use_shell_script = false, provider_short_name = nil) # Xcode 6.x doesn't have the same iTMSTransporter Java setup as later Xcode versions, so # we can't default to using the newer direct Java invocation strategy for those versions. use_shell_script ||= Helper.is_mac? && Helper.xcode_version.start_with?('6.') use_shell_script ||= Helper.windows? use_shell_script ||= Feature.enabled?('FASTLANE_ITUNES_TRANSPORTER_USE_SHELL_SCRIPT') @user = user @password = password || load_password_for_transporter @transporter_executor = use_shell_script ? ShellScriptTransporterExecutor.new : JavaTransporterExecutor.new @provider_short_name = provider_short_name end |
Class Method Details
.hide_transporter_output ⇒ Object
This will be called from the Deliverfile, and disables the logging of the transporter output
303 304 305 |
# File 'fastlane_core/lib/fastlane_core/itunes_transporter.rb', line 303 def self.hide_transporter_output @hide_transporter_output = !FastlaneCore::Globals.verbose? end |
.hide_transporter_output? ⇒ Boolean
307 308 309 |
# File 'fastlane_core/lib/fastlane_core/itunes_transporter.rb', line 307 def self.hide_transporter_output? @hide_transporter_output end |
Instance Method Details
#download(app_id, dir = nil) ⇒ Bool
Downloads the latest version of the app metadata package from iTC.
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 |
# File 'fastlane_core/lib/fastlane_core/itunes_transporter.rb', line 343 def download(app_id, dir = nil) dir ||= "/tmp" UI.("Going to download app metadata from App Store Connect") command = @transporter_executor.build_download_command(@user, @password, app_id, dir, @provider_short_name) UI.verbose(@transporter_executor.build_download_command(@user, 'YourPassword', app_id, dir, @provider_short_name)) begin result = @transporter_executor.execute(command, ItunesTransporter.hide_transporter_output?) rescue TransporterRequiresApplicationSpecificPasswordError => ex handle_two_step_failure(ex) return download(app_id, dir) end return result if Helper.test? itmsp_path = File.join(dir, "#{app_id}.itmsp") successful = result && File.directory?(itmsp_path) if successful UI.success("✅ Successfully downloaded the latest package from App Store Connect to #{itmsp_path}") else handle_error(@password) end successful end |
#upload(app_id, dir) ⇒ Bool
Uploads the modified package back to App Store Connect
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 |
# File 'fastlane_core/lib/fastlane_core/itunes_transporter.rb', line 377 def upload(app_id, dir) actual_dir = File.join(dir, "#{app_id}.itmsp") UI.("Going to upload updated app to App Store Connect") UI.success("This might take a few minutes. Please don't interrupt the script.") command = @transporter_executor.build_upload_command(@user, @password, actual_dir, @provider_short_name) UI.verbose(@transporter_executor.build_upload_command(@user, 'YourPassword', actual_dir, @provider_short_name)) begin result = @transporter_executor.execute(command, ItunesTransporter.hide_transporter_output?) rescue TransporterRequiresApplicationSpecificPasswordError => ex handle_two_step_failure(ex) return upload(app_id, dir) end if result UI.header("Successfully uploaded package to App Store Connect. It might take a few minutes until it's visible online.") FileUtils.rm_rf(actual_dir) unless Helper.test? # we don't need the package any more, since the upload was successful else handle_error(@password) end result end |