class IpaReader

Public Class Methods

new(ipa_path) click to toggle source
# File lib/profiles/ipa_reader.rb, line 8
def initialize(ipa_path)
  pn = Pathname.new(ipa_path)
  @ipa_path = pn.dirname
  @ipa_name = pn.basename
  @full_path = ipa_path
  
  at_exit { clean_up }
end

Public Instance Methods

on_unzip(&block) click to toggle source
# File lib/profiles/ipa_reader.rb, line 24
def on_unzip(&block)
  @on_unzip = block
end
provision_parser() click to toggle source
# File lib/profiles/ipa_reader.rb, line 17
def provision_parser
  return @provision_parser if @provision_parser
  
  unzip_and_parse
  @provision_parser
end

Private Instance Methods

bundle_name() click to toggle source
# File lib/profiles/ipa_reader.rb, line 45
def bundle_name
  Dir.entries("#{UNZIP_DIR}/Payload").last
end
clean_up() click to toggle source
# File lib/profiles/ipa_reader.rb, line 49
def clean_up
  system "rm -rf #{UNZIP_DIR}"
end
parse() click to toggle source
# File lib/profiles/ipa_reader.rb, line 40
def parse
  provision_path = "#{UNZIP_DIR}/Payload/#{bundle_name}/embedded.mobileprovision"
  @provision_parser = ProvisionProfileParser.new provision_path
end
unzip() click to toggle source
# File lib/profiles/ipa_reader.rb, line 35
def unzip
  @on_unzip.call if @on_unzip
  system "unzip #{@full_path} -d #{UNZIP_DIR} > /tmp/log.txt"
end
unzip_and_parse() click to toggle source
# File lib/profiles/ipa_reader.rb, line 30
def unzip_and_parse
  unzip
  parse
end