Class: Match::Utils
- Inherits:
-
Object
- Object
- Match::Utils
- Defined in:
- lib/match/utils.rb
Class Method Summary collapse
- .base_environment_variable_name(app_identifier: nil, type: nil) ⇒ Object
- .environment_variable_name(app_identifier: nil, type: nil) ⇒ Object
- .environment_variable_name_profile_name(app_identifier: nil, type: nil) ⇒ Object
- .environment_variable_name_team_id(app_identifier: nil, type: nil) ⇒ 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: "") ⇒ Object
Class Method Details
.base_environment_variable_name(app_identifier: nil, type: nil) ⇒ Object
55 56 57 |
# File 'lib/match/utils.rb', line 55 def self.base_environment_variable_name(app_identifier: nil, type: nil) ["sigh", app_identifier, type] end |
.environment_variable_name(app_identifier: nil, type: nil) ⇒ Object
14 15 16 |
# File 'lib/match/utils.rb', line 14 def self.environment_variable_name(app_identifier: nil, type: nil) base_environment_variable_name(app_identifier: app_identifier, type: type).join("_") end |
.environment_variable_name_profile_name(app_identifier: nil, type: nil) ⇒ Object
22 23 24 |
# File 'lib/match/utils.rb', line 22 def self.environment_variable_name_profile_name(app_identifier: nil, type: nil) (base_environment_variable_name(app_identifier: app_identifier, type: type) + ["profile-name"]).join("_") end |
.environment_variable_name_team_id(app_identifier: nil, type: nil) ⇒ Object
18 19 20 |
# File 'lib/match/utils.rb', line 18 def self.environment_variable_name_team_id(app_identifier: nil, type: nil) (base_environment_variable_name(app_identifier: app_identifier, type: type) + ["team-id"]).join("_") end |
.fill_environment(key, value) ⇒ Object
Fill in an environment variable, ready to be used in xcodebuild
9 10 11 12 |
# File 'lib/match/utils.rb', line 9 def self.fill_environment(key, value) UI.important "Setting environment variable '#{key}' to '#{value}'" if $verbose ENV[key] = value end |
.get_cert_info(cer_certificate_path) ⇒ Object
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 |
# File 'lib/match/utils.rb', line 26 def self.get_cert_info(cer_certificate_path) command = "openssl x509 -inform der -in #{cer_certificate_path.shellescape} -subject -dates -noout" command << " &" # start in separate process output = Helper.backticks(command, print: $verbose) # openssl output: # subject= /UID={User ID}/CN={Certificate Name}/OU={Certificate User}/O={Organisation}/C={Country}\n # notBefore={Start datetime}\n # notAfter={End datetime} cert_info = output.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] } rescue => ex UI.error(ex) return {} end |
.import(item_path, keychain, password: "") ⇒ Object
3 4 5 6 |
# File 'lib/match/utils.rb', line 3 def self.import(item_path, keychain, password: "") keychain_path = FastlaneCore::Helper.keychain_path(keychain) FastlaneCore::KeychainImporter.import_file(item_path, keychain_path, keychain_password: password, output: $verbose) end |