Class: FastlaneCore::ShellScriptTransporterExecutor

Inherits:
TransporterExecutor show all
Defined in:
fastlane_core/lib/fastlane_core/itunes_transporter.rb

Overview

Generates commands and executes the iTMSTransporter through the shell script it provides by the same name

Constant Summary

Constants inherited from TransporterExecutor

TransporterExecutor::ITMS_PROVIDER_REGEX

Instance Method Summary collapse

Methods inherited from TransporterExecutor

#displayable_errors, #execute, #parse_provider_info

Instance Method Details

#build_download_command(username, password, apple_id, destination = "/tmp", provider_short_name = "", jwt = nil) ⇒ Object



401
402
403
404
405
406
407
408
409
410
411
412
413
# File 'fastlane_core/lib/fastlane_core/itunes_transporter.rb', line 401

def build_download_command(username, password, apple_id, destination = "/tmp", provider_short_name = "", jwt = nil)
  use_jwt = !jwt.to_s.empty?
  [
    '"' + Helper.transporter_path + '"',
    "-m lookupMetadata",
    ("-u #{username.shellescape}" unless use_jwt),
    ("-p #{shell_escaped_password(password)}" unless use_jwt),
    ("-jwt #{jwt}" if use_jwt),
    "-apple_id #{apple_id}",
    "-destination '#{destination}'",
    ("-itc_provider #{provider_short_name}" if jwt.nil? && !provider_short_name.to_s.empty?)
  ].compact.join(' ')
end

#build_provider_ids_command(username, password, jwt = nil, api_key = nil) ⇒ Object



415
416
417
418
419
420
421
422
423
424
# File 'fastlane_core/lib/fastlane_core/itunes_transporter.rb', line 415

def build_provider_ids_command(username, password, jwt = nil, api_key = nil)
  use_jwt = !jwt.to_s.empty?
  [
    '"' + Helper.transporter_path + '"',
    '-m provider',
    ("-u \"#{username.shellescape}\"" unless use_jwt),
    ("-p #{shell_escaped_password(password)}" unless use_jwt),
    ("-jwt #{jwt}" if use_jwt)
  ].compact.join(' ')
end

#build_upload_command(username, password, source = "/tmp", provider_short_name = "", jwt = nil, platform = nil, api_key = nil) ⇒ Object



385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
# File 'fastlane_core/lib/fastlane_core/itunes_transporter.rb', line 385

def build_upload_command(username, password, source = "/tmp", provider_short_name = "", jwt = nil, platform = nil, api_key = nil)
  use_jwt = !jwt.to_s.empty?
  [
    '"' + Helper.transporter_path + '"',
    "-m upload",
    ("-u #{username.shellescape}" unless use_jwt),
    ("-p #{shell_escaped_password(password)}" unless use_jwt),
    ("-jwt #{jwt}" if use_jwt),
    file_upload_option(source),
    additional_upload_parameters, # that's here, because the user might overwrite the -t option
    "-k 100000",
    ("-WONoPause true" if Helper.windows?), # Windows only: process instantly returns instead of waiting for key press
    ("-itc_provider #{provider_short_name}" if jwt.nil? && !provider_short_name.to_s.empty?)
  ].compact.join(' ')
end

#build_verify_command(username, password, source = "/tmp", provider_short_name = "", **kwargs) ⇒ Object



426
427
428
429
430
431
432
433
434
435
436
437
438
439
# File 'fastlane_core/lib/fastlane_core/itunes_transporter.rb', line 426

def build_verify_command(username, password, source = "/tmp", provider_short_name = "", **kwargs)
  jwt = kwargs[:jwt]
  use_jwt = !jwt.to_s.empty?
  [
    '"' + Helper.transporter_path + '"',
    '-m verify',
    ("-u #{username.shellescape}" unless use_jwt),
    ("-p #{shell_escaped_password(password)}" unless use_jwt),
    ("-jwt #{jwt}" if use_jwt),
    "-f #{source.shellescape}",
    ("-WONoPause true" if Helper.windows?), # Windows only: process instantly returns instead of waiting for key press
    ("-itc_provider #{provider_short_name}" if jwt.nil? && !provider_short_name.to_s.empty?)
  ].compact.join(' ')
end

#handle_error(password) ⇒ Object



441
442
443
444
445
446
447
448
449
450
451
452
453
454
# File 'fastlane_core/lib/fastlane_core/itunes_transporter.rb', line 441

def handle_error(password)
  # rubocop:disable Style/CaseEquality
  # rubocop:disable Style/YodaCondition
  unless /^[0-9a-zA-Z\.\$\_\-]*$/ === password
    UI.error([
      "Password contains special characters, which may not be handled properly by iTMSTransporter.",
      "If you experience problems uploading to App Store Connect, please consider changing your password to something with only alphanumeric characters."
    ].join(' '))
  end
  # rubocop:enable Style/CaseEquality
  # rubocop:enable Style/YodaCondition

  UI.error("Could not download/upload from App Store Connect! It's probably related to your password or your internet connection.")
end