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
52 53 54 |
# File 'lib/fastlane/plugin/validate_app/actions/validate_app_action.rb', line 52 def self. ["Thi"] end |
.available_options ⇒ Object
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 101 |
# File 'lib/fastlane/plugin/validate_app/actions/validate_app_action.rb', line 75 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: false, 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: false) ] end |
.description ⇒ Object
48 49 50 |
# File 'lib/fastlane/plugin/validate_app/actions/validate_app_action.rb', line 48 def self.description "Validate your ipa file" end |
.details ⇒ Object
60 61 62 63 64 65 66 |
# File 'lib/fastlane/plugin/validate_app/actions/validate_app_action.rb', line 60 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
68 69 70 71 72 73 |
# File 'lib/fastlane/plugin/validate_app/actions/validate_app_action.rb', line 68 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
103 104 105 |
# File 'lib/fastlane/plugin/validate_app/actions/validate_app_action.rb', line 103 def self.is_supported?(platform) [:ios, :mac, :appletvos].include?(platform) end |
.return_value ⇒ Object
56 57 58 |
# File 'lib/fastlane/plugin/validate_app/actions/validate_app_action.rb', line 56 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 46 |
# 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 ipa = params[:ipa].to_s.shellescape UI.("Validating #{ipa}. This may take a while.") password = "@env:DELIVER_PASSWORD" if ENV["DELIVER_PASSWORD"].to_s.length > 0 password = "@env:FASTLANE_PASSWORD" if ENV["FASTLANE_PASSWORD"].to_s.length > 0 if password.to_s.empty? password = self.fetch_password_from_keychain end command = [altool] command << "--validate-app" command << "--file" command << ipa command << "--username #{params[:username]}" command << "--password" command << password command << "--output-format xml" plist = Plist.parse_xml(`#{command.join(' ')}`) errors = plist["product-errors"] if errors.nil? UI.success("IPA file is valid. Ready to be uploaded to iTunes Connect!") return nil end errors.each do |error| UI.error(error["message"]) end errors end |