Class: ReadIpa::InfoPlist
- Inherits:
-
Object
- Object
- ReadIpa::InfoPlist
- Defined in:
- lib/read_ipa/info_plist.rb
Instance Method Summary collapse
- #bundle_identifier ⇒ Object
- #executable_file_name ⇒ Object
- #for_ipad? ⇒ Boolean
- #for_iphone? ⇒ Boolean
- #icon_files ⇒ Object
- #icon_prerendered ⇒ Object
-
#initialize(plist_str) ⇒ InfoPlist
constructor
A new instance of InfoPlist.
- #minimum_os_version ⇒ Object
- #name ⇒ Object
- #short_version ⇒ Object
- #target_os_version ⇒ Object
- #url_schemes ⇒ Object
- #version ⇒ Object
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_identifier ⇒ Object
55 56 57 |
# File 'lib/read_ipa/info_plist.rb', line 55 def bundle_identifier @plist["CFBundleIdentifier"] end |
#executable_file_name ⇒ Object
51 52 53 |
# File 'lib/read_ipa/info_plist.rb', line 51 def executable_file_name @plist["CFBundleExecutable"] end |
#for_ipad? ⇒ 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
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_files ⇒ Object
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_prerendered ⇒ Object
59 60 61 |
# File 'lib/read_ipa/info_plist.rb', line 59 def icon_prerendered @plist["UIPrerenderedIcon"] == true end |
#minimum_os_version ⇒ Object
25 26 27 |
# File 'lib/read_ipa/info_plist.rb', line 25 def minimum_os_version @plist["MinimumOSVersion"].match(/[\d\.]*/)[0] end |
#name ⇒ Object
17 18 19 |
# File 'lib/read_ipa/info_plist.rb', line 17 def name @plist["CFBundleDisplayName"] end |
#short_version ⇒ Object
13 14 15 |
# File 'lib/read_ipa/info_plist.rb', line 13 def short_version @plist["CFBundleShortVersionString"] end |
#target_os_version ⇒ Object
21 22 23 |
# File 'lib/read_ipa/info_plist.rb', line 21 def target_os_version @plist["DTPlatformVersion"].match(/[\d\.]*/)[0] end |
#url_schemes ⇒ Object
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 |
#version ⇒ Object
9 10 11 |
# File 'lib/read_ipa/info_plist.rb', line 9 def version @plist["CFBundleVersion"] end |