class RunLoop::Codesign

@!visibility private A wrapper around codesign command line tool

Constants

APP_STORE_REGEX

@!visibility private

DEV_REGEX

@!visibility private

DISTR_REGEX

@!visibility private

NOT_SIGNED_REGEX

@!visibility private

Public Class Methods

developer?(path) click to toggle source

@!visibility private

True if the asset is signed with a dev cert

# File lib/run_loop/codesign.rb, line 45
def self.developer?(path)
  info = self.info(path)
  info[DEV_REGEX, 0] != nil
end
distribution?(path) click to toggle source

@!visibility private

True if the asset is signed with anything other than a dev cert.

# File lib/run_loop/codesign.rb, line 35
def self.distribution?(path)
  info = self.info(path)

  info[NOT_SIGNED_REGEX, 0] == nil &&
    info[DEV_REGEX, 0] == nil
end
info(path) click to toggle source

@!visibility private

# File lib/run_loop/codesign.rb, line 19
def self.info(path)
  self.expect_path_exists(path)
  self.run_codesign_command(["--display", "--verbose=4", path])
end
signed?(path) click to toggle source

@!visibility private

True if the asset is signed.

# File lib/run_loop/codesign.rb, line 27
def self.signed?(path)
  info = self.info(path)
  info[NOT_SIGNED_REGEX, 0] == nil
end

Private Class Methods

expect_path_exists(path) click to toggle source
# File lib/run_loop/codesign.rb, line 52
    def self.expect_path_exists(path)
      if !File.exist?(path)
        raise ArgumentError,
%Q{There is no file or directory at path:

#{path}
}
      end
    end
run_codesign_command(args) click to toggle source
# File lib/run_loop/codesign.rb, line 62
def self.run_codesign_command(args)
  if !args.is_a?(Array)
    raise ArgumentError, "Expected args: '#{args}' to be an Array"
  end

  xcrun = RunLoop::Xcrun.new
  cmd = ["codesign"] + args
  options = {:log_cmd => true}
  hash = xcrun.run_command_in_context(cmd, options)

  hash[:out]
end