class AppInfo::IPA
IPA
parser
Constants
- IPAD_KEY
- IPHONE_KEY
Attributes
file[R]
Public Class Methods
new(file)
click to toggle source
# File lib/app_info/ipa.rb, line 26 def initialize(file) @file = file end
Public Instance Methods
app_path()
click to toggle source
# File lib/app_info/ipa.rb, line 154 def app_path @app_path ||= Dir.glob(File.join(contents, 'Payload', '*.app')).first end
archs()
click to toggle source
# File lib/app_info/ipa.rb, line 70 def archs return unless File.exist?(bundle_path) file = MachO.open(bundle_path) case file when MachO::MachOFile [file.cpusubtype] else file.machos.each_with_object([]) do |arch, obj| obj << arch.cpusubtype end end end
Also aliased as: architectures
build_type()
click to toggle source
# File lib/app_info/ipa.rb, line 58 def build_type if mobileprovision? if devices ExportType::ADHOC else ExportType::ENTERPRISE end else ExportType::DEBUG end end
bundle_path()
click to toggle source
# File lib/app_info/ipa.rb, line 142 def bundle_path @bundle_path ||= File.join(app_path, info.bundle_name) end
clear!()
click to toggle source
# File lib/app_info/ipa.rb, line 182 def clear! return unless @contents FileUtils.rm_rf(@contents) @contents = nil @app_path = nil @info_path = nil @info = nil @metadata_path = nil @metadata = nil @icons_path = nil @icons = nil end
contents()
click to toggle source
# File lib/app_info/ipa.rb, line 197 def contents @contents ||= Util.unarchive(@file, path: 'ios') end
distribution_name()
click to toggle source
# File lib/app_info/ipa.rb, line 46 def distribution_name "#{profile_name} - #{team_name}" if profile_name && team_name end
frameworks()
click to toggle source
# File lib/app_info/ipa.rb, line 99 def frameworks @frameworks ||= Framework.parse(app_path) end
hide_developer_certificates()
click to toggle source
# File lib/app_info/ipa.rb, line 103 def hide_developer_certificates mobileprovision.delete('DeveloperCertificates') if mobileprovision? end
icons(uncrush: true)
click to toggle source
# File lib/app_info/ipa.rb, line 85 def icons(uncrush: true) @icons ||= icons_path.each_with_object([]) do |file, obj| obj << build_icon_metadata(file, uncrush: uncrush) end end
icons_path()
click to toggle source
# File lib/app_info/ipa.rb, line 161 def icons_path return @icons_path if @icons_path @icons_path = [] icon_keys.each do |name| filenames = info.try(:[], name) .try(:[], 'CFBundlePrimaryIcon') .try(:[], 'CFBundleIconFiles') next if filenames.nil? || filenames.empty? filenames.each do |filename| Dir.glob(File.join(app_path, "#{filename}*")).find_all.each do |file| @icons_path << file end end end @icons_path end
info()
click to toggle source
# File lib/app_info/ipa.rb, line 146 def info @info ||= InfoPlist.new(info_path) end
info_path()
click to toggle source
# File lib/app_info/ipa.rb, line 150 def info_path @info_path ||= File.join(app_path, 'Info.plist') end
metadata()
click to toggle source
# File lib/app_info/ipa.rb, line 128 def metadata return unless metadata? @metadata ||= CFPropertyList.native_types(CFPropertyList::List.new(file: metadata_path).value) end
metadata?()
click to toggle source
# File lib/app_info/ipa.rb, line 134 def metadata? File.exist?(metadata_path) end
metadata_path()
click to toggle source
# File lib/app_info/ipa.rb, line 138 def metadata_path @metadata_path ||= File.join(contents, 'iTunesMetadata.plist') end
mobileprovision()
click to toggle source
# File lib/app_info/ipa.rb, line 107 def mobileprovision return unless mobileprovision? return @mobileprovision if @mobileprovision @mobileprovision = MobileProvision.new(mobileprovision_path) end
mobileprovision?()
click to toggle source
# File lib/app_info/ipa.rb, line 114 def mobileprovision? File.exist?(mobileprovision_path) end
mobileprovision_path()
click to toggle source
# File lib/app_info/ipa.rb, line 118 def mobileprovision_path filename = 'embedded.mobileprovision' @mobileprovision_path ||= File.join(@file, filename) unless File.exist?(@mobileprovision_path) @mobileprovision_path = File.join(app_path, filename) end @mobileprovision_path end
os()
click to toggle source
# File lib/app_info/ipa.rb, line 34 def os AppInfo::Platform::IOS end
Also aliased as: file_type
plugins()
click to toggle source
# File lib/app_info/ipa.rb, line 95 def plugins @plugins ||= Plugin.parse(app_path) end
release_type()
click to toggle source
# File lib/app_info/ipa.rb, line 50 def release_type if stored? ExportType::RELEASE else build_type end end
size(human_size: false)
click to toggle source
# File lib/app_info/ipa.rb, line 30 def size(human_size: false) AppInfo::Util.file_size(@file, human_size) end
stored?()
click to toggle source
# File lib/app_info/ipa.rb, line 91 def stored? !!metadata? end
Private Instance Methods
build_icon_metadata(file, uncrush: true)
click to toggle source
# File lib/app_info/ipa.rb, line 203 def build_icon_metadata(file, uncrush: true) uncrushed_file = uncrush ? uncrush_png(file) : nil { name: File.basename(file), file: file, uncrushed_file: uncrushed_file, dimensions: PngUncrush.dimensions(file) } end
icon_keys()
click to toggle source
# File lib/app_info/ipa.rb, line 221 def icon_keys @icon_keys ||= case device_type when 'iPhone' [IPHONE_KEY] when 'iPad' [IPAD_KEY] when 'Universal' [IPHONE_KEY, IPAD_KEY] end end
uncrush_png(src_file)
click to toggle source
Uncrush png to normal png file (iOS)
# File lib/app_info/ipa.rb, line 215 def uncrush_png(src_file) dest_file = Util.tempdir(src_file, prefix: 'uncrushed') PngUncrush.decompress(src_file, dest_file) File.exist?(dest_file) ? dest_file : nil end