app-info 2.0.0.beta3 → 2.0.0.beta4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -7
- data/README.md +7 -7
- data/lib/app_info.rb +19 -9
- data/lib/app_info/apk.rb +184 -0
- data/lib/app_info/core_ext/object/try.rb +2 -0
- data/lib/app_info/dsym.rb +149 -0
- data/lib/app_info/ipa.rb +230 -0
- data/lib/app_info/ipa/info_plist.rb +133 -0
- data/lib/app_info/ipa/mobile_provision.rb +89 -0
- data/lib/app_info/util.rb +26 -0
- data/lib/app_info/version.rb +1 -1
- metadata +7 -7
- data/lib/app_info/parser.rb +0 -40
- data/lib/app_info/parser/apk.rb +0 -183
- data/lib/app_info/parser/dsym.rb +0 -126
- data/lib/app_info/parser/ipa.rb +0 -229
- data/lib/app_info/parser/ipa/info_plist.rb +0 -135
- data/lib/app_info/parser/ipa/mobile_provision.rb +0 -91
@@ -1,135 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'cfpropertylist'
|
4
|
-
|
5
|
-
module AppInfo
|
6
|
-
module Parser
|
7
|
-
# iOS Info.plist parser
|
8
|
-
class InfoPlist
|
9
|
-
def initialize(app_path)
|
10
|
-
@app_path = app_path
|
11
|
-
end
|
12
|
-
|
13
|
-
def build_version
|
14
|
-
info.try(:[], 'CFBundleVersion')
|
15
|
-
end
|
16
|
-
|
17
|
-
def release_version
|
18
|
-
info.try(:[], 'CFBundleShortVersionString')
|
19
|
-
end
|
20
|
-
|
21
|
-
def identifier
|
22
|
-
info.try(:[], 'CFBundleIdentifier')
|
23
|
-
end
|
24
|
-
alias bundle_id identifier
|
25
|
-
|
26
|
-
def name
|
27
|
-
display_name || bundle_name
|
28
|
-
end
|
29
|
-
|
30
|
-
def display_name
|
31
|
-
info.try(:[], 'CFBundleDisplayName')
|
32
|
-
end
|
33
|
-
|
34
|
-
def bundle_name
|
35
|
-
info.try(:[], 'CFBundleName')
|
36
|
-
end
|
37
|
-
|
38
|
-
#
|
39
|
-
# Extract the Minimum OS Version from the Info.plist
|
40
|
-
#
|
41
|
-
def min_sdk_version
|
42
|
-
info.try(:[], 'MinimumOSVersion')
|
43
|
-
end
|
44
|
-
|
45
|
-
def icons
|
46
|
-
return @icons if @icons
|
47
|
-
|
48
|
-
@icons = []
|
49
|
-
icons_root_path.each do |name|
|
50
|
-
icon_array = info.try(:[], name)
|
51
|
-
.try(:[], 'CFBundlePrimaryIcon')
|
52
|
-
.try(:[], 'CFBundleIconFiles')
|
53
|
-
|
54
|
-
next if icon_array.nil? || icon_array.zero?
|
55
|
-
|
56
|
-
icon_array.each do |items|
|
57
|
-
Dir.glob(File.join(@app_path, "#{items}*")).find_all.each do |file|
|
58
|
-
dict = {
|
59
|
-
name: File.basename(file),
|
60
|
-
file: file,
|
61
|
-
dimensions: Pngdefry.dimensions(file)
|
62
|
-
}
|
63
|
-
|
64
|
-
@icons.push(dict)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
@icons
|
70
|
-
end
|
71
|
-
|
72
|
-
def device_type
|
73
|
-
device_family = info.try(:[], 'UIDeviceFamily')
|
74
|
-
if device_family.length == 1
|
75
|
-
case device_family
|
76
|
-
when [1]
|
77
|
-
'iPhone'
|
78
|
-
when [2]
|
79
|
-
'iPad'
|
80
|
-
end
|
81
|
-
elsif device_family.length == 2 && device_family == [1, 2]
|
82
|
-
'Universal'
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
def iphone?
|
87
|
-
device_type == 'iPhone'
|
88
|
-
end
|
89
|
-
|
90
|
-
def ipad?
|
91
|
-
device_type == 'iPad'
|
92
|
-
end
|
93
|
-
|
94
|
-
def universal?
|
95
|
-
device_type == 'Universal'
|
96
|
-
end
|
97
|
-
|
98
|
-
def release_type
|
99
|
-
if stored?
|
100
|
-
'Store'
|
101
|
-
else
|
102
|
-
build_type
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
def [](key)
|
107
|
-
info.try(:[], key.to_s)
|
108
|
-
end
|
109
|
-
|
110
|
-
private
|
111
|
-
|
112
|
-
def info
|
113
|
-
@info ||= CFPropertyList.native_types(CFPropertyList::List.new(file: info_path).value)
|
114
|
-
end
|
115
|
-
|
116
|
-
def info_path
|
117
|
-
File.join(@app_path, 'Info.plist')
|
118
|
-
end
|
119
|
-
|
120
|
-
IPHONE_KEY = 'CFBundleIcons'
|
121
|
-
IPAD_KEY = 'CFBundleIcons~ipad'
|
122
|
-
|
123
|
-
def icons_root_path
|
124
|
-
case device_type
|
125
|
-
when 'iPhone'
|
126
|
-
[IPHONE_KEY]
|
127
|
-
when 'iPad'
|
128
|
-
[IPAD_KEY]
|
129
|
-
when 'Universal'
|
130
|
-
[IPHONE_KEY, IPAD_KEY]
|
131
|
-
end
|
132
|
-
end
|
133
|
-
end
|
134
|
-
end
|
135
|
-
end
|
@@ -1,91 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'cfpropertylist'
|
4
|
-
|
5
|
-
module AppInfo
|
6
|
-
module Parser
|
7
|
-
# .mobileprovision file parser
|
8
|
-
class MobileProvision
|
9
|
-
def initialize(path)
|
10
|
-
@path = path
|
11
|
-
end
|
12
|
-
|
13
|
-
def name
|
14
|
-
mobileprovision.try(:[], 'Name')
|
15
|
-
end
|
16
|
-
|
17
|
-
def app_name
|
18
|
-
mobileprovision.try(:[], 'AppIDName')
|
19
|
-
end
|
20
|
-
|
21
|
-
def devices
|
22
|
-
mobileprovision.try(:[], 'ProvisionedDevices')
|
23
|
-
end
|
24
|
-
|
25
|
-
def team_identifier
|
26
|
-
mobileprovision.try(:[], 'TeamIdentifier')
|
27
|
-
end
|
28
|
-
|
29
|
-
def team_name
|
30
|
-
mobileprovision.try(:[], 'TeamName')
|
31
|
-
end
|
32
|
-
|
33
|
-
def profile_name
|
34
|
-
mobileprovision.try(:[], 'Name')
|
35
|
-
end
|
36
|
-
|
37
|
-
def created_date
|
38
|
-
mobileprovision.try(:[], 'CreationDate')
|
39
|
-
end
|
40
|
-
|
41
|
-
def expired_date
|
42
|
-
mobileprovision.try(:[], 'ExpirationDate')
|
43
|
-
end
|
44
|
-
|
45
|
-
def entitlements
|
46
|
-
mobileprovision.try(:[], 'Entitlements')
|
47
|
-
end
|
48
|
-
|
49
|
-
def method_missing(method_name, *args, &block)
|
50
|
-
key = if method_name.to_s.include?('_')
|
51
|
-
method_name.to_s
|
52
|
-
.split('_')
|
53
|
-
.map(&:capitalize)
|
54
|
-
.join('')
|
55
|
-
else
|
56
|
-
method_name.to_s
|
57
|
-
end
|
58
|
-
|
59
|
-
mobileprovision.try(:[], key)
|
60
|
-
end
|
61
|
-
|
62
|
-
def empty?
|
63
|
-
mobileprovision.nil?
|
64
|
-
end
|
65
|
-
|
66
|
-
def mobileprovision
|
67
|
-
return @mobileprovision = nil unless File.exist?(@path)
|
68
|
-
|
69
|
-
data = File.read(@path)
|
70
|
-
data = strip_plist_wrapper(data) unless bplist?(data)
|
71
|
-
list = CFPropertyList::List.new(data: data).value
|
72
|
-
@mobileprovision = CFPropertyList.native_types(list)
|
73
|
-
rescue CFFormatError
|
74
|
-
@mobileprovision = nil
|
75
|
-
end
|
76
|
-
|
77
|
-
private
|
78
|
-
|
79
|
-
def bplist?(raw)
|
80
|
-
raw[0..5] == 'bplist'
|
81
|
-
end
|
82
|
-
|
83
|
-
def strip_plist_wrapper(raw)
|
84
|
-
end_tag = '</plist>'
|
85
|
-
start_point = raw.index('<?xml version=')
|
86
|
-
end_point = raw.index(end_tag) + end_tag.size - 1
|
87
|
-
raw[start_point..end_point]
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|