[CodeSign] Cleanup.

This commit is contained in:
Eloy Durán
2014-02-27 16:11:47 +01:00
committed by Watson
parent e0477f8795
commit 851687cc92
2 changed files with 12 additions and 6 deletions

View File

@@ -333,13 +333,17 @@ EOS
def codesign_certificate(platform)
@codesign_certificate ||= begin
cert_type = (distribution_mode ? 'Distribution' : 'Developer')
certs = Util::CodeSign.identity_names(release?).grep(/#{platform} #{cert_type}/)
type = (distribution_mode ? 'Distribution' : 'Developer')
certs = Util::CodeSign.identity_names(release?)
certs = certs.grep(/#{platform} #{type}/)
if certs.size == 0
App.fail "Cannot find any #{platform} #{cert_type} certificate in the keychain"
App.fail "Cannot find any #{platform} #{type} certificate in the" \
"keychain"
elsif certs.size > 1
# TODO list all the values for the user's convenience.
App.warn "Found #{certs.size} #{platform} #{cert_type} certificates in the keychain. Set the `codesign_certificate' project setting to explicitely use one of (defaults to the first): #{certs.join(', ')}"
App.warn "Found #{certs.size} #{platform} #{type} certificates in " \
"the keychain. Set the `codesign_certificate' project " \
"setting to explicitely use one of (defaults to the " \
"first): #{certs.join(', ')}"
end
certs.first
end

View File

@@ -7,7 +7,9 @@ module Motion; module Util
# @returns String The raw output from querying the `security` DB.
#
def query_security_db_for_identities(valid_only)
`/usr/bin/security -q find-identity -p codesigning#{' -v' if valid_only}`.strip
command = '/usr/bin/security -q find-identity -p codesigning'
command << ' -v' if valid_only
`#{command}`.strip
end
# @param Boolean valid_only Whether or not to include only valid code