class Signer
Public Class Methods
new()
click to toggle source
# File lib/signer.rb, line 5 def initialize @codesign_identity = "-" end
Public Instance Methods
codeSignDylib(dylib)
click to toggle source
sign the dynamic library
@param dylib the dylib's path
@return true or false
# File lib/signer.rb, line 43 def codeSignDylib(dylib) command = "export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate; /usr/bin/codesign --force -s '#{@codesign_identity}' '#{dylib}'" system(command) end
parse_codesign_identity(exe_path)
click to toggle source
# File lib/signer.rb, line 21 def parse_codesign_identity(exe_path) codesign_identity = "-" stdout, stdeerr, status = Open3.capture3("codesign -vv -d #{exe_path}") array = stdeerr.split("\n") array.each do |item| if item.include?("Authority=") start = "Authority=" codesign_identity = item[start.length, item.length] break end end @codesign_identity = codesign_identity end
pre_codesign(build_log_dir, is_real_device)
click to toggle source
pre codesign
# File lib/signer.rb, line 10 def pre_codesign(build_log_dir, is_real_device) build_folder = is_real_device ? "Debug-iphoneos" : "Debug-iphonesimulator" exe_path = build_log_dir.split("/")[0..-3].join("/") + "/Build/Products/#{build_folder}" exe_path = "#{exe_path}/*.app" exe_path = Dir[exe_path].sort!{ |x,y| File.mtime(y) <=> File.mtime(x) }[0] if File.exist?(exe_path) parse_codesign_identity(exe_path) end true end