Created
          May 17, 2013 09:13 
        
      - 
      
- 
        Save zhzhxtrrk/5597956 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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
  
            
great