lib/motion/project/xcode_config.rb
def codesign_certificate(*platform_prefixes)
      @codesign_certificate ||= begin
        type = (distribution_mode ? 'Distribution' : 'Developer')
        regex = /(#{platform_prefixes.join('|')}) #{type}/
        certs = Util::CodeSign.identity_names(release?).grep(regex)
        if platform_prefixes.size > 1
          certs = certs.sort do |x, y|
            x_index = platform_prefixes.index(x.match(regex)[1])
            y_index = platform_prefixes.index(y.match(regex)[1])
            x_index <=> y_index
          end
        end
        if certs.size == 0
          App.fail "Cannot find any #{platform_prefixes.join('/')} #{type} " \
                   "certificate in the keychain."
        elsif certs.size > 1
          App.warn "Found #{certs.size} #{platform_prefixes.join('/')} " \
                   "#{type} certificates in the keychain. Set the " \
                   "`codesign_certificate' project setting to explicitly " \
                   "use one of (defaults to the first): #{certs.join(', ')}"
        end
        certs.first
      end
    end
# Unless a certificate has been assigned by the user, this method tries to
# find the certificate for the current configuration, based on the platform
# prefix used in the certificate name and whether or not the current mode is
# set to release.
#
# @param [Array<String>] platform_prefixes
#        The prefixes used in the certificate name, specified in the
#        preferred order.
#
# @return [String] The name of the certificate.
#
Unless a certificate has been assigned by the user, this method tries to
find the certificate for the current configuration, based on the platform
prefix used in the certificate name and whether or not the current mode is
set to release.
Unless a certificate has been assigned by the user this method tries to find the certificate for the current configuration based on the platform prefix used in the certificate name and whether or not the current mode is set to release .
def codesign_certificate(*platform_prefixes)
      @codesign_certificate ||= begin
        type = (distribution_mode ? 'Distribution' : 'Developer')
        regex = /(#{platform_prefixes.join('|')}) #{type}/
        certs = Util::CodeSign.identity_names(release?).grep(regex)
        if platform_prefixes.size > 1
          certs = certs.sort do |x, y|
            x_index = platform_prefixes.index(x.match(regex)[1])
            y_index = platform_prefixes.index(y.match(regex)[1])
            x_index <=> y_index
          end
        end
        if certs.size == 0
          App.fail "Cannot find any #{platform_prefixes.join('/')} #{type} " \
                   "certificate in the keychain."
        elsif certs.size > 1
          App.warn "Found #{certs.size} #{platform_prefixes.join('/')} " \
                   "#{type} certificates in the keychain. Set the " \
                   "`codesign_certificate' project setting to explicitly " \
                   "use one of (defaults to the first): #{certs.join(', ')}"
        end
        certs.first
      end
    end
def codesign_certificate ( * platform_prefixes ) @codesign_certificate ||= begin type = ( distribution_mode ? 'Distribution' : 'Developer' ) regex = / ( #{ platform_prefixes . join ( '|' ) } )  #{ type } / certs = Util :: CodeSign . identity_names ( release? ) . grep ( regex ) if platform_prefixes . size > 1 certs = certs . sort do | x , y | x_index = platform_prefixes . index ( x . match ( regex ) [ 1 ] ) y_index = platform_prefixes . index ( y . match ( regex ) [ 1 ] ) x_index <=> y_index end end if certs . size == 0 App . fail "Cannot find any #{platform_prefixes.join('/')} #{type} " "certificate in the keychain." elsif certs . size > 1 App . warn "Found #{certs.size} #{platform_prefixes.join('/')} " "#{type} certificates in the keychain. Set the " "`codesign_certificate' project setting to explicitly " "use one of (defaults to the first): #{certs.join(', ')}" end certs . first end end
Unless a certificate has been assigned by the user, this method tries to
find the certificate for the current configuration, based on the platform
prefix used in the certificate name and whether or not the current mode is
set to release.
Unless a certificate has been assigned by the user this method tries to find the certificate for the current configuration based on the platform prefix used in the certificate name and whether or not the current mode is set to release .
The name of the certificate.
The name of the certificate .
String
platform_prefixes
platform_prefixes The prefixes used in the certificate name, specified in the preferred order.
platform_prefixes The prefixes used in the certificate name specified in the preferred order .