Class: Fastlane::Actions::ProfileExpirationInfoAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/profile_expiration_info/actions/profile_expiration_info_action.rb

Class Method Summary collapse

Class Method Details

.authorsObject



36
37
38
# File 'lib/fastlane/plugin/profile_expiration_info/actions/profile_expiration_info_action.rb', line 36

def self.authors
  ["Steven Chung/swchung"]
end

.available_optionsObject



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/fastlane/plugin/profile_expiration_info/actions/profile_expiration_info_action.rb', line 23

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :provisioning_profile_filepath,
                            env_name: "PEI_PROVISIONING_PROFILE_FILEPATH", # The name of the environment variable
                         description: "The filepath to the provisioning profile",
                            optional: false,
                                type: String,
                        verify_block: proc do |value|
                          UI.user_error!('No path provided for the provisioning profile given to the ProfileExpirationInfoAction. Pass using `provisioning_profile_filepath: \'path/to/provisioning/profile\'`') if value.nil? || value.empty?
                        end)
  ]
end

.descriptionObject



19
20
21
# File 'lib/fastlane/plugin/profile_expiration_info/actions/profile_expiration_info_action.rb', line 19

def self.description
  "This plugin, given a filepath to a .mobileprovision file, will return whether or not that provisioning profile is expired and the DateTime that it expires"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/fastlane/plugin/profile_expiration_info/actions/profile_expiration_info_action.rb', line 44

def self.is_supported?(platform)
  [:ios, :mac].include?(platform)
end

.return_valueObject



40
41
42
# File 'lib/fastlane/plugin/profile_expiration_info/actions/profile_expiration_info_action.rb', line 40

def self.return_value
  "Array with 2 elements: whether or not the provisioning profile has expired and when it expires."
end

.run(params) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/fastlane/plugin/profile_expiration_info/actions/profile_expiration_info_action.rb', line 7

def self.run(params)
  prov_prof = File.read(params[:provisioning_profile_filepath]).encode!('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')
  # Extracts the plist from the binary
  regexp = /.*(<\?xml .*<\/plist>).*/mn
  plist = prov_prof.match(regexp)[1]
  hash = Plist::parse_xml(plist)
  exp_date = hash["ExpirationDate"]
  expired = exp_date < DateTime.now

  [expired, exp_date]
end