Class: Match::Utils
- Inherits:
-
Object
- Object
- Match::Utils
- Defined in:
- match/lib/match/utils.rb
Class Method Summary collapse
- .base_environment_variable_name(app_identifier: nil, type: nil, platform: :ios) ⇒ Object
- .environment_variable_name(app_identifier: nil, type: nil, platform: :ios) ⇒ Object
- .environment_variable_name_profile_name(app_identifier: nil, type: nil, platform: :ios) ⇒ Object
- .environment_variable_name_profile_path(app_identifier: nil, type: nil, platform: :ios) ⇒ Object
- .environment_variable_name_team_id(app_identifier: nil, type: nil, platform: :ios) ⇒ Object
-
.fill_environment(key, value) ⇒ Object
Fill in an environment variable, ready to be used in xcodebuild.
- .get_cert_info(cer_certificate_path) ⇒ Object
- .import(item_path, keychain, password: nil) ⇒ Object
- .is_cert_valid?(cer_certificate_path) ⇒ Boolean
Class Method Details
.base_environment_variable_name(app_identifier: nil, type: nil, platform: :ios) ⇒ Object
67 68 69 70 71 72 73 |
# File 'match/lib/match/utils.rb', line 67 def self.base_environment_variable_name(app_identifier: nil, type: nil, platform: :ios) if platform.to_s == :ios.to_s ["sigh", app_identifier, type] # We keep the ios profiles without the platform for backwards compatibility else ["sigh", app_identifier, type, platform.to_s] end end |
.environment_variable_name(app_identifier: nil, type: nil, platform: :ios) ⇒ Object
18 19 20 |
# File 'match/lib/match/utils.rb', line 18 def self.environment_variable_name(app_identifier: nil, type: nil, platform: :ios) base_environment_variable_name(app_identifier: app_identifier, type: type, platform: platform).join("_") end |
.environment_variable_name_profile_name(app_identifier: nil, type: nil, platform: :ios) ⇒ Object
26 27 28 |
# File 'match/lib/match/utils.rb', line 26 def self.environment_variable_name_profile_name(app_identifier: nil, type: nil, platform: :ios) (base_environment_variable_name(app_identifier: app_identifier, type: type, platform: platform) + ["profile-name"]).join("_") end |
.environment_variable_name_profile_path(app_identifier: nil, type: nil, platform: :ios) ⇒ Object
30 31 32 |
# File 'match/lib/match/utils.rb', line 30 def self.environment_variable_name_profile_path(app_identifier: nil, type: nil, platform: :ios) (base_environment_variable_name(app_identifier: app_identifier, type: type, platform: platform) + ["profile-path"]).join("_") end |
.environment_variable_name_team_id(app_identifier: nil, type: nil, platform: :ios) ⇒ Object
22 23 24 |
# File 'match/lib/match/utils.rb', line 22 def self.environment_variable_name_team_id(app_identifier: nil, type: nil, platform: :ios) (base_environment_variable_name(app_identifier: app_identifier, type: type, platform: platform) + ["team-id"]).join("_") end |
.fill_environment(key, value) ⇒ Object
Fill in an environment variable, ready to be used in xcodebuild
13 14 15 16 |
# File 'match/lib/match/utils.rb', line 13 def self.fill_environment(key, value) UI.important("Setting environment variable '#{key}' to '#{value}'") if FastlaneCore::Globals.verbose? ENV[key] = value end |
.get_cert_info(cer_certificate_path) ⇒ Object
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 |
# File 'match/lib/match/utils.rb', line 34 def self.get_cert_info(cer_certificate_path) cert = OpenSSL::X509::Certificate.new(File.binread(cer_certificate_path)) # openssl output: # subject= /UID={User ID}/CN={Certificate Name}/OU={Certificate User}/O={Organisation}/C={Country} cert_info = cert.subject.to_s.gsub(/\s*subject=\s*/, "").tr("/", "\n") out_array = cert_info.split("\n") openssl_keys_to_readable_keys = { 'UID' => 'User ID', 'CN' => 'Common Name', 'OU' => 'Organisation Unit', 'O' => 'Organisation', 'C' => 'Country', 'notBefore' => 'Start Datetime', 'notAfter' => 'End Datetime' } return out_array.map { |x| x.split(/=+/) if x.include?("=") } .compact .map { |k, v| [openssl_keys_to_readable_keys.fetch(k, k), v] } .push([openssl_keys_to_readable_keys.fetch("notBefore"), cert.not_before]) .push([openssl_keys_to_readable_keys.fetch("notAfter"), cert.not_after]) rescue => ex UI.error("get_cert_info: #{ex}") return {} end |
.import(item_path, keychain, password: nil) ⇒ Object
7 8 9 10 |
# File 'match/lib/match/utils.rb', line 7 def self.import(item_path, keychain, password: nil) keychain_path = FastlaneCore::Helper.keychain_path(keychain) FastlaneCore::KeychainImporter.import_file(item_path, keychain_path, keychain_password: password, output: FastlaneCore::Globals.verbose?) end |