app-info 2.0.0.beta1 → 2.0.0.beta3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -1
- data/app_info.gemspec +1 -0
- data/lib/app_info.rb +17 -17
- data/lib/app_info/parser/dsym.rb +15 -8
- data/lib/app_info/parser/ipa.rb +1 -1
- data/lib/app_info/version.rb +1 -1
- metadata +22 -3
- data/plist.mobileprovision +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70d4913abdb1ced1404730f117fda0fb82ed91d19e291659749d6cb8c50da8e7
|
4
|
+
data.tar.gz: 5a9f1b8d786a08e552ae334679639575c1d7fd462d0f2ad6f970b0988b70e028
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 825bb3d01e2e05ac8dce27a343d4329673ee358bcd1dada568c72bf21b1469bfeb66d7cec31de3d2407634e64af1ad6bcc2b2d2bc5ddd314b17d61592e683380
|
7
|
+
data.tar.gz: 12a2f90a839ee938b29832272ca1410e0071d852f381353bff3e14f753f2946a108b6e90c04070f89e8966fe5e0cf75b80e42aa44ba735816c8c79ce8c04e55e
|
data/CHANGELOG.md
CHANGED
@@ -13,10 +13,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
13
13
|
|
14
14
|
- Added .dSYM.zip format support
|
15
15
|
- Added parse mobileprovision in Linux
|
16
|
+
- Added `AppInfo.file_type` to detect file type
|
16
17
|
|
17
18
|
### Changed
|
18
19
|
|
19
|
-
-
|
20
|
+
- Use parse Macho-O header and contents to detect file type instead of file extension name.
|
20
21
|
- Dropped Ruby 2.2 and below versions support
|
21
22
|
|
22
23
|
## [1.1.2] (2019-09-19)
|
data/app_info.gemspec
CHANGED
@@ -24,6 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_dependency 'pngdefry', '~> 0.1.2'
|
25
25
|
spec.add_dependency 'ruby-macho', '~> 2.2.0'
|
26
26
|
spec.add_dependency 'ruby_android', '~> 0.7.7'
|
27
|
+
spec.add_dependency 'rubyzip', '>= 1.2', '< 3.0'
|
27
28
|
|
28
29
|
spec.add_development_dependency 'bundler', '>= 1.12'
|
29
30
|
spec.add_development_dependency 'rake', '>= 10.0'
|
data/lib/app_info.rb
CHANGED
@@ -2,36 +2,35 @@
|
|
2
2
|
|
3
3
|
require 'app_info/version'
|
4
4
|
require 'app_info/parser'
|
5
|
+
require 'zip'
|
5
6
|
|
6
|
-
#
|
7
7
|
# AppInfo Module
|
8
8
|
module AppInfo
|
9
9
|
class NotFoundError < StandardError; end
|
10
|
-
class
|
10
|
+
class UnkownFileTypeError < StandardError; end
|
11
11
|
|
12
12
|
# Get a new parser for automatic
|
13
13
|
def self.parse(file)
|
14
14
|
raise NotFoundError, file unless File.exist?(file)
|
15
15
|
|
16
|
-
case
|
16
|
+
case file_type(file)
|
17
17
|
when :ipa then Parser::IPA.new(file)
|
18
18
|
when :apk then Parser::APK.new(file)
|
19
19
|
when :mobileprovision then Parser::MobileProvision.new(file)
|
20
20
|
when :dsym then Parser::DSYM.new(file)
|
21
21
|
else
|
22
|
-
raise
|
22
|
+
raise UnkownFileTypeError, "Sorry, AppInfo can not detect file type: #{file}"
|
23
23
|
end
|
24
24
|
end
|
25
25
|
singleton_class.send(:alias_method, :dump, :parse)
|
26
26
|
|
27
|
-
|
28
27
|
# Detect file type by read file header
|
29
28
|
#
|
30
29
|
# TODO: This can be better way to solvt, if anyone knows, tell me please.
|
31
|
-
def self.
|
30
|
+
def self.file_type(file)
|
32
31
|
header_hex = IO.read(file, 100)
|
33
32
|
type = if header_hex =~ /^\x50\x4b\x03\x04/
|
34
|
-
|
33
|
+
detect_zip_file(file)
|
35
34
|
else
|
36
35
|
detect_mobileprovision(header_hex)
|
37
36
|
end
|
@@ -40,16 +39,17 @@ module AppInfo
|
|
40
39
|
end
|
41
40
|
|
42
41
|
# :nodoc:
|
43
|
-
def self.
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
42
|
+
def self.detect_zip_file(file)
|
43
|
+
Zip.warn_invalid_date = false
|
44
|
+
Zip::File.open(file) do |zip_file|
|
45
|
+
zip_file.each do |f|
|
46
|
+
path = f.name
|
47
|
+
name = File.basename(path)
|
48
|
+
|
49
|
+
return :apk if name == 'AndroidManifest.xml'
|
50
|
+
return :ipa if path.include?('Payload/') && name.end_with?('Info.plist')
|
51
|
+
return :dsym if path.include?('/DWARF/')
|
52
|
+
end
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
data/lib/app_info/parser/dsym.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'zip'
|
1
2
|
require 'macho'
|
2
3
|
require 'app_info/core_ext/object/try'
|
3
4
|
|
@@ -16,24 +17,24 @@ module AppInfo
|
|
16
17
|
end
|
17
18
|
|
18
19
|
def machos
|
19
|
-
@machos ||= case
|
20
|
+
@machos ||= case macho_type
|
20
21
|
when ::MachO::MachOFile
|
21
|
-
[MachO.new(
|
22
|
+
[MachO.new(macho_type, File.size(app_path))]
|
22
23
|
else
|
23
|
-
size =
|
24
|
+
size = macho_type.fat_archs.each_with_object([]) do |arch, obj|
|
24
25
|
obj << arch.size
|
25
26
|
end
|
26
27
|
|
27
28
|
machos = []
|
28
|
-
|
29
|
+
macho_type.machos.each_with_index do |file, i|
|
29
30
|
machos << MachO.new(file, size[i])
|
30
31
|
end
|
31
32
|
machos
|
32
33
|
end
|
33
34
|
end
|
34
35
|
|
35
|
-
def
|
36
|
-
@
|
36
|
+
def macho_type
|
37
|
+
@macho_type ||= ::MachO.open(app_path)
|
37
38
|
end
|
38
39
|
|
39
40
|
def object
|
@@ -41,7 +42,13 @@ module AppInfo
|
|
41
42
|
end
|
42
43
|
|
43
44
|
def app_path
|
44
|
-
@app_path
|
45
|
+
unless @app_path
|
46
|
+
path = File.join(contents, 'Contents', 'Resources', 'DWARF')
|
47
|
+
name = Dir.entries(path).last
|
48
|
+
@app_path = File.join(path, name)
|
49
|
+
end
|
50
|
+
|
51
|
+
@app_path
|
45
52
|
end
|
46
53
|
|
47
54
|
private
|
@@ -56,8 +63,8 @@ module AppInfo
|
|
56
63
|
Zip::File.open(@file) do |zip_file|
|
57
64
|
zip_file.each do |f|
|
58
65
|
dsym_dir ||= f.name
|
66
|
+
|
59
67
|
f_path = File.join(@contents, f.name)
|
60
|
-
FileUtils.mkdir_p(File.dirname(f_path))
|
61
68
|
zip_file.extract(f, f_path) unless File.exist?(f_path)
|
62
69
|
end
|
63
70
|
end
|
data/lib/app_info/parser/ipa.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'zip'
|
1
2
|
require 'pngdefry'
|
2
3
|
require 'fileutils'
|
3
4
|
require 'securerandom'
|
@@ -202,7 +203,6 @@ module AppInfo
|
|
202
203
|
Zip::File.open(@file) do |zip_file|
|
203
204
|
zip_file.each do |f|
|
204
205
|
f_path = File.join(@contents, f.name)
|
205
|
-
FileUtils.mkdir_p(File.dirname(f_path))
|
206
206
|
zip_file.extract(f, f_path) unless File.exist?(f_path)
|
207
207
|
end
|
208
208
|
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.beta3
|
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-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: CFPropertyList
|
@@ -92,6 +92,26 @@ dependencies:
|
|
92
92
|
- - "~>"
|
93
93
|
- !ruby/object:Gem::Version
|
94
94
|
version: 0.7.7
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
name: rubyzip
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '1.2'
|
102
|
+
- - "<"
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '3.0'
|
105
|
+
type: :runtime
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '1.2'
|
112
|
+
- - "<"
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '3.0'
|
95
115
|
- !ruby/object:Gem::Dependency
|
96
116
|
name: bundler
|
97
117
|
requirement: !ruby/object:Gem::Requirement
|
@@ -162,7 +182,6 @@ files:
|
|
162
182
|
- lib/app_info/parser/ipa/info_plist.rb
|
163
183
|
- lib/app_info/parser/ipa/mobile_provision.rb
|
164
184
|
- lib/app_info/version.rb
|
165
|
-
- plist.mobileprovision
|
166
185
|
homepage: http://github.com/icyleaf/app-info
|
167
186
|
licenses:
|
168
187
|
- MIT
|
data/plist.mobileprovision
DELETED
File without changes
|