class Fastlane::Actions::ValidateAppAction
Public Class Methods
available_options()
click to toggle source
# File lib/fastlane/plugin/validate_app/actions/validate_app_action.rb, line 74 def self.available_options require 'credentials_manager/appfile_config' @user = CredentialsManager::AppfileConfig.try_fetch_value(:itunes_connect_id) @user ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id) [ FastlaneCore::ConfigItem.new(key: :ipa, env_name: "VALIDATE_APP_IPA", description: "Path to the ipa file to validate", is_string: true, default_value: Dir["*.ipa"].sort_by { |x| File.mtime(x) }.last, optional: true, verify_block: proc do |value| value = File.expand_path(value) UI.user_error!("could not find ipa file at path '#{value}'") unless File.exist?(value) UI.user_error!("'#{value}' doesn't seem to be an ipa file") unless value.end_with?(".ipa") end), FastlaneCore::ConfigItem.new(key: :username, env_name: "VALIDATE_APP_USERNAME", description: "Your Apple ID username", is_string: true, default_value: @user, optional: true) ] end
description()
click to toggle source
# File lib/fastlane/plugin/validate_app/actions/validate_app_action.rb, line 47 def self.description "Validate your ipa file" end
details()
click to toggle source
# File lib/fastlane/plugin/validate_app/actions/validate_app_action.rb, line 59 def self.details [ "Validate your ipa file using altool before upload to ensure only", "valid builds are uploaded and processed by iTunes Connect.", "More information: https://github.com/thii/fastlane-plugin-validate_app" ].join(' ') end
fetch_password_from_keychain()
click to toggle source
# File lib/fastlane/plugin/validate_app/actions/validate_app_action.rb, line 67 def self.fetch_password_from_keychain require 'credentials_manager/account_manager' keychain_entry = CredentialsManager::AccountManager.new(user: @user) keychain_entry.password end
is_supported?(platform)
click to toggle source
# File lib/fastlane/plugin/validate_app/actions/validate_app_action.rb, line 102 def self.is_supported?(platform) [:ios, :mac, :appletvos].include?(platform) end
return_value()
click to toggle source
# File lib/fastlane/plugin/validate_app/actions/validate_app_action.rb, line 55 def self.return_value "Returns nil if build is valid, and an array of error objects if build is invalid" end
run(params)
click to toggle source
# File lib/fastlane/plugin/validate_app/actions/validate_app_action.rb, line 7 def self.run(params) require 'plist' xcode_contents_path = `dirname "$(xcode-select --print-path)"`.strip altool = "#{xcode_contents_path}/Applications/Application Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Support/altool".shellescape ENV["VALIDATE_APP_PASSWORD"] = ENV["ALTOOL_2FA_PASSWORD"] || ENV["FASTLANE_PASSWORD"] || ENV["DELIVER_PASSWORD"] || self.fetch_password_from_keychain ipa = params[:ipa].to_s.shellescape username = params[:username] password = "@env:VALIDATE_APP_PASSWORD" UI.message("Validating #{ipa}. This may take a while.") command = [altool] command << "--validate-app" command << "--file" command << ipa command << "--username" command << username command << "--password" command << password command << "--output-format xml" result = Actions.sh(command.join(' ')) plist = Plist.parse_xml(result) errors = plist["product-errors"] if errors.nil? UI.success(plist["success-message"]) return nil end errors.each do |error| UI.error(error["message"]) end errors end