class FastlaneCore::ShellScriptTransporterExecutor

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

Public Instance Methods

build_download_command(username, password, apple_id, destination = "/tmp", provider_short_name = "") click to toggle source
# File lib/fastlane_core/itunes_transporter.rb, line 158
def build_download_command(username, password, apple_id, destination = "/tmp", provider_short_name = "")
  [
    '"' + Helper.transporter_path + '"',
    "-m lookupMetadata",
    "-u \"#{username}\"",
    "-p #{shell_escaped_password(password)}",
    "-apple_id #{apple_id}",
    "-destination '#{destination}'",
    ("-itc_provider #{provider_short_name}" unless provider_short_name.to_s.empty?)
  ].compact.join(' ')
end
build_upload_command(username, password, source = "/tmp", provider_short_name = "") click to toggle source
# File lib/fastlane_core/itunes_transporter.rb, line 144
def build_upload_command(username, password, source = "/tmp", provider_short_name = "")
  [
    '"' + Helper.transporter_path + '"',
    "-m upload",
    "-u \"#{username}\"",
    "-p #{shell_escaped_password(password)}",
    "-f '#{source}'",
    ENV["DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS"], # that's here, because the user might overwrite the -t option
    "-t 'Signiant'",
    "-k 100000",
    ("-itc_provider #{provider_short_name}" unless provider_short_name.to_s.empty?)
  ].compact.join(' ')
end
handle_error(password) click to toggle source
# File lib/fastlane_core/itunes_transporter.rb, line 170
def handle_error(password)
  # rubocop:disable Style/CaseEquality
  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 iTunes Connect, please consider changing your password to something with only alphanumeric characters."
    ].join(' '))
  end
  # rubocop:enable Style/CaseEquality
  UI.error("Could not download/upload from iTunes Connect! It's probably related to your password or your internet connection.")
end

Private Instance Methods

shell_escaped_password(password) click to toggle source
# File lib/fastlane_core/itunes_transporter.rb, line 184
def shell_escaped_password(password)
  # because the shell handles passwords with single-quotes incorrectly, use gsub to replace ShellEscape'd single-quotes of this form:
  #    \'
  # with a sequence that wraps the escaped single-quote in double-quotes:
  #    '"\'"'
  # this allows us to properly handle passwords with single-quotes in them
  # we use the 'do' version of gsub, because two-param version interprets the replace text as a pattern and does the wrong thing
  password = Shellwords.escape(password).gsub("\\'") do
    "'\"\\'\"'"
  end

  # wrap the fully-escaped password in single quotes, since the transporter expects a escaped password string (which must be single-quoted for the shell's benefit)
  "'" + password + "'"
end