Class: IpaReader::IpaFile
- Inherits:
-
Object
- Object
- IpaReader::IpaFile
- Defined in:
- lib/ipa_reader/ipa_file.rb
Instance Attribute Summary collapse
-
#file_path ⇒ Object
Returns the value of attribute file_path.
-
#plist ⇒ Object
Returns the value of attribute plist.
Instance Method Summary collapse
- #bundle_identifier ⇒ Object
- #icon_file ⇒ Object
- #icon_prerendered ⇒ Object
-
#initialize(file_path) ⇒ IpaFile
constructor
A new instance of IpaFile.
- #minimum_os_version ⇒ Object
- #mobile_provision_file ⇒ Object
- #name ⇒ Object
- #read_file(regex) ⇒ Object
- #target_os_version ⇒ Object
- #url_schemes ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize(file_path) ⇒ IpaFile
Returns a new instance of IpaFile.
10 11 12 13 14 15 |
# File 'lib/ipa_reader/ipa_file.rb', line 10 def initialize(file_path) self.file_path = file_path info_plist_file = nil Zip::ZipFile.foreach(file_path) { |f| info_plist_file = f if f.name.match(/\/Info.plist/) } self.plist = Plist::Binary.decode_binary_plist(self.read_file(/\/Info.plist/)) end |
Instance Attribute Details
#file_path ⇒ Object
Returns the value of attribute file_path.
9 10 11 |
# File 'lib/ipa_reader/ipa_file.rb', line 9 def file_path @file_path end |
#plist ⇒ Object
Returns the value of attribute plist.
9 10 11 |
# File 'lib/ipa_reader/ipa_file.rb', line 9 def plist @plist end |
Instance Method Details
#bundle_identifier ⇒ Object
58 59 60 |
# File 'lib/ipa_reader/ipa_file.rb', line 58 def bundle_identifier plist["CFBundleIdentifier"] end |
#icon_file ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/ipa_reader/ipa_file.rb', line 41 def icon_file if plist["CFBundleIconFiles"] data = read_file(Regexp.new("#{plist["CFBundleIconFiles"][0]}$")) elsif plist["CFBundleIconFile"] data = read_file(Regexp.new("#{plist["CFBundleIconFile"]}$")) end if data IpaReader::PngFile.normalize_png(data) else nil end end |
#icon_prerendered ⇒ Object
62 63 64 |
# File 'lib/ipa_reader/ipa_file.rb', line 62 def icon_prerendered plist["UIPrerenderedIcon"] == true end |
#minimum_os_version ⇒ Object
29 30 31 |
# File 'lib/ipa_reader/ipa_file.rb', line 29 def minimum_os_version plist["MinimumOSVersion"].match(/[\d\.]*/)[0] end |
#mobile_provision_file ⇒ Object
54 55 56 |
# File 'lib/ipa_reader/ipa_file.rb', line 54 def mobile_provision_file read_file(/embedded\.mobileprovision$/) end |
#name ⇒ Object
21 22 23 |
# File 'lib/ipa_reader/ipa_file.rb', line 21 def name plist["CFBundleDisplayName"] end |
#read_file(regex) ⇒ Object
66 67 68 69 70 |
# File 'lib/ipa_reader/ipa_file.rb', line 66 def read_file(regex) file = nil Zip::ZipFile.foreach(self.file_path) { |f| file = f if f.name.match(regex) } file.get_input_stream.read end |
#target_os_version ⇒ Object
25 26 27 |
# File 'lib/ipa_reader/ipa_file.rb', line 25 def target_os_version plist["DTPlatformVersion"].match(/[\d\.]*/)[0] end |
#url_schemes ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/ipa_reader/ipa_file.rb', line 33 def url_schemes if plist["CFBundleURLTypes"] && plist["CFBundleURLTypes"][0] && plist["CFBundleURLTypes"][0]["CFBundleURLSchemes"] plist["CFBundleURLTypes"][0]["CFBundleURLSchemes"] else [] end end |
#version ⇒ Object
17 18 19 |
# File 'lib/ipa_reader/ipa_file.rb', line 17 def version plist["CFBundleVersion"] end |