Class: CodeSigner
- Inherits:
-
Object
- Object
- CodeSigner
- Defined in:
- lib/ipa_utilities/code_signer.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options) ⇒ CodeSigner
constructor
A new instance of CodeSigner.
- #resign ⇒ Object
- #update_bundle_id(info_plist) ⇒ Object
Constructor Details
#initialize(options) ⇒ CodeSigner
Returns a new instance of CodeSigner.
3 4 5 6 7 8 9 10 11 |
# File 'lib/ipa_utilities/code_signer.rb', line 3 def initialize() @ipa_path = check_file_exist([:ipa_path], "Cannot find file at '%s'",) @profile = check_file_exist([:profile], "Cannot find file at '%s'") if [:profile] @output_path = [:output_path] || "~/Desktop/resigned.ipa" @identity = check_non_nil([:identity], "Identity cannot be nil") @bundle_id = [:bundle_id] end |
Class Method Details
.signature_valid?(ipa) ⇒ Boolean
13 14 15 16 |
# File 'lib/ipa_utilities/code_signer.rb', line 13 def self.signature_valid?(ipa) system("codesign -v #{ipa.app_path} 2>&1") $?.exitstatus == 0 end |
Instance Method Details
#resign ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ipa_utilities/code_signer.rb', line 18 def resign ipa = IpaParser.new(@ipa_path) @app_path = ipa.app_path delete_old_signature update_bundle_id(ipa.info_plist) cmd = "codesign -s '#{@identity}' '#{ipa.app_path}' -f" puts cmd if $verbose system(cmd) ipa.zip(@output_path) ipa.cleanup end |
#update_bundle_id(info_plist) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/ipa_utilities/code_signer.rb', line 33 def update_bundle_id(info_plist) return unless @bundle_id puts "Applying new bundle id '#{@bundle_id.green}'" info_plist.bundle_id = @bundle_id info_plist.save end |