Module: AppInfo

Defined in:
lib/app_info.rb,
lib/app_info/apk.rb,
lib/app_info/ipa.rb,
lib/app_info/dsym.rb,
lib/app_info/util.rb,
lib/app_info/macos.rb,
lib/app_info/shell.rb,
lib/app_info/version.rb,
lib/app_info/proguard.rb,
lib/app_info/info_plist.rb,
lib/app_info/ipa/plugin.rb,
lib/app_info/png_uncrush.rb,
lib/app_info/ipa/framework.rb,
lib/app_info/mobile_provision.rb,
lib/app_info/core_ext/object/try.rb

Overview

Defined Under Namespace

Modules: Device, Platform, Tryable, Util Classes: APK, DSYM, Error, Framework, IPA, InfoPlist, Macos, MobileProvision, NotFoundError, Plugin, PngUncrush, Proguard, Shell, UnkownFileTypeError

Constant Summary collapse

PLIST_REGEX =
/\x3C\x3F\x78\x6D\x6C/.freeze
BPLIST_REGEX =
/^\x62\x70\x6C\x69\x73\x74/.freeze
ICON_KEYS =

Icon Key

{
  AppInfo::Device::IPHONE => ['CFBundleIcons'],
  AppInfo::Device::IPAD => ['CFBundleIcons~ipad'],
  AppInfo::Device::UNIVERSAL => ['CFBundleIcons', 'CFBundleIcons~ipad'],
  AppInfo::Device::MACOS => %w[CFBundleIconFile CFBundleIconName]
}.freeze
FILE_SIZE_UNITS =
%w[B KB MB GB TB].freeze
VERSION =
'2.6.3'

Class Method Summary collapse

Class Method Details

.file_type(file) ⇒ Object

Detect file type by read file header

TODO: This can be better way to solvt, if anyone knows, tell me please.



41
42
43
44
45
46
47
48
49
50
# File 'lib/app_info.rb', line 41

def self.file_type(file)
  header_hex = IO.read(file, 100)
  type = if header_hex =~ /^\x50\x4b\x03\x04/
           detect_zip_file(file)
         else
           detect_mobileprovision(header_hex)
         end

  type || :unkown
end

.parse(file) ⇒ Object

Get a new parser for automatic

Raises:



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/app_info.rb', line 22

def self.parse(file)
  raise NotFoundError, file unless File.exist?(file)

  case file_type(file)
  when :ipa then IPA.new(file)
  when :apk then APK.new(file)
  when :mobileprovision then MobileProvision.new(file)
  when :dsym then DSYM.new(file)
  when :proguard then Proguard.new(file)
  when :macos then Macos.new(file)
  else
    raise UnkownFileTypeError, "Sorry, AppInfo can not detect file type: #{file}"
  end
end