module AppInfo

AppInfo Module

Copyrights rails Copy from github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/object/try.rb

Constants

FILE_SIZE_UNITS
ICON_KEYS

Icon Key

VERSION

Public Class Methods

file_type(file) click to toggle source

Detect file type by read file header

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

# 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) click to toggle source

Get a new parser for automatic

# 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