Class: AppInfo::IPA
Overview
Defined Under Namespace
Modules: ExportType
Constant Summary
collapse
- IPHONE_KEY =
'CFBundleIcons'
- IPAD_KEY =
'CFBundleIcons~ipad'
Helper::HumanFileSize::FILE_SIZE_UNITS
Instance Attribute Summary collapse
Instance Method Summary
collapse
#tempdir, #unarchive
#file_to_human_size, #number_to_human_size
Constructor Details
#initialize(file) ⇒ IPA
28
29
30
|
# File 'lib/app_info/ipa.rb', line 28
def initialize(file)
@file = file
end
|
Instance Attribute Details
Returns the value of attribute file.
15
16
17
|
# File 'lib/app_info/ipa.rb', line 15
def file
@file
end
|
Instance Method Details
156
157
158
|
# File 'lib/app_info/ipa.rb', line 156
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
|
#bundle_path ⇒ Object
144
145
146
|
# File 'lib/app_info/ipa.rb', line 144
def bundle_path
@bundle_path ||= File.join(app_path, info.bundle_name)
end
|
184
185
186
187
188
189
190
191
192
193
194
195
196
197
|
# File 'lib/app_info/ipa.rb', line 184
def clear!
return unless @contents
FileUtils.rm_rf(@contents)
@contents = nil
@app_path = nil
@info_path = nil
@info = nil
@metadata_path = nil
@metadata = nil
@icons_path = nil
@icons = nil
end
|
199
200
201
|
# File 'lib/app_info/ipa.rb', line 199
def contents
@contents ||= 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
101
102
103
|
# File 'lib/app_info/ipa.rb', line 101
def frameworks
@frameworks ||= Framework.parse(app_path)
end
|
#hide_developer_certificates ⇒ Object
105
106
107
|
# File 'lib/app_info/ipa.rb', line 105
def hide_developer_certificates
mobileprovision.delete('DeveloperCertificates') if mobileprovision?
end
|
#icons(uncrush: true) ⇒ Object
87
88
89
90
91
|
# File 'lib/app_info/ipa.rb', line 87
def icons(uncrush: true)
@icons ||= icons_path.each_with_object([]) do |file, obj|
obj << build_icon_metadata(file, uncrush: uncrush)
end
end
|
#icons_path ⇒ Object
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
|
# File 'lib/app_info/ipa.rb', line 163
def icons_path
return @icons_path if @icons_path
@icons_path = []
icon_keys.each do |name|
filenames = info.try(:[], name)
.try(:[], 'CFBundlePrimaryIcon')
.try(:[], 'CFBundleIconFiles')
next if filenames.nil? || filenames.empty?
filenames.each do |filename|
Dir.glob(File.join(app_path, "#{filename}*")).find_all.each do |file|
@icons_path << file
end
end
end
@icons_path
end
|
148
149
150
|
# File 'lib/app_info/ipa.rb', line 148
def info
@info ||= InfoPlist.new(info_path)
end
|
#info_path ⇒ Object
152
153
154
|
# File 'lib/app_info/ipa.rb', line 152
def info_path
@info_path ||= File.join(app_path, 'Info.plist')
end
|
130
131
132
133
134
|
# File 'lib/app_info/ipa.rb', line 130
def metadata
return unless metadata?
@metadata ||= CFPropertyList.native_types(CFPropertyList::List.new(file: metadata_path).value)
end
|
136
137
138
|
# File 'lib/app_info/ipa.rb', line 136
def metadata?
File.exist?(metadata_path)
end
|
140
141
142
|
# File 'lib/app_info/ipa.rb', line 140
def metadata_path
@metadata_path ||= File.join(contents, 'iTunesMetadata.plist')
end
|
#mobileprovision ⇒ Object
109
110
111
112
113
114
|
# File 'lib/app_info/ipa.rb', line 109
def mobileprovision
return unless mobileprovision?
return @mobileprovision if @mobileprovision
@mobileprovision = MobileProvision.new(mobileprovision_path)
end
|
#mobileprovision? ⇒ Boolean
116
117
118
|
# File 'lib/app_info/ipa.rb', line 116
def mobileprovision?
File.exist?(mobileprovision_path)
end
|
#mobileprovision_path ⇒ Object
120
121
122
123
124
125
126
127
128
|
# File 'lib/app_info/ipa.rb', line 120
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
Platform::IOS
end
|
97
98
99
|
# File 'lib/app_info/ipa.rb', line 97
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(human_size: false) ⇒ Object
32
33
34
|
# File 'lib/app_info/ipa.rb', line 32
def size(human_size: false)
file_to_human_size(@file, human_size: human_size)
end
|
#stored? ⇒ Boolean
93
94
95
|
# File 'lib/app_info/ipa.rb', line 93
def stored?
!!metadata?
end
|