app-info 3.0.0.beta2 → 3.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 +27 -1
- data/lib/app_info/aab.rb +29 -7
- data/lib/app_info/android.rb +25 -6
- data/lib/app_info/apk.rb +28 -6
- data/lib/app_info/apple.rb +6 -6
- data/lib/app_info/certificate.rb +8 -7
- data/lib/app_info/const.rb +5 -4
- data/lib/app_info/dsym/debug_info.rb +9 -0
- data/lib/app_info/dsym/macho.rb +7 -0
- data/lib/app_info/dsym.rb +7 -3
- data/lib/app_info/file.rb +4 -4
- data/lib/app_info/info_plist.rb +8 -8
- data/lib/app_info/mobile_provision.rb +20 -20
- data/lib/app_info/pe.rb +72 -10
- data/lib/app_info/proguard.rb +17 -13
- data/lib/app_info/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f280bf2b7d24887596063969a7491b89d799c39cabdd6a8149beb9d20554d73
|
4
|
+
data.tar.gz: 0a12bb443128045426a2de2c308e4d750e3269ed913d609e7546a3ec768cd6c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 144909595cce9cd8706b3e36cc2162ae61da7b4982bb06f7ba77f906473d05db7b3e67a6d86e0258911226251eab8db910f3e84c4746a8961746770fbd39cdbe
|
7
|
+
data.tar.gz: 04fbe3e5c61dded451319c6b1183ef3e1e48e1ae6297152a1354093697a2a562916f7360fbf4fc340d62864d45be11b8731fc32e43e482e81d953f06aa744f65
|
data/CHANGELOG.md
CHANGED
@@ -9,6 +9,30 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
9
9
|
|
10
10
|
> List all changes before release a new version.
|
11
11
|
|
12
|
+
## [3.0.0.beta4] (2023-04-11)
|
13
|
+
|
14
|
+
### Added
|
15
|
+
|
16
|
+
- Add `.files` method to proguard parser.
|
17
|
+
|
18
|
+
### Fixed
|
19
|
+
|
20
|
+
- Fail to extract dsym contents.
|
21
|
+
|
22
|
+
## [3.0.0.beta3] (2023-04-05)
|
23
|
+
|
24
|
+
### Added
|
25
|
+
|
26
|
+
- Android parser `.icons` method add exclude param to filter icons.
|
27
|
+
|
28
|
+
### Changed
|
29
|
+
|
30
|
+
- Rename `.platform` to `.manufacturer`, rename `.opera_sytem` to `.platform` for all parsers.
|
31
|
+
|
32
|
+
### Fixed
|
33
|
+
|
34
|
+
- Minor fixes.
|
35
|
+
|
12
36
|
## [3.0.0.beta2] (2023-04-04)
|
13
37
|
|
14
38
|
### Changed
|
@@ -278,7 +302,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
278
302
|
|
279
303
|
- Updated dependency of CFPropertly list be a range between 2.3.4. (thanks @[cschroed](https://github.com/cschroed))
|
280
304
|
|
281
|
-
[Unreleased]: https://github.com/icyleaf/app-info/compare/v3.0.0.
|
305
|
+
[Unreleased]: https://github.com/icyleaf/app-info/compare/v3.0.0.beta4..HEAD
|
306
|
+
[3.0.0.beta4]: https://github.com/icyleaf/app-info/compare/v3.0.0.beta3...v3.0.0.beta4
|
307
|
+
[3.0.0.beta3]: https://github.com/icyleaf/app-info/compare/v3.0.0.beta2...v3.0.0.beta3
|
282
308
|
[3.0.0.beta2]: https://github.com/icyleaf/app-info/compare/v3.0.0.beta1...v3.0.0.beta2
|
283
309
|
[3.0.0.beta1]: https://github.com/icyleaf/app-info/compare/v2.8.5...v3.0.0.beta1
|
284
310
|
[2.8.5]: https://github.com/icyleaf/app-info/compare/v2.8.4...v2.8.5
|
data/lib/app_info/aab.rb
CHANGED
@@ -115,28 +115,48 @@ module AppInfo
|
|
115
115
|
end
|
116
116
|
|
117
117
|
# Full icons metadata
|
118
|
-
# @example
|
118
|
+
# @example full icons
|
119
119
|
# aab.icons
|
120
120
|
# # => [
|
121
121
|
# # {
|
122
|
-
# # name: '
|
123
|
-
# # file: '/path/to/
|
122
|
+
# # name: 'ic_launcher.png',
|
123
|
+
# # file: '/path/to/ic_launcher.webp',
|
124
124
|
# # dimensions: [29, 29]
|
125
125
|
# # },
|
126
126
|
# # {
|
127
|
-
# # name: '
|
128
|
-
# # file: '/path/to/
|
127
|
+
# # name: 'ic_launcher.png',
|
128
|
+
# # file: '/path/to/ic_launcher.png',
|
129
|
+
# # dimensions: [120, 120]
|
130
|
+
# # },
|
131
|
+
# # {
|
132
|
+
# # name: 'ic_launcher.xml',
|
133
|
+
# # file: '/path/to/ic_launcher.xml',
|
134
|
+
# # dimensions: [nil, nil]
|
135
|
+
# # },
|
136
|
+
# # ]
|
137
|
+
# @example exclude xml icons
|
138
|
+
# aab.icons(filter: :xml)
|
139
|
+
# # => [
|
140
|
+
# # {
|
141
|
+
# # name: 'ic_launcher.png',
|
142
|
+
# # file: '/path/to/ic_launcher.webp',
|
143
|
+
# # dimensions: [29, 29]
|
144
|
+
# # },
|
145
|
+
# # {
|
146
|
+
# # name: 'ic_launcher.png',
|
147
|
+
# # file: '/path/to/ic_launcher.png',
|
129
148
|
# # dimensions: [120, 120]
|
130
149
|
# # }
|
131
150
|
# # ]
|
151
|
+
# @param [String, Symbol, Array<Symbol, Array>] filter filter file extension name
|
132
152
|
# @return [Array<Hash{Symbol => String, Array<Integer>}>] icons paths of icons
|
133
|
-
def icons
|
153
|
+
def icons(exclude: nil)
|
134
154
|
@icons ||= manifest.icons.each_with_object([]) do |res, obj|
|
135
155
|
path = res.value
|
136
156
|
filename = ::File.basename(path)
|
137
157
|
filepath = ::File.join(contents, ::File.dirname(path))
|
138
158
|
file = ::File.join(filepath, filename)
|
139
|
-
FileUtils.mkdir_p
|
159
|
+
FileUtils.mkdir_p(filepath)
|
140
160
|
|
141
161
|
binary_data = read_file(path)
|
142
162
|
::File.write(file, binary_data, encoding: Encoding::BINARY)
|
@@ -147,6 +167,8 @@ module AppInfo
|
|
147
167
|
dimensions: ImageSize.path(file).size
|
148
168
|
}
|
149
169
|
end
|
170
|
+
|
171
|
+
extract_icon(@icons, exclude: exclude)
|
150
172
|
end
|
151
173
|
|
152
174
|
def clear!
|
data/lib/app_info/android.rb
CHANGED
@@ -23,14 +23,14 @@ module AppInfo
|
|
23
23
|
file_to_human_size(@file, human_size: human_size)
|
24
24
|
end
|
25
25
|
|
26
|
-
# @return [Symbol] {
|
27
|
-
def
|
28
|
-
|
26
|
+
# @return [Symbol] {Manufacturer}
|
27
|
+
def manufacturer
|
28
|
+
Manufacturer::GOOGLE
|
29
29
|
end
|
30
30
|
|
31
|
-
# @return [Symbol] {
|
32
|
-
def
|
33
|
-
|
31
|
+
# @return [Symbol] {Platform}
|
32
|
+
def platform
|
33
|
+
Platform::ANDROID
|
34
34
|
end
|
35
35
|
|
36
36
|
# @return [Symbol] {Device}
|
@@ -153,6 +153,25 @@ module AppInfo
|
|
153
153
|
|
154
154
|
protected
|
155
155
|
|
156
|
+
def extract_icon(icons, exclude: nil)
|
157
|
+
excludes = exclude_icon_exts(exclude: exclude)
|
158
|
+
icons.reject { |icon| icon_ext_match?(icon[:name], excludes) }
|
159
|
+
end
|
160
|
+
|
161
|
+
def exclude_icon_exts(exclude:)
|
162
|
+
case exclude
|
163
|
+
when String then [exclude]
|
164
|
+
when Array then exclude.map(&:to_s)
|
165
|
+
when Symbol then [exclude.to_s]
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
def icon_ext_match?(file, excludes)
|
170
|
+
return false if file.nil? || excludes.nil?
|
171
|
+
|
172
|
+
excludes.include?(::File.extname(file)[1..-1])
|
173
|
+
end
|
174
|
+
|
156
175
|
def v1sign
|
157
176
|
@v1sign ||= Android::Signature::V1.verify(self)
|
158
177
|
rescue Android::Signature::NotFoundError
|
data/lib/app_info/apk.rb
CHANGED
@@ -70,22 +70,42 @@ module AppInfo
|
|
70
70
|
end
|
71
71
|
|
72
72
|
# Full icons metadata
|
73
|
-
# @example
|
73
|
+
# @example full icons
|
74
74
|
# apk.icons
|
75
75
|
# # => [
|
76
76
|
# # {
|
77
|
-
# # name: '
|
78
|
-
# # file: '/path/to/
|
77
|
+
# # name: 'ic_launcher.png',
|
78
|
+
# # file: '/path/to/ic_launcher.png',
|
79
79
|
# # dimensions: [29, 29]
|
80
80
|
# # },
|
81
81
|
# # {
|
82
|
-
# # name: '
|
83
|
-
# # file: '/path/to/
|
82
|
+
# # name: 'ic_launcher.png',
|
83
|
+
# # file: '/path/to/ic_launcher.png',
|
84
|
+
# # dimensions: [120, 120]
|
85
|
+
# # },
|
86
|
+
# # {
|
87
|
+
# # name: 'ic_launcher.xml',
|
88
|
+
# # file: '/path/to/ic_launcher.xml',
|
89
|
+
# # dimensions: [nil, nil]
|
90
|
+
# # },
|
91
|
+
# # ]
|
92
|
+
# @example exclude xml icons
|
93
|
+
# apk.icons(exclude: :xml)
|
94
|
+
# # => [
|
95
|
+
# # {
|
96
|
+
# # name: 'ic_launcher.png',
|
97
|
+
# # file: '/path/to/ic_launcher.png',
|
98
|
+
# # dimensions: [29, 29]
|
99
|
+
# # },
|
100
|
+
# # {
|
101
|
+
# # name: 'ic_launcher.png',
|
102
|
+
# # file: '/path/to/ic_launcher.png',
|
84
103
|
# # dimensions: [120, 120]
|
85
104
|
# # }
|
86
105
|
# # ]
|
106
|
+
# @param [Boolean] xml return xml icons
|
87
107
|
# @return [Array<Hash{Symbol => String, Array<Integer>}>] icons paths of icons
|
88
|
-
def icons
|
108
|
+
def icons(exclude: nil)
|
89
109
|
@icons ||= apk.icon.each_with_object([]) do |(path, data), obj|
|
90
110
|
icon_name = ::File.basename(path)
|
91
111
|
icon_path = ::File.join(contents, ::File.dirname(path))
|
@@ -99,6 +119,8 @@ module AppInfo
|
|
99
119
|
dimensions: ImageSize.path(icon_file).size
|
100
120
|
}
|
101
121
|
end
|
122
|
+
|
123
|
+
extract_icon(@icons, exclude: exclude)
|
102
124
|
end
|
103
125
|
|
104
126
|
def clear!
|
data/lib/app_info/apple.rb
CHANGED
@@ -26,9 +26,9 @@ module AppInfo
|
|
26
26
|
APPSTORE = :appstore
|
27
27
|
end
|
28
28
|
|
29
|
-
# @return [Symbol] {
|
30
|
-
def
|
31
|
-
|
29
|
+
# @return [Symbol] {Manufacturer}
|
30
|
+
def manufacturer
|
31
|
+
Manufacturer::APPLE
|
32
32
|
end
|
33
33
|
|
34
34
|
# return file size
|
@@ -46,8 +46,8 @@ module AppInfo
|
|
46
46
|
|
47
47
|
# @!method device
|
48
48
|
# @see InfoPlist#device
|
49
|
-
# @!method
|
50
|
-
# @see InfoPlist#
|
49
|
+
# @!method platform
|
50
|
+
# @see InfoPlist#platform
|
51
51
|
# @!method iphone?
|
52
52
|
# @see InfoPlist#iphone?
|
53
53
|
# @!method ipad?
|
@@ -72,7 +72,7 @@ module AppInfo
|
|
72
72
|
# @see InfoPlist#min_sdk_version
|
73
73
|
# @!method min_os_version
|
74
74
|
# @see InfoPlist#min_os_version
|
75
|
-
def_delegators :info, :device, :
|
75
|
+
def_delegators :info, :device, :platform, :iphone?, :ipad?, :universal?, :macos?,
|
76
76
|
:build_version, :name, :release_version, :identifier, :bundle_id,
|
77
77
|
:display_name, :bundle_name, :min_sdk_version, :min_os_version
|
78
78
|
|
data/lib/app_info/certificate.rb
CHANGED
@@ -6,6 +6,7 @@ module AppInfo
|
|
6
6
|
class Certificate
|
7
7
|
# Parse Raw data into X509 cerificate wrapper
|
8
8
|
# @param [String] certificate raw data
|
9
|
+
# @return [AppInfo::Certificate]
|
9
10
|
def self.parse(data)
|
10
11
|
cert = OpenSSL::X509::Certificate.new(data)
|
11
12
|
new(cert)
|
@@ -117,18 +118,20 @@ module AppInfo
|
|
117
118
|
end
|
118
119
|
end
|
119
120
|
|
120
|
-
# return
|
121
|
+
# return length of public key
|
121
122
|
# @return [Integer]
|
122
|
-
|
123
|
+
# @raise NotImplementedError
|
124
|
+
def length
|
123
125
|
case public_key
|
124
126
|
when OpenSSL::PKey::RSA
|
125
127
|
public_key.n.num_bits
|
126
128
|
when OpenSSL::PKey::DSA, OpenSSL::PKey::DH
|
127
129
|
public_key.p.num_bits
|
128
130
|
when OpenSSL::PKey::EC
|
129
|
-
raise NotImplementedError, "key
|
131
|
+
raise NotImplementedError, "key length for #{public_key.inspect} not implemented"
|
130
132
|
end
|
131
133
|
end
|
134
|
+
alias size length
|
132
135
|
|
133
136
|
# return fingerprint of certificate
|
134
137
|
# @return [String]
|
@@ -166,10 +169,8 @@ module AppInfo
|
|
166
169
|
@cert.send(method.to_sym, *args, &block) || super
|
167
170
|
end
|
168
171
|
|
169
|
-
def respond_to_missing?(
|
170
|
-
@cert.
|
171
|
-
@cert.respond_to?(method_name) ||
|
172
|
-
super
|
172
|
+
def respond_to_missing?(method, *args)
|
173
|
+
@cert.respond_to?(method.to_sym) || super
|
173
174
|
end
|
174
175
|
end
|
175
176
|
end
|
data/lib/app_info/const.rb
CHANGED
@@ -30,14 +30,15 @@ module AppInfo
|
|
30
30
|
UNKNOWN = :unknown
|
31
31
|
end
|
32
32
|
|
33
|
-
#
|
34
|
-
module
|
33
|
+
# Manufacturer
|
34
|
+
module Manufacturer
|
35
35
|
APPLE = :apple
|
36
36
|
GOOGLE = :google
|
37
|
-
|
37
|
+
MICROSOFT = :microsoft
|
38
38
|
end
|
39
39
|
|
40
|
-
|
40
|
+
# Platform
|
41
|
+
module Platform
|
41
42
|
MACOS = :macos
|
42
43
|
IOS = :ios
|
43
44
|
ANDROID = :android
|
@@ -12,14 +12,17 @@ module AppInfo
|
|
12
12
|
@path = path
|
13
13
|
end
|
14
14
|
|
15
|
+
# @return [String]
|
15
16
|
def object
|
16
17
|
@object ||= ::File.basename(bin_path)
|
17
18
|
end
|
18
19
|
|
20
|
+
# @return [::MachO::MachOFile, ::MachO::FatFile]
|
19
21
|
def macho_type
|
20
22
|
@macho_type ||= ::MachO.open(bin_path)
|
21
23
|
end
|
22
24
|
|
25
|
+
# @return [Array<AppInfo::DSYM::MachO>]
|
23
26
|
def machos
|
24
27
|
@machos ||= case macho_type
|
25
28
|
when ::MachO::MachOFile
|
@@ -37,29 +40,35 @@ module AppInfo
|
|
37
40
|
end
|
38
41
|
end
|
39
42
|
|
43
|
+
# @return [String, nil]
|
40
44
|
def release_version
|
41
45
|
info.try(:[], 'CFBundleShortVersionString')
|
42
46
|
end
|
43
47
|
|
48
|
+
# @return [String, nil]
|
44
49
|
def build_version
|
45
50
|
info.try(:[], 'CFBundleVersion')
|
46
51
|
end
|
47
52
|
|
53
|
+
# @return [String, nil]
|
48
54
|
def identifier
|
49
55
|
info.try(:[], 'CFBundleIdentifier').sub('com.apple.xcode.dsym.', '')
|
50
56
|
end
|
51
57
|
alias bundle_id identifier
|
52
58
|
|
59
|
+
# @return [CFPropertyList]
|
53
60
|
def info
|
54
61
|
return nil unless ::File.exist?(info_path)
|
55
62
|
|
56
63
|
@info ||= CFPropertyList.native_types(CFPropertyList::List.new(file: info_path).value)
|
57
64
|
end
|
58
65
|
|
66
|
+
# @return [String]
|
59
67
|
def info_path
|
60
68
|
@info_path ||= ::File.join(path, 'Contents', 'Info.plist')
|
61
69
|
end
|
62
70
|
|
71
|
+
# @return [String]
|
63
72
|
def bin_path
|
64
73
|
@bin_path ||= lambda {
|
65
74
|
dwarf_path = ::File.join(path, 'Contents', 'Resources', 'DWARF')
|
data/lib/app_info/dsym/macho.rb
CHANGED
@@ -13,33 +13,40 @@ module AppInfo
|
|
13
13
|
@size = size
|
14
14
|
end
|
15
15
|
|
16
|
+
# @return [String]
|
16
17
|
def cpu_name
|
17
18
|
@file.cpusubtype
|
18
19
|
end
|
19
20
|
|
21
|
+
# @return [String]
|
20
22
|
def cpu_type
|
21
23
|
@file.cputype
|
22
24
|
end
|
23
25
|
|
26
|
+
# @return [String]
|
24
27
|
def type
|
25
28
|
@file.filetype
|
26
29
|
end
|
27
30
|
|
31
|
+
# @return [String, Integer]
|
28
32
|
def size(human_size: false)
|
29
33
|
return number_to_human_size(@size) if human_size
|
30
34
|
|
31
35
|
@size
|
32
36
|
end
|
33
37
|
|
38
|
+
# @return [String]
|
34
39
|
def uuid
|
35
40
|
@file[:LC_UUID][0].uuid_string
|
36
41
|
end
|
37
42
|
alias debug_id uuid
|
38
43
|
|
44
|
+
# @return [::MachO::Headers]
|
39
45
|
def header
|
40
46
|
@header ||= @file.header
|
41
47
|
end
|
42
48
|
|
49
|
+
# @return [Hash{Symbol => String, Integer}]
|
43
50
|
def to_h
|
44
51
|
{
|
45
52
|
uuid: uuid,
|
data/lib/app_info/dsym.rb
CHANGED
@@ -7,14 +7,16 @@ module AppInfo
|
|
7
7
|
class DSYM < File
|
8
8
|
include Helper::Archive
|
9
9
|
|
10
|
-
# @return [Symbol] {
|
11
|
-
def
|
12
|
-
|
10
|
+
# @return [Symbol] {Manufacturer}
|
11
|
+
def manufacturer
|
12
|
+
Manufacturer::APPLE
|
13
13
|
end
|
14
14
|
|
15
|
+
# @return [nil]
|
15
16
|
def each_file(&block)
|
16
17
|
files.each { |file| block.call(file) }
|
17
18
|
end
|
19
|
+
alias each_objects each_file
|
18
20
|
|
19
21
|
# @return [Array<DebugInfo>] dsym_files files by alphabetical order
|
20
22
|
def files
|
@@ -22,6 +24,7 @@ module AppInfo
|
|
22
24
|
obj << DebugInfo.new(::File.join(contents, file))
|
23
25
|
end
|
24
26
|
end
|
27
|
+
alias objects files
|
25
28
|
|
26
29
|
def clear!
|
27
30
|
return unless @contents
|
@@ -52,6 +55,7 @@ module AppInfo
|
|
52
55
|
end
|
53
56
|
|
54
57
|
dest_path = ::File.join(base_path, file_path)
|
58
|
+
FileUtils.mkdir_p(::File.dirname(dest_path))
|
55
59
|
entry.extract(dest_path) unless ::File.exist?(dest_path)
|
56
60
|
end
|
57
61
|
end
|
data/lib/app_info/file.rb
CHANGED
@@ -22,13 +22,13 @@ module AppInfo
|
|
22
22
|
}.call
|
23
23
|
end
|
24
24
|
|
25
|
-
# @abstract Subclass and override {#
|
26
|
-
def
|
25
|
+
# @abstract Subclass and override {#platform} to implement.
|
26
|
+
def platform
|
27
27
|
not_implemented_error!(__method__)
|
28
28
|
end
|
29
29
|
|
30
|
-
# @abstract Subclass and override {#
|
31
|
-
def
|
30
|
+
# @abstract Subclass and override {#manufacturer} to implement.
|
31
|
+
def manufacturer
|
32
32
|
not_implemented_error!(__method__)
|
33
33
|
end
|
34
34
|
|
data/lib/app_info/info_plist.rb
CHANGED
@@ -17,18 +17,18 @@ module AppInfo
|
|
17
17
|
Device::MACOS => %w[CFBundleIconFile CFBundleIconName]
|
18
18
|
}.freeze
|
19
19
|
|
20
|
-
# @return [Symbol] {
|
21
|
-
def
|
22
|
-
|
20
|
+
# @return [Symbol] {Manufacturer}
|
21
|
+
def manufacturer
|
22
|
+
Manufacturer::APPLE
|
23
23
|
end
|
24
24
|
|
25
|
-
# @return [Symbol] {
|
26
|
-
def
|
25
|
+
# @return [Symbol] {Platform}
|
26
|
+
def platform
|
27
27
|
case device
|
28
28
|
when Device::MACOS
|
29
|
-
|
29
|
+
Platform::MACOS
|
30
30
|
when Device::IPHONE, Device::IPAD, Device::UNIVERSAL
|
31
|
-
|
31
|
+
Platform::IOS
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
@@ -40,7 +40,7 @@ module AppInfo
|
|
40
40
|
Device::IPAD
|
41
41
|
elsif device_family == [1, 2]
|
42
42
|
Device::UNIVERSAL
|
43
|
-
elsif !info.try(:[], 'DTSDKName').nil? || !info.try(:[], '
|
43
|
+
elsif !info.try(:[], 'DTSDKName').nil? || !info.try(:[], 'DTManufacturerName').nil?
|
44
44
|
Device::MACOS
|
45
45
|
else
|
46
46
|
raise NotImplementedError, "Unkonwn device: #{device_family}"
|
@@ -7,20 +7,20 @@ module AppInfo
|
|
7
7
|
# Apple code signing: provisioning profile parser
|
8
8
|
# @see https://developer.apple.com/documentation/technotes/tn3125-inside-code-signing-provisioning-profiles
|
9
9
|
class MobileProvision < File
|
10
|
-
# @return [Symbol] {
|
11
|
-
def
|
12
|
-
|
10
|
+
# @return [Symbol] {Manufacturer}
|
11
|
+
def manufacturer
|
12
|
+
Manufacturer::APPLE
|
13
13
|
end
|
14
14
|
|
15
|
-
# @return [Symbol] {
|
16
|
-
def
|
17
|
-
case
|
15
|
+
# @return [Symbol] {Platform}
|
16
|
+
def platform
|
17
|
+
case platforms[0]
|
18
18
|
when :macos
|
19
|
-
|
19
|
+
Platform::MACOS
|
20
20
|
when :ios
|
21
|
-
|
21
|
+
Platform::IOS
|
22
22
|
else
|
23
|
-
raise NotImplementedError, "Unkonwn
|
23
|
+
raise NotImplementedError, "Unkonwn platform: #{platforms[0]}"
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -43,7 +43,7 @@ module AppInfo
|
|
43
43
|
end
|
44
44
|
|
45
45
|
# @return [Array<Symbol>]
|
46
|
-
def
|
46
|
+
def platforms
|
47
47
|
return unless platforms = mobileprovision.try(:[], 'Platform')
|
48
48
|
|
49
49
|
platforms.map do |v|
|
@@ -111,13 +111,13 @@ module AppInfo
|
|
111
111
|
# @see https://stackoverflow.com/questions/1003066/what-does-get-task-allow-do-in-xcode
|
112
112
|
# @return [Boolea]
|
113
113
|
def development?
|
114
|
-
case
|
115
|
-
when
|
114
|
+
case platform
|
115
|
+
when Platform::IOS
|
116
116
|
entitlements['get-task-allow'] == true
|
117
|
-
when
|
117
|
+
when Platform::MACOS
|
118
118
|
!devices.nil?
|
119
119
|
else
|
120
|
-
raise NotImplementedError, "Unknown
|
120
|
+
raise NotImplementedError, "Unknown platform: #{platform}"
|
121
121
|
end
|
122
122
|
end
|
123
123
|
|
@@ -126,26 +126,26 @@ module AppInfo
|
|
126
126
|
# @see https://developer.apple.com/library/archive/qa/qa1830/_index.html
|
127
127
|
# @return [Boolea]
|
128
128
|
def appstore?
|
129
|
-
case
|
130
|
-
when
|
129
|
+
case platform
|
130
|
+
when Platform::IOS
|
131
131
|
!development? && entitlements.key?('beta-reports-active')
|
132
|
-
when
|
132
|
+
when Platform::MACOS
|
133
133
|
!development?
|
134
134
|
else
|
135
|
-
raise NotImplementedError, "Unknown
|
135
|
+
raise NotImplementedError, "Unknown platform: #{platform}"
|
136
136
|
end
|
137
137
|
end
|
138
138
|
|
139
139
|
# @return [Boolea]
|
140
140
|
def adhoc?
|
141
|
-
return false if
|
141
|
+
return false if platform == Platform::MACOS # macOS no need adhoc
|
142
142
|
|
143
143
|
!development? && !devices.nil?
|
144
144
|
end
|
145
145
|
|
146
146
|
# @return [Boolea]
|
147
147
|
def enterprise?
|
148
|
-
return false if
|
148
|
+
return false if platform == Platform::MACOS # macOS no need adhoc
|
149
149
|
|
150
150
|
!development? && !adhoc? && !appstore?
|
151
151
|
end
|
data/lib/app_info/pe.rb
CHANGED
@@ -24,16 +24,16 @@ module AppInfo
|
|
24
24
|
0x5128 => 'RISC-v 128'
|
25
25
|
}.freeze
|
26
26
|
|
27
|
+
# @return [Symbol] {Manufacturer}
|
28
|
+
def manufacturer
|
29
|
+
Manufacturer::MICROSOFT
|
30
|
+
end
|
31
|
+
|
27
32
|
# @return [Symbol] {Platform}
|
28
33
|
def platform
|
29
34
|
Platform::WINDOWS
|
30
35
|
end
|
31
36
|
|
32
|
-
# @return [Symbol] {OperaSystem}
|
33
|
-
def opera_system
|
34
|
-
OperaSystem::WINDOWS
|
35
|
-
end
|
36
|
-
|
37
37
|
# @return [Symbol] {Device}
|
38
38
|
def device
|
39
39
|
Device::WINDOWS
|
@@ -68,11 +68,48 @@ module AppInfo
|
|
68
68
|
# @!method assembly_version
|
69
69
|
# @see VersionInfo#assembly_version
|
70
70
|
# @return [String]
|
71
|
-
|
71
|
+
# @!method file_version
|
72
|
+
# @see VersionInfo#file_version
|
73
|
+
# @return [String]
|
74
|
+
# @!method file_description
|
75
|
+
# @see VersionInfo#file_description
|
76
|
+
# @return [String]
|
77
|
+
# @!method copyright
|
78
|
+
# @see VersionInfo#copyright
|
79
|
+
# @return [String]
|
80
|
+
# @return [String]
|
81
|
+
# @!method special_build
|
82
|
+
# @see VersionInfo#special_build
|
83
|
+
# @return [String]
|
84
|
+
# @!method private_build
|
85
|
+
# @see VersionInfo#private_build
|
86
|
+
# @return [String]
|
87
|
+
# @!method original_filename
|
88
|
+
# @see VersionInfo#original_filename
|
89
|
+
# @return [String]
|
90
|
+
# @!method internal_name
|
91
|
+
# @see VersionInfo#internal_name
|
92
|
+
# @return [String]
|
93
|
+
# @!method legal_trademarks
|
94
|
+
# @see VersionInfo#legal_trademarks
|
95
|
+
# @return [String]
|
96
|
+
def_delegators :version_info, :product_name, :product_version, :company_name, :assembly_version,
|
97
|
+
:file_version, :file_description, :copyright, :special_build, :private_build,
|
98
|
+
:original_filename, :internal_name, :legal_trademarks
|
72
99
|
|
73
100
|
alias name product_name
|
74
|
-
|
75
|
-
|
101
|
+
|
102
|
+
# Find {#product_version} then fallback to {#file_version}
|
103
|
+
# @return [String, nil]
|
104
|
+
def release_version
|
105
|
+
product_version || file_version
|
106
|
+
end
|
107
|
+
|
108
|
+
# Find {#special_build}, {#private_build} then fallback to {#assembly_version}
|
109
|
+
# @return [String, nil]
|
110
|
+
def build_version
|
111
|
+
special_build || private_build || assembly_version
|
112
|
+
end
|
76
113
|
|
77
114
|
# @return [String]
|
78
115
|
def archs
|
@@ -189,7 +226,7 @@ module AppInfo
|
|
189
226
|
|
190
227
|
# VersionInfo class
|
191
228
|
#
|
192
|
-
#
|
229
|
+
# @see https://learn.microsoft.com/zh-cn/windows/win32/menurc/versioninfo-resource
|
193
230
|
class VersionInfo
|
194
231
|
def initialize(raw)
|
195
232
|
@raw = raw
|
@@ -220,11 +257,36 @@ module AppInfo
|
|
220
257
|
@file_version ||= value_of('FileVersion')
|
221
258
|
end
|
222
259
|
|
223
|
-
# @return [String]
|
260
|
+
# @return [String, nil]
|
224
261
|
def file_description
|
225
262
|
@file_description ||= value_of('FileDescription')
|
226
263
|
end
|
227
264
|
|
265
|
+
# @return [String, nil]
|
266
|
+
def special_build
|
267
|
+
@special_build ||= value_of('SpecialBuild')
|
268
|
+
end
|
269
|
+
|
270
|
+
# @return [String, nil]
|
271
|
+
def private_build
|
272
|
+
@private_build ||= value_of('PrivateBuild')
|
273
|
+
end
|
274
|
+
|
275
|
+
# @return [String]
|
276
|
+
def original_filename
|
277
|
+
@original_filename ||= value_of('OriginalFilename')
|
278
|
+
end
|
279
|
+
|
280
|
+
# @return [String]
|
281
|
+
def internal_name
|
282
|
+
@internal_name ||= value_of('InternalName')
|
283
|
+
end
|
284
|
+
|
285
|
+
# @return [String]
|
286
|
+
def legal_trademarks
|
287
|
+
@legal_trademarks ||= value_of('LegalTrademarks')
|
288
|
+
end
|
289
|
+
|
228
290
|
# @return [String]
|
229
291
|
def copyright
|
230
292
|
@copyright ||= value_of('LegalCopyright')
|
data/lib/app_info/proguard.rb
CHANGED
@@ -10,14 +10,14 @@ module AppInfo
|
|
10
10
|
|
11
11
|
NAMESPACE = UUIDTools::UUID.sha1_create(UUIDTools::UUID_DNS_NAMESPACE, 'icyleaf.com')
|
12
12
|
|
13
|
-
# @return [Symbol] {
|
14
|
-
def
|
15
|
-
|
13
|
+
# @return [Symbol] {Manufacturer}
|
14
|
+
def manufacturer
|
15
|
+
Manufacturer::GOOGLE
|
16
16
|
end
|
17
17
|
|
18
|
-
# @return [Symbol] {
|
19
|
-
def
|
20
|
-
|
18
|
+
# @return [Symbol] {Platform}
|
19
|
+
def platform
|
20
|
+
Platform::ANDROID
|
21
21
|
end
|
22
22
|
|
23
23
|
# @return [String]
|
@@ -50,13 +50,6 @@ module AppInfo
|
|
50
50
|
manifest.root.attributes['package']
|
51
51
|
end
|
52
52
|
|
53
|
-
# @return [String, nil]
|
54
|
-
def releasd_version
|
55
|
-
return unless manifest?
|
56
|
-
|
57
|
-
manifest.root.attributes['package']
|
58
|
-
end
|
59
|
-
|
60
53
|
# @return [String, nil]
|
61
54
|
def version_name
|
62
55
|
return unless manifest?
|
@@ -73,6 +66,17 @@ module AppInfo
|
|
73
66
|
end
|
74
67
|
alias build_version version_code
|
75
68
|
|
69
|
+
def files
|
70
|
+
Dir.children(contents).each_with_object([]) do |filename, obj|
|
71
|
+
path = ::File.join(contents, filename)
|
72
|
+
obj << {
|
73
|
+
name: filename,
|
74
|
+
path: path,
|
75
|
+
size: ::File.size(path)
|
76
|
+
}
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
76
80
|
# @return [REXML::Document]
|
77
81
|
def manifest
|
78
82
|
return unless manifest?
|
data/lib/app_info/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: app-info
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0.
|
4
|
+
version: 3.0.0.beta4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- icyleaf
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: CFPropertyList
|