Sha256: 9c88b650199cf3208122b1b58cb28e02c86950ddf3fd8c2c1995ad9a8885f9f9
Contents?: true
Size: 1.43 KB
Versions: 42
Compression:
Stored size: 1.43 KB
Contents
module Deliver class IpaFileAnalyser # Fetches the app identifier (e.g. com.facebook.Facebook) from the given ipa file. def self.fetch_app_identifier(path) plist = IpaFileAnalyser.fetch_info_plist_file(path) return plist['CFBundleIdentifier'] if plist return nil end # Fetches the app version from the given ipa file. def self.fetch_app_version(path) plist = IpaFileAnalyser.fetch_info_plist_file(path) return plist['CFBundleShortVersionString'] if plist return nil end def self.fetch_info_plist_file(path) Zip::File.open(path) do |zipfile| zipfile.each do |file| if file.name.include?'.plist' and not ['.bundle', '.framework'].any? { |a| file.name.include?a } # We can not be completely sure, that's the correct plist file, so we have to try begin # The XML file has to be properly unpacked first tmp_path = "/tmp/deploytmp.plist" File.write(tmp_path, zipfile.read(file)) system("plutil -convert xml1 #{tmp_path}") result = Plist::parse_xml(tmp_path) File.delete(tmp_path) if result['CFBundleIdentifier'] or result['CFBundleVersion'] return result end rescue # We don't really care, look for another XML file end end end end nil end end end
Version data entries
42 entries across 42 versions & 1 rubygems