class Fastlane::Actions::VerifyIpaFilesAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/verify_ipa/actions/verify_ipa_files_action.rb, line 32
def self.authors
  ['Derek Yang']
end
available_options() click to toggle source
# File lib/fastlane/plugin/verify_ipa/actions/verify_ipa_files_action.rb, line 36
def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :ipa_path,
                            env_name: 'VERIFY_IPA_IPA_PATH',
                         description: 'Explicitly set the ipa path',
                            optional: true),
    FastlaneCore::ConfigItem.new(key: :blacklist,
                            env_name: 'VERIFY_IPA_BLACKLIST',
                         description: 'A list of glob patterns that define what files should NOT make their way into the ipa',
                            optional: false,
                                type: Array),
    FastlaneCore::ConfigItem.new(key: :whitelist,
                            env_name: 'VERIFY_IPA_WHITELIST',
                         description: 'A list of glob patterns that are allowed to be included in the ipa',
                            optional: true,
                                type: Array)
  ]
end
description() click to toggle source
# File lib/fastlane/plugin/verify_ipa/actions/verify_ipa_files_action.rb, line 24
def self.description
  'Verify files in ipa file'
end
details() click to toggle source
# File lib/fastlane/plugin/verify_ipa/actions/verify_ipa_files_action.rb, line 28
def self.details
  'Make sure no sensible files (e.g. build script or mock data with sensible info) are accidentally included in ipa file'
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/verify_ipa/actions/verify_ipa_files_action.rb, line 55
def self.is_supported?(platform)
  [:ios].include?(platform)
end
run(params) click to toggle source
# File lib/fastlane/plugin/verify_ipa/actions/verify_ipa_files_action.rb, line 4
def self.run(params)
  Dir.mktmpdir do |dir|
    app_path = Helper::VerifyIpaHelper.app_path(params[:ipa_path], dir)
    self.verify_files(params, app_path)
  end
end
verify_files(params, app_path) click to toggle source
# File lib/fastlane/plugin/verify_ipa/actions/verify_ipa_files_action.rb, line 11
def self.verify_files(params, app_path)
  files_on_blacklist = []
  files_on_whitelist = []

  Dir.chdir(app_path) do
    params[:blacklist].each { |pattern| files_on_blacklist << Dir.glob(pattern) }
    params[:whitelist].each { |pattern| files_on_whitelist << Dir.glob(pattern) } if params[:whitelist]

    invalid_files = files_on_blacklist.flatten - files_on_whitelist.flatten
    UI.user_error!("Found files on the blacklist: #{invalid_files}") unless invalid_files.empty?
  end
end