Skip to content

Instantly share code, notes, and snippets.

@BenjaminX
Forked from zhzhxtrrk/sign.rb
Created May 20, 2013 05:41
Show Gist options
  • Save BenjaminX/5610583 to your computer and use it in GitHub Desktop.
Save BenjaminX/5610583 to your computer and use it in GitHub Desktop.
require 'pathname'
require 'fileutils'
if ARGV.size < 3
puts "Usage: ruby sign.rb App DeveloperId Provision"
exit
end
puts "Working"
name = ARGV[0]
ipa = "#{name}.ipa"
app = "#{name}.app"
developer_id = ARGV[1]
provision = ARGV[2]
target_ipa = Pathname.new(File.dirname(__FILE__)).realpath + "#{name}_resigned.ipa"
if not File.exists? ipa
puts "#{ipa} not found"
end
begin
FileUtils.rmtree 'Payload'
FileUtils.rmtree app
puts `unzip #{ipa}`
FileUtils.mv "Payload/#{app}", '.'
puts `xcrun --sdk iphoneos PackageApplication -s "#{developer_id}" --embed "#{provision}" "#{app}" -o "#{target_ipa}"`
FileUtils.rmtree 'Payload'
FileUtils.rmtree app
rescue
puts "Error, #{$!}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment