cert/lib/cert/runner.rb in fastlane-2.92.0.beta.20180416050023 vs cert/lib/cert/runner.rb in fastlane-2.92.0
- old
+ new
@@ -87,11 +87,11 @@
certificates.each do |certificate|
unless certificate.can_download
next
end
- path = store_certificate(certificate)
+ path = store_certificate(certificate, Cert.config[:filename])
private_key_path = File.expand_path(File.join(Cert.config[:output_path], "#{certificate.id}.p12"))
if FastlaneCore::CertChecker.installed?(path)
# This certificate is installed on the local machine
ENV["CER_CERTIFICATE_ID"] = certificate.id
@@ -168,11 +168,11 @@
File.write(request_path, csr.to_pem)
private_key_path = File.expand_path(File.join(Cert.config[:output_path], "#{certificate.id}.p12"))
File.write(private_key_path, pkey)
- cert_path = store_certificate(certificate)
+ cert_path = store_certificate(certificate, Cert.config[:filename])
# Import all the things into the Keychain
keychain = File.expand_path(Cert.config[:keychain_path])
password = Cert.config[:keychain_password]
FastlaneCore::KeychainImporter.import_file(private_key_path, keychain, keychain_password: password)
@@ -185,11 +185,13 @@
UI.success("Successfully generated #{certificate.id} which was imported to the local machine.")
return cert_path
end
- def store_certificate(certificate)
- path = File.expand_path(File.join(Cert.config[:output_path], "#{certificate.id}.cer"))
+ def store_certificate(certificate, filename = nil)
+ cert_name = filename ? filename : certificate.id
+ cert_name = "#{cert_name}.cer" unless File.extname(cert_name) == ".cer"
+ path = File.expand_path(File.join(Cert.config[:output_path], cert_name))
raw_data = certificate.download_raw
File.write(path, raw_data)
return path
end
end