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
- #cleanup! ⇒ Object
- #distribution_name ⇒ 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)
- #release_type ⇒ Object
- #size(humanable = false) ⇒ Object
- #stored? ⇒ Boolean
Constructor Details
#initialize(file) ⇒ IPA
Returns a new instance of IPA.
26 27 28 |
# File 'lib/app_info/ipa.rb', line 26 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
136 137 138 |
# File 'lib/app_info/ipa.rb', line 136 def app_path @app_path ||= Dir.glob(File.join(contents, 'Payload', '*.app')).first end |
#archs ⇒ Object Also known as: architectures
70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/app_info/ipa.rb', line 70 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
58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/app_info/ipa.rb', line 58 def build_type if mobileprovision? if devices ExportType::ADHOC else ExportType::INHOUSE end else ExportType::DEBUG end end |
#bundle_path ⇒ Object
128 129 130 |
# File 'lib/app_info/ipa.rb', line 128 def bundle_path @bundle_path ||= File.join(app_path, info.bundle_name) end |
#cleanup! ⇒ Object
140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/app_info/ipa.rb', line 140 def cleanup! return unless @contents FileUtils.rm_rf(@contents) @contents = nil @icons = nil @app_path = nil @metadata = nil @metadata_path = nil @info = nil end |
#distribution_name ⇒ Object
46 47 48 |
# File 'lib/app_info/ipa.rb', line 46 def distribution_name "#{profile_name} - #{team_name}" if profile_name && team_name end |
#hide_developer_certificates ⇒ Object
89 90 91 |
# File 'lib/app_info/ipa.rb', line 89 def hide_developer_certificates mobileprovision.delete('DeveloperCertificates') if mobileprovision? end |
#info ⇒ Object
132 133 134 |
# File 'lib/app_info/ipa.rb', line 132 def info @info ||= InfoPlist.new(app_path) end |
#metadata ⇒ Object
114 115 116 117 118 |
# File 'lib/app_info/ipa.rb', line 114 def return unless @metadata ||= CFPropertyList.native_types(CFPropertyList::List.new(file: ).value) end |
#metadata? ⇒ Boolean
120 121 122 |
# File 'lib/app_info/ipa.rb', line 120 def File.exist?() end |
#metadata_path ⇒ Object
124 125 126 |
# File 'lib/app_info/ipa.rb', line 124 def @metadata_path ||= File.join(contents, 'iTunesMetadata.plist') end |
#mobileprovision ⇒ Object
93 94 95 96 97 98 |
# File 'lib/app_info/ipa.rb', line 93 def mobileprovision return unless mobileprovision? return @mobileprovision if @mobileprovision @mobileprovision = MobileProvision.new(mobileprovision_path) end |
#mobileprovision? ⇒ Boolean
100 101 102 |
# File 'lib/app_info/ipa.rb', line 100 def mobileprovision? File.exist?mobileprovision_path end |
#mobileprovision_path ⇒ Object
104 105 106 107 108 109 110 111 112 |
# File 'lib/app_info/ipa.rb', line 104 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
34 35 36 |
# File 'lib/app_info/ipa.rb', line 34 def os AppInfo::Platform::IOS end |
#release_type ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/app_info/ipa.rb', line 50 def release_type if stored? ExportType::RELEASE else build_type end end |
#size(humanable = false) ⇒ Object
30 31 32 |
# File 'lib/app_info/ipa.rb', line 30 def size(humanable = false) AppInfo::Util.file_size(@file, humanable) end |
#stored? ⇒ Boolean
85 86 87 |
# File 'lib/app_info/ipa.rb', line 85 def stored? ? true : false end |