Class: Cert::Options

Inherits:
Object
  • Object
show all
Defined in:
cert/lib/cert/options.rb

Class Method Summary collapse

Class Method Details

.available_optionsObject



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
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
72
73
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
101
102
103
# File 'cert/lib/cert/options.rb', line 8

def self.available_options
  user = CredentialsManager::AppfileConfig.try_fetch_value(:apple_dev_portal_id)
  user ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id)

  [
    FastlaneCore::ConfigItem.new(key: :development,
                                 env_name: "CERT_DEVELOPMENT",
                                 description: "Create a development certificate instead of a distribution one",
                                 type: Boolean,
                                 default_value: false),
    FastlaneCore::ConfigItem.new(key: :type,
                                 env_name: "CERT_TYPE",
                                 description: "Create specific certificate type (takes precedence over :development)",
                                 optional: true,
                                 verify_block: proc do |value|
                                   value = value.to_s
                                   types = %w(mac_installer_distribution developer_id_installer developer_id_application)
                                   UI.user_error!("Unsupported types, must be: #{types}") unless types.include?(value)
                                 end),
    FastlaneCore::ConfigItem.new(key: :force,
                                 env_name: "CERT_FORCE",
                                 description: "Create a certificate even if an existing certificate exists",
                                 type: Boolean,
                                 default_value: false),
    FastlaneCore::ConfigItem.new(key: :generate_apple_certs,
                                 env_name: "CERT_GENERATE_APPLE_CERTS",
                                 description: "Create a certificate type for Xcode 11 and later (Apple Development or Apple Distribution)",
                                 type: Boolean,
                                 default_value: FastlaneCore::Helper.mac? && FastlaneCore::Helper.xcode_at_least?('11'),
                                 default_value_dynamic: true),
    FastlaneCore::ConfigItem.new(key: :username,
                                 short_option: "-u",
                                 env_name: "CERT_USERNAME",
                                 description: "Your Apple ID Username",
                                 default_value: user,
                                 default_value_dynamic: true),
    FastlaneCore::ConfigItem.new(key: :team_id,
                                 short_option: "-b",
                                 env_name: "CERT_TEAM_ID",
                                 code_gen_sensitive: true,
                                 default_value: CredentialsManager::AppfileConfig.try_fetch_value(:team_id),
                                 default_value_dynamic: true,
                                 description: "The ID of your Developer Portal team if you're in multiple teams",
                                 optional: true,
                                 verify_block: proc do |value|
                                   ENV["FASTLANE_TEAM_ID"] = value.to_s
                                 end),
    FastlaneCore::ConfigItem.new(key: :team_name,
                                 short_option: "-l",
                                 env_name: "CERT_TEAM_NAME",
                                 description: "The name of your Developer Portal team if you're in multiple teams",
                                 optional: true,
                                 code_gen_sensitive: true,
                                 default_value: CredentialsManager::AppfileConfig.try_fetch_value(:team_name),
                                 default_value_dynamic: true,
                                 verify_block: proc do |value|
                                   ENV["FASTLANE_TEAM_NAME"] = value.to_s
                                 end),
    FastlaneCore::ConfigItem.new(key: :filename,
                                 short_option: "-q",
                                 env_name: "CERT_FILE_NAME",
                                 optional: true,
                                 description: "The filename of certificate to store"),
    FastlaneCore::ConfigItem.new(key: :output_path,
                                 short_option: "-o",
                                 env_name: "CERT_OUTPUT_PATH",
                                 description: "The path to a directory in which all certificates and private keys should be stored",
                                 default_value: "."),
    FastlaneCore::ConfigItem.new(key: :keychain_path,
                                 short_option: "-k",
                                 env_name: "CERT_KEYCHAIN_PATH",
                                 description: "Path to a custom keychain",
                                 code_gen_sensitive: true,
                                 default_value: Dir["#{Dir.home}/Library/Keychains/login.keychain", "#{Dir.home}/Library/Keychains/login.keychain-db"].last,
                                 default_value_dynamic: true,
                                 verify_block: proc do |value|
                                   value = File.expand_path(value)
                                   UI.user_error!("Keychain not found at path '#{value}'") unless File.exist?(value)
                                 end),
    FastlaneCore::ConfigItem.new(key: :keychain_password,
                                 short_option: "-p",
                                 env_name: "CERT_KEYCHAIN_PASSWORD",
                                 sensitive: true,
                                 description: "This might be required the first time you access certificates on a new mac. For the login/default keychain this is your account password",
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :platform,
                                 env_name: "CERT_PLATFORM",
                                 description: "Set the provisioning profile's platform (ios, macos)",
                                 default_value: "ios",
                                 verify_block: proc do |value|
                                   value = value.to_s
                                   pt = %w(macos ios)
                                   UI.user_error!("Unsupported platform, must be: #{pt}") unless pt.include?(value)
                                 end)
  ]
end