Class: Fastlane::Actions::ExtractCertificateAction

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

Constant Summary collapse

PROVISIONS =
"#{Dir.home}/Library/MobileDevice/Provisioning\ Profiles/".freeze

Class Method Summary collapse

Class Method Details

.authorsObject



78
79
80
# File 'lib/fastlane/plugin/xamarin_build/actions/extract_certificate.rb', line 78

def self.authors
  ['punksta']
end

.available_optionsObject



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/fastlane/plugin/xamarin_build/actions/extract_certificate.rb', line 37

def self.available_options
  [
    FastlaneCore::ConfigItem.new(
      key: :provision_path,
      env_name: 'FL_EXTRACT_CERTIFICATE_PR_PATH',
      description: 'Path to provision profile',
      is_string: true,
      optional: true,
      verify_block: proc do |path|
                      check_profile(path)
                    end
    ),

    FastlaneCore::ConfigItem.new(
      key: :uuid,
      env_name: 'FL_EXTRACT_CERTIFICATE_UUID',
      description: 'UUID of provision profile in default dir',
      is_string: true,
      optional: true,
      verify_block: proc do |uuid|
        provision_path = default_path(uuid)
        check_profile(provision_path)
      end
    ),

    FastlaneCore::ConfigItem.new(
      key: :log_certificate,
      env_name: 'FL_EXTRACT_CERTIFICATE_LOG',
      description: 'Logging extracting certificate',
      optional: true,
      default_value: true,
      is_string: false
    )
  ]
end

.check_profile(file) ⇒ Object



27
28
29
30
31
# File 'lib/fastlane/plugin/xamarin_build/actions/extract_certificate.rb', line 27

def self.check_profile(file)
  UI.user_error!('Empty input') if file.nil?
  UI.user_error!("#{file} does not exist") unless File.exist? file
  UI.user_error!("#{file} is not a file") unless File.file? file
end

.default_path(uuid) ⇒ Object



33
34
35
# File 'lib/fastlane/plugin/xamarin_build/actions/extract_certificate.rb', line 33

def self.default_path(uuid)
  File.join PROVISIONS, "#{uuid}.mobileprovision"
end

.descriptionObject



18
19
20
# File 'lib/fastlane/plugin/xamarin_build/actions/extract_certificate.rb', line 18

def self.description
  'Extract certificate public key from provision profile'
end

.detailsObject



22
23
24
25
# File 'lib/fastlane/plugin/xamarin_build/actions/extract_certificate.rb', line 22

def self.details
  'You can use it to get info about signing certificate' \
    'like certificate name and id'
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


82
83
84
# File 'lib/fastlane/plugin/xamarin_build/actions/extract_certificate.rb', line 82

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

.return_valueObject



73
74
75
76
# File 'lib/fastlane/plugin/xamarin_build/actions/extract_certificate.rb', line 73

def self.return_value
  'Returns OpenSSL::X509::Certificate object representing' \
    'signing certificate from provision profile'
end

.run(params) ⇒ Object



11
12
13
14
15
16
# File 'lib/fastlane/plugin/xamarin_build/actions/extract_certificate.rb', line 11

def self.run(params)
  path = params[:provision_path]
  path = default_path(params[:uuid]) if path.nil?
  check_profile(path)
  return ProvisionUtil::get_cert_from_provision(path)
end