Class: Signer
- Inherits:
-
Object
- Object
- Signer
- Defined in:
- lib/signer.rb
Instance Method Summary collapse
-
#codeSignDylib(dylib) ⇒ Object
sign the dynamic library.
-
#initialize ⇒ Signer
constructor
A new instance of Signer.
- #parse_codesign_identity(exe_path) ⇒ Object
-
#pre_codesign(build_log_dir, is_real_device) ⇒ Object
pre codesign.
Constructor Details
#initialize ⇒ Signer
Returns a new instance of Signer.
5 6 7 |
# File 'lib/signer.rb', line 5 def initialize @codesign_identity = "-" end |
Instance Method Details
#codeSignDylib(dylib) ⇒ Object
sign the dynamic library
43 44 45 46 |
# 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) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# 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) ⇒ Object
pre codesign
10 11 12 13 14 15 16 17 18 19 |
# 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 |