Class: Fastlane::Actions::ValidateAppAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::ValidateAppAction
- Defined in:
- lib/fastlane/plugin/validate_app/actions/validate_app_action.rb
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .fetch_password_from_keychain ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .return_value ⇒ Object
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
51 52 53 |
# File 'lib/fastlane/plugin/validate_app/actions/validate_app_action.rb', line 51 def self. ["Thi"] end |
.available_options ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/fastlane/plugin/validate_app/actions/validate_app_action.rb', line 74 def self. 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.(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 ⇒ Object
47 48 49 |
# File 'lib/fastlane/plugin/validate_app/actions/validate_app_action.rb', line 47 def self.description "Validate your ipa file" end |
.details ⇒ Object
59 60 61 62 63 64 65 |
# 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 ⇒ Object
67 68 69 70 71 72 |
# 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) ⇒ Boolean
102 103 104 |
# 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 ⇒ Object
55 56 57 |
# 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) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# 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.("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 |