Class: ReadIpa::InfoPlist

Inherits:
Object
  • Object
show all
Defined in:
lib/read_ipa/info_plist.rb

Instance Method Summary collapse

Constructor Details

#initialize(plist_str) ⇒ InfoPlist

Returns a new instance of InfoPlist.



5
6
7
# File 'lib/read_ipa/info_plist.rb', line 5

def initialize(plist_str)
  @plist = CFPropertyList::List.new(data: plist_str, format: CFPropertyList::List::FORMAT_AUTO).value.to_rb
end

Instance Method Details

#bundle_identifierObject



55
56
57
# File 'lib/read_ipa/info_plist.rb', line 55

def bundle_identifier
  @plist["CFBundleIdentifier"]
end

#executable_file_nameObject



51
52
53
# File 'lib/read_ipa/info_plist.rb', line 51

def executable_file_name
  @plist["CFBundleExecutable"]
end

#for_ipad?Boolean

Returns:

  • (Boolean)


63
64
65
66
67
# File 'lib/read_ipa/info_plist.rb', line 63

def for_ipad?
  return true if @plist["UIDeviceFamily"] && (@plist["UIDeviceFamily"] == 2 || @plist["UIDeviceFamily"].include?(2))
  return true if @plist["UIDeviceFamily"] && (@plist["UIDeviceFamily"] == "2" || @plist["UIDeviceFamily"].include?("2"))
  return false
end

#for_iphone?Boolean

Returns:

  • (Boolean)


69
70
71
72
73
74
# File 'lib/read_ipa/info_plist.rb', line 69

def for_iphone?
  return true if @plist["UIDeviceFamily"]
  return true if @plist["UIDeviceFamily"] == 1 || @plist["UIDeviceFamily"].include?(1)
  return true if @plist["UIDeviceFamily"] == "1" || @plist["UIDeviceFamily"].include?("1")
  return false
end

#icon_filesObject



37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/read_ipa/info_plist.rb', line 37

def icon_files
  icon_files = [@plist["CFBundleIconFile"]].compact
  icon_files += @plist["CFBundleIconFiles"] || []
  if @plist["CFBundleIcons"]
    dict = @plist["CFBundleIcons"]
    primary_icons = dict["CFBundlePrimaryIcon"]
    return nil unless primary_icons
    icons = primary_icons.to_rb["CFBundleIconFiles"]
    return nil unless icons
    icon_files += icons
  end
  icon_files
end

#icon_prerenderedObject



59
60
61
# File 'lib/read_ipa/info_plist.rb', line 59

def icon_prerendered
  @plist["UIPrerenderedIcon"] == true
end

#minimum_os_versionObject



25
26
27
# File 'lib/read_ipa/info_plist.rb', line 25

def minimum_os_version
  @plist["MinimumOSVersion"].match(/[\d\.]*/)[0]
end

#nameObject



17
18
19
# File 'lib/read_ipa/info_plist.rb', line 17

def name
  @plist["CFBundleDisplayName"]
end

#short_versionObject



13
14
15
# File 'lib/read_ipa/info_plist.rb', line 13

def short_version
  @plist["CFBundleShortVersionString"]
end

#target_os_versionObject



21
22
23
# File 'lib/read_ipa/info_plist.rb', line 21

def target_os_version
  @plist["DTPlatformVersion"].match(/[\d\.]*/)[0]
end

#url_schemesObject



29
30
31
32
33
34
35
# File 'lib/read_ipa/info_plist.rb', line 29

def url_schemes
  if @plist["CFBundleURLTypes"] && @plist["CFBundleURLTypes"][0] && @plist["CFBundleURLTypes"][0]["CFBundleURLSchemes"]
    @plist["CFBundleURLTypes"][0]["CFBundleURLSchemes"]
  else
    []
  end
end

#versionObject



9
10
11
# File 'lib/read_ipa/info_plist.rb', line 9

def version
  @plist["CFBundleVersion"]
end