Class: AppInfo::IPA
- Extended by:
- Forwardable
- Defined in:
- lib/app_info/ipa.rb
Overview
IPA parser
Defined Under Namespace
Modules: ExportType
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
Instance Method Summary collapse
- #app_path ⇒ Object
- #archs ⇒ Object (also: #architectures)
- #build_type ⇒ Object
- #bundle_path ⇒ Object
- #clear! ⇒ Object
- #contents ⇒ Object
- #distribution_name ⇒ Object
- #frameworks ⇒ Object
- #hide_developer_certificates ⇒ Object
- #info ⇒ Object
-
#initialize(file) ⇒ IPA
constructor
A new instance of IPA.
- #metadata ⇒ Object
- #metadata? ⇒ Boolean
- #metadata_path ⇒ Object
- #mobileprovision ⇒ Object
- #mobileprovision? ⇒ Boolean
- #mobileprovision_path ⇒ Object
- #os ⇒ Object (also: #file_type)
- #plugins ⇒ Object
- #release_type ⇒ Object
- #size(humanable = false) ⇒ Object
- #stored? ⇒ Boolean
Constructor Details
#initialize(file) ⇒ IPA
Returns a new instance of IPA.
28 29 30 |
# File 'lib/app_info/ipa.rb', line 28 def initialize(file) @file = file end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
15 16 17 |
# File 'lib/app_info/ipa.rb', line 15 def file @file end |
Instance Method Details
#app_path ⇒ Object
146 147 148 |
# File 'lib/app_info/ipa.rb', line 146 def app_path @app_path ||= Dir.glob(File.join(contents, 'Payload', '*.app')).first end |
#archs ⇒ Object Also known as: architectures
72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/app_info/ipa.rb', line 72 def archs return unless File.exist?(bundle_path) file = MachO.open(bundle_path) case file when MachO::MachOFile [file.cpusubtype] else file.machos.each_with_object([]) do |arch, obj| obj << arch.cpusubtype end end end |
#build_type ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/app_info/ipa.rb', line 60 def build_type if mobileprovision? if devices ExportType::ADHOC else ExportType::ENTERPRISE end else ExportType::DEBUG end end |
#bundle_path ⇒ Object
138 139 140 |
# File 'lib/app_info/ipa.rb', line 138 def bundle_path @bundle_path ||= File.join(app_path, info.bundle_name) end |
#clear! ⇒ Object
150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/app_info/ipa.rb', line 150 def clear! return unless @contents FileUtils.rm_rf(@contents) @contents = nil @icons = nil @app_path = nil @metadata = nil @metadata_path = nil @info = nil end |
#contents ⇒ Object
163 164 165 |
# File 'lib/app_info/ipa.rb', line 163 def contents @contents ||= Util.unarchive(@file, path: 'ios') end |
#distribution_name ⇒ Object
48 49 50 |
# File 'lib/app_info/ipa.rb', line 48 def distribution_name "#{profile_name} - #{team_name}" if profile_name && team_name end |
#frameworks ⇒ Object
95 96 97 |
# File 'lib/app_info/ipa.rb', line 95 def frameworks @frameworks ||= Framework.parse(app_path) end |
#hide_developer_certificates ⇒ Object
99 100 101 |
# File 'lib/app_info/ipa.rb', line 99 def hide_developer_certificates mobileprovision.delete('DeveloperCertificates') if mobileprovision? end |
#info ⇒ Object
142 143 144 |
# File 'lib/app_info/ipa.rb', line 142 def info @info ||= InfoPlist.new(app_path) end |
#metadata ⇒ Object
124 125 126 127 128 |
# File 'lib/app_info/ipa.rb', line 124 def return unless @metadata ||= CFPropertyList.native_types(CFPropertyList::List.new(file: ).value) end |
#metadata? ⇒ Boolean
130 131 132 |
# File 'lib/app_info/ipa.rb', line 130 def File.exist?() end |
#metadata_path ⇒ Object
134 135 136 |
# File 'lib/app_info/ipa.rb', line 134 def @metadata_path ||= File.join(contents, 'iTunesMetadata.plist') end |
#mobileprovision ⇒ Object
103 104 105 106 107 108 |
# File 'lib/app_info/ipa.rb', line 103 def mobileprovision return unless mobileprovision? return @mobileprovision if @mobileprovision @mobileprovision = MobileProvision.new(mobileprovision_path) end |
#mobileprovision? ⇒ Boolean
110 111 112 |
# File 'lib/app_info/ipa.rb', line 110 def mobileprovision? File.exist?mobileprovision_path end |
#mobileprovision_path ⇒ Object
114 115 116 117 118 119 120 121 122 |
# File 'lib/app_info/ipa.rb', line 114 def mobileprovision_path filename = 'embedded.mobileprovision' @mobileprovision_path ||= File.join(@file, filename) unless File.exist?(@mobileprovision_path) @mobileprovision_path = File.join(app_path, filename) end @mobileprovision_path end |
#os ⇒ Object Also known as: file_type
36 37 38 |
# File 'lib/app_info/ipa.rb', line 36 def os AppInfo::Platform::IOS end |
#plugins ⇒ Object
91 92 93 |
# File 'lib/app_info/ipa.rb', line 91 def plugins @plugins ||= Plugin.parse(app_path) end |
#release_type ⇒ Object
52 53 54 55 56 57 58 |
# File 'lib/app_info/ipa.rb', line 52 def release_type if stored? ExportType::RELEASE else build_type end end |
#size(humanable = false) ⇒ Object
32 33 34 |
# File 'lib/app_info/ipa.rb', line 32 def size(humanable = false) AppInfo::Util.file_size(@file, humanable) end |
#stored? ⇒ Boolean
87 88 89 |
# File 'lib/app_info/ipa.rb', line 87 def stored? ? true : false end |