class FastlaneCore::ShellScriptTransporterExecutor
Generates commands and executes the iTMSTransporter through the shell script it provides by the same name
Public Instance Methods
Source
# File fastlane_core/lib/fastlane_core/itunes_transporter.rb, line 412 def build_credential_params(username = nil, password = nil, jwt = nil, api_key = nil) if !(username.nil? || password.nil?) && (jwt.nil? && api_key.nil?) "-u #{username.shellescape} -p #{shell_escaped_password(password)}" elsif !jwt.nil? && api_key.nil? "-jwt #{jwt}" elsif !api_key.nil? "-apiIssuer #{api_key[:issuer_id]} -apiKey #{api_key[:key_id]}" end end
Source
# File fastlane_core/lib/fastlane_core/itunes_transporter.rb, line 435 def build_download_command(username, password, apple_id, destination = "/tmp", provider_short_name = "", jwt = nil) [ '"' + Helper.transporter_path + '"', "-m lookupMetadata", build_credential_params(username, password, jwt), "-apple_id #{apple_id}", "-destination '#{destination}'", ("-itc_provider #{provider_short_name}" if jwt.nil? && !provider_short_name.to_s.empty?) ].compact.join(' ') end
Source
# File fastlane_core/lib/fastlane_core/itunes_transporter.rb, line 446 def build_provider_ids_command(username, password, jwt = nil, api_key = nil) [ '"' + Helper.transporter_path + '"', '-m provider', build_credential_params(username, password, jwt, api_key) ].compact.join(' ') end
Source
# File fastlane_core/lib/fastlane_core/itunes_transporter.rb, line 422 def build_upload_command(username, password, source = "/tmp", provider_short_name = "", jwt = nil, platform = nil, api_key = nil) [ '"' + Helper.transporter_path + '"', "-m upload", build_credential_params(username, password, jwt, api_key), 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
Source
# File fastlane_core/lib/fastlane_core/itunes_transporter.rb, line 454 def build_verify_command(username, password, source = "/tmp", provider_short_name = "", **kwargs) jwt = kwargs[:jwt] [ '"' + Helper.transporter_path + '"', '-m verify', build_credential_params(username, password, 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
Source
# File fastlane_core/lib/fastlane_core/itunes_transporter.rb, line 466 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
Private Instance Methods
Source
# File fastlane_core/lib/fastlane_core/itunes_transporter.rb, line 483 def shell_escaped_password(password) password = password.shellescape unless Helper.windows? # 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 # background: https://stackoverflow.com/questions/1250079/how-to-escape-single-quotes-within-single-quoted-strings/1250098#1250098 password = password.gsub("\\'") do # we use the 'do' version of gsub, because two-param version interprets the replace text as a pattern and does the wrong thing "'\"\\'\"'" 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 = "'" + password + "'" end return password end