Skip to content

Instantly share code, notes, and snippets.

@zhzhxtrrk
Created May 17, 2013 09:13
Show Gist options
  • Save zhzhxtrrk/5597956 to your computer and use it in GitHub Desktop.
Save zhzhxtrrk/5597956 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
@BenjaminX
Copy link

great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment