app-info 2.0.0.beta4 → 2.0.0.beta7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -1
- data/Rakefile +5 -0
- data/app_info.gemspec +1 -0
- data/lib/app_info.rb +17 -8
- data/lib/app_info/apk.rb +9 -7
- data/lib/app_info/dsym.rb +3 -5
- data/lib/app_info/ipa.rb +1 -15
- data/lib/app_info/proguard.rb +90 -0
- data/lib/app_info/util.rb +25 -0
- data/lib/app_info/version.rb +1 -1
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38ac4cbe16bdedd57c08eb1908f7fdd9789f9dfc4134ccf7ab8bbd823799c991
|
4
|
+
data.tar.gz: 075cc6aaafe184d7913a576d16e18e3469190fb6129d8debba0a07a098a7c8ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f1e75751e4495fabf29e2c289d2c4e3b312e64642477e233aff8622035f63232731dab40e86eb16a0f6092baf95c5c92a65827f44a34243e3faf225f571963e
|
7
|
+
data.tar.gz: 14933a76b8a3dcb8a4ed90a125144098fd8c6154fe6dcaa6ba9ed083054c524b2634860f990a575bcb40bb037690ae8b1b2958f8fbd52cd94b6e360d0ab5b8fa
|
data/CHANGELOG.md
CHANGED
@@ -17,9 +17,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
17
17
|
|
18
18
|
### Added
|
19
19
|
|
20
|
-
- Added .dSYM.zip format support. #[8](https://github.com/icyleaf/app-info/issues/8)
|
20
|
+
- Added iOS .dSYM.zip format support. #[8](https://github.com/icyleaf/app-info/issues/8)
|
21
21
|
- Added parse mobileprovision in Linux. #[10](https://github.com/icyleaf/app_info/pull/10)
|
22
22
|
- Added `AppInfo.file_type` to detect file type.
|
23
|
+
- Added detect and simple parse Android proguard file support. #[15](https://github.com/icyleaf/app_info/pull/15)
|
23
24
|
|
24
25
|
## [1.1.2] (2019-09-19)
|
25
26
|
|
data/Rakefile
CHANGED
data/app_info.gemspec
CHANGED
@@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_dependency 'ruby-macho', '~> 2.2.0'
|
26
26
|
spec.add_dependency 'ruby_android', '~> 0.7.7'
|
27
27
|
spec.add_dependency 'rubyzip', '>= 1.2', '< 3.0'
|
28
|
+
spec.add_dependency 'uuidtools', '~> 2.1.5'
|
28
29
|
|
29
30
|
spec.add_development_dependency 'bundler', '>= 1.12'
|
30
31
|
spec.add_development_dependency 'rake', '>= 10.0'
|
data/lib/app_info.rb
CHANGED
@@ -1,10 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'app_info/core_ext/object/try'
|
2
4
|
require 'app_info/version'
|
3
5
|
require 'app_info/ipa'
|
4
6
|
require 'app_info/ipa/info_plist'
|
5
7
|
require 'app_info/ipa/mobile_provision'
|
6
8
|
require 'app_info/apk'
|
7
9
|
require 'app_info/dsym'
|
10
|
+
require 'app_info/proguard'
|
8
11
|
|
9
12
|
# AppInfo Module
|
10
13
|
module AppInfo
|
@@ -17,6 +20,7 @@ module AppInfo
|
|
17
20
|
IOS = 'iOS'
|
18
21
|
ANDROID = 'Android'
|
19
22
|
DSYM = 'dSYM'
|
23
|
+
PROGUARD = 'Proguard'
|
20
24
|
end
|
21
25
|
|
22
26
|
# Get a new parser for automatic
|
@@ -28,6 +32,7 @@ module AppInfo
|
|
28
32
|
when :apk then APK.new(file)
|
29
33
|
when :mobileprovision then MobileProvision.new(file)
|
30
34
|
when :dsym then DSYM.new(file)
|
35
|
+
when :proguard then Proguard.new(file)
|
31
36
|
else
|
32
37
|
raise UnkownFileTypeError, "Sorry, AppInfo can not detect file type: #{file}"
|
33
38
|
end
|
@@ -51,17 +56,20 @@ module AppInfo
|
|
51
56
|
# :nodoc:
|
52
57
|
def self.detect_zip_file(file)
|
53
58
|
Zip.warn_invalid_date = false
|
54
|
-
Zip::File.open(file)
|
55
|
-
|
56
|
-
|
57
|
-
|
59
|
+
zip_file = Zip::File.open(file)
|
60
|
+
|
61
|
+
return :proguard unless zip_file.glob('*mapping*.txt').empty?
|
62
|
+
return :apk unless zip_file.find_entry('AndroidManifest.xml').nil? &&
|
63
|
+
zip_file.find_entry('classes.dex').nil?
|
64
|
+
|
65
|
+
zip_file.each do |f|
|
66
|
+
path = f.name
|
58
67
|
|
59
|
-
|
60
|
-
|
61
|
-
return :dsym if path.include?('/DWARF/')
|
62
|
-
end
|
68
|
+
return :ipa if path.include?('Payload/') && path.end_with?('Info.plist')
|
69
|
+
return :dsym if path.include?('Contents/Resources/DWARF/')
|
63
70
|
end
|
64
71
|
end
|
72
|
+
private_class_method :detect_zip_file
|
65
73
|
|
66
74
|
# :nodoc:
|
67
75
|
def self.detect_mobileprovision(hex)
|
@@ -76,4 +84,5 @@ module AppInfo
|
|
76
84
|
:mobileprovision
|
77
85
|
end
|
78
86
|
end
|
87
|
+
private_class_method :detect_mobileprovision
|
79
88
|
end
|
data/lib/app_info/apk.rb
CHANGED
@@ -33,23 +33,25 @@ module AppInfo
|
|
33
33
|
end
|
34
34
|
alias file_type os
|
35
35
|
|
36
|
-
def
|
37
|
-
manifest.
|
36
|
+
def version_name
|
37
|
+
manifest.version_name
|
38
38
|
end
|
39
|
+
alias release_version version_name
|
39
40
|
|
40
|
-
def
|
41
|
-
manifest.
|
41
|
+
def version_code
|
42
|
+
manifest.version_code.to_s
|
42
43
|
end
|
44
|
+
alias build_version version_code
|
43
45
|
|
44
46
|
def name
|
45
47
|
resource.find('@string/app_name')
|
46
48
|
end
|
47
49
|
|
48
|
-
def
|
50
|
+
def package_name
|
49
51
|
manifest.package_name
|
50
52
|
end
|
51
|
-
alias identifier
|
52
|
-
alias package_name
|
53
|
+
alias identifier package_name
|
54
|
+
alias bundle_id package_name
|
53
55
|
|
54
56
|
def device_type
|
55
57
|
if wear?
|
data/lib/app_info/dsym.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true`
|
2
2
|
|
3
|
-
require 'zip'
|
4
3
|
require 'macho'
|
5
|
-
require 'app_info/
|
4
|
+
require 'app_info/util'
|
6
5
|
|
7
6
|
module AppInfo
|
8
7
|
# DSYM parser
|
@@ -82,13 +81,12 @@ module AppInfo
|
|
82
81
|
if File.directory?(@file)
|
83
82
|
@contents = @file
|
84
83
|
else
|
85
|
-
@contents = "#{Dir.mktmpdir}/AppInfo-dsym-#{SecureRandom.hex}"
|
86
84
|
dsym_dir = nil
|
87
|
-
|
85
|
+
@contents = Util.unarchive(@file, path: 'dsym') do |path, zip_file|
|
88
86
|
zip_file.each do |f|
|
89
87
|
dsym_dir ||= f.name
|
90
88
|
|
91
|
-
f_path = File.join(
|
89
|
+
f_path = File.join(path, f.name)
|
92
90
|
zip_file.extract(f, f_path) unless File.exist?(f_path)
|
93
91
|
end
|
94
92
|
end
|
data/lib/app_info/ipa.rb
CHANGED
@@ -1,12 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'zip'
|
4
3
|
require 'pngdefry'
|
5
4
|
require 'fileutils'
|
6
|
-
require 'securerandom'
|
7
5
|
require 'cfpropertylist'
|
8
6
|
require 'app_info/util'
|
9
|
-
require 'app_info/core_ext/object/try'
|
10
7
|
|
11
8
|
module AppInfo
|
12
9
|
# IPA parser
|
@@ -199,18 +196,7 @@ module AppInfo
|
|
199
196
|
private
|
200
197
|
|
201
198
|
def contents
|
202
|
-
|
203
|
-
unless @contents
|
204
|
-
@contents = "#{Dir.mktmpdir}/AppInfo-ios-#{SecureRandom.hex}"
|
205
|
-
Zip::File.open(@file) do |zip_file|
|
206
|
-
zip_file.each do |f|
|
207
|
-
f_path = File.join(@contents, f.name)
|
208
|
-
zip_file.extract(f, f_path) unless File.exist?(f_path)
|
209
|
-
end
|
210
|
-
end
|
211
|
-
end
|
212
|
-
|
213
|
-
@contents
|
199
|
+
@contents ||= Util.unarchive(@file, path: 'ios')
|
214
200
|
end
|
215
201
|
|
216
202
|
def icons_root_path
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'uuidtools'
|
4
|
+
require 'rexml/document'
|
5
|
+
require 'app_info/util'
|
6
|
+
|
7
|
+
module AppInfo
|
8
|
+
# Proguard parser
|
9
|
+
class Proguard
|
10
|
+
NAMESPACE = UUIDTools::UUID.sha1_create(UUIDTools::UUID_DNS_NAMESPACE, 'icyleaf.com')
|
11
|
+
|
12
|
+
attr_reader :file
|
13
|
+
|
14
|
+
def initialize(file)
|
15
|
+
@file = file
|
16
|
+
end
|
17
|
+
|
18
|
+
def file_type
|
19
|
+
AppInfo::Platform::PROGUARD
|
20
|
+
end
|
21
|
+
|
22
|
+
def uuid
|
23
|
+
# Similar to https://docs.sentry.io/workflow/debug-files/#proguard-uuids
|
24
|
+
UUIDTools::UUID.sha1_create(NAMESPACE, File.read(mapping_path)).to_s
|
25
|
+
end
|
26
|
+
alias debug_id uuid
|
27
|
+
|
28
|
+
def mapping?
|
29
|
+
File.exist?(mapping_path)
|
30
|
+
end
|
31
|
+
|
32
|
+
def manifest?
|
33
|
+
File.exist?(manifest_path)
|
34
|
+
end
|
35
|
+
|
36
|
+
def symbol?
|
37
|
+
File.exist?(symbol_path)
|
38
|
+
end
|
39
|
+
alias resource? symbol?
|
40
|
+
|
41
|
+
def package_name
|
42
|
+
return unless manifest?
|
43
|
+
|
44
|
+
manifest.root.attributes['package']
|
45
|
+
end
|
46
|
+
|
47
|
+
def releasd_version
|
48
|
+
return unless manifest?
|
49
|
+
|
50
|
+
manifest.root.attributes['package']
|
51
|
+
end
|
52
|
+
|
53
|
+
def version_name
|
54
|
+
return unless manifest?
|
55
|
+
|
56
|
+
manifest.root.attributes['versionName']
|
57
|
+
end
|
58
|
+
alias release_version version_name
|
59
|
+
|
60
|
+
def version_code
|
61
|
+
return unless manifest?
|
62
|
+
|
63
|
+
manifest.root.attributes['versionCode']
|
64
|
+
end
|
65
|
+
alias build_version version_code
|
66
|
+
|
67
|
+
def manifest
|
68
|
+
return unless manifest?
|
69
|
+
|
70
|
+
@manifest ||= REXML::Document.new(File.new(manifest_path))
|
71
|
+
end
|
72
|
+
|
73
|
+
def mapping_path
|
74
|
+
@mapping_path ||= Dir.glob(File.join(contents, '*mapping*.txt')).first
|
75
|
+
end
|
76
|
+
|
77
|
+
def manifest_path
|
78
|
+
@manifest_path ||= File.join(contents, 'AndroidManifest.xml')
|
79
|
+
end
|
80
|
+
|
81
|
+
def symbol_path
|
82
|
+
@symbol_path ||= File.join(contents, 'R.txt')
|
83
|
+
end
|
84
|
+
alias resource_path symbol_path
|
85
|
+
|
86
|
+
def contents
|
87
|
+
@contents ||= Util.unarchive(@file, path: 'proguard')
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
data/lib/app_info/util.rb
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'zip'
|
4
|
+
require 'fileutils'
|
5
|
+
require 'securerandom'
|
6
|
+
|
3
7
|
module AppInfo
|
4
8
|
# AppInfo Util
|
5
9
|
module Util
|
@@ -22,5 +26,26 @@ module AppInfo
|
|
22
26
|
|
23
27
|
"#{number} #{FILE_SIZE_UNITS[exponent]}"
|
24
28
|
end
|
29
|
+
|
30
|
+
# Unarchive zip file
|
31
|
+
#
|
32
|
+
# source: https://github.com/soffes/lagunitas/blob/master/lib/lagunitas/ipa.rb
|
33
|
+
def self.unarchive(file, path: nil)
|
34
|
+
path = path ? "#{path}-" : ''
|
35
|
+
root_path = "#{Dir.mktmpdir}/AppInfo-#{path}#{SecureRandom.hex}"
|
36
|
+
Zip::File.open(file) do |zip_file|
|
37
|
+
if block_given?
|
38
|
+
yield root_path, zip_file
|
39
|
+
else
|
40
|
+
zip_file.each do |f|
|
41
|
+
f_path = File.join(root_path, f.name)
|
42
|
+
FileUtils.mkdir_p(File.dirname(f_path))
|
43
|
+
zip_file.extract(f, f_path) unless File.exist?(f_path)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
root_path
|
49
|
+
end
|
25
50
|
end
|
26
51
|
end
|
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: 2.0.0.
|
4
|
+
version: 2.0.0.beta7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- icyleaf
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: CFPropertyList
|
@@ -112,6 +112,20 @@ dependencies:
|
|
112
112
|
- - "<"
|
113
113
|
- !ruby/object:Gem::Version
|
114
114
|
version: '3.0'
|
115
|
+
- !ruby/object:Gem::Dependency
|
116
|
+
name: uuidtools
|
117
|
+
requirement: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - "~>"
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: 2.1.5
|
122
|
+
type: :runtime
|
123
|
+
prerelease: false
|
124
|
+
version_requirements: !ruby/object:Gem::Requirement
|
125
|
+
requirements:
|
126
|
+
- - "~>"
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: 2.1.5
|
115
129
|
- !ruby/object:Gem::Dependency
|
116
130
|
name: bundler
|
117
131
|
requirement: !ruby/object:Gem::Requirement
|
@@ -180,6 +194,7 @@ files:
|
|
180
194
|
- lib/app_info/ipa.rb
|
181
195
|
- lib/app_info/ipa/info_plist.rb
|
182
196
|
- lib/app_info/ipa/mobile_provision.rb
|
197
|
+
- lib/app_info/proguard.rb
|
183
198
|
- lib/app_info/util.rb
|
184
199
|
- lib/app_info/version.rb
|
185
200
|
homepage: http://github.com/icyleaf/app-info
|