app-info 2.4.1 → 2.5.3
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 +41 -2
- data/README.md +7 -2
- data/app_info.gemspec +0 -1
- data/lib/app_info/apk.rb +1 -1
- data/lib/app_info/ipa.rb +0 -1
- data/lib/app_info/ipa/info_plist.rb +22 -8
- data/lib/app_info/png_uncrush.rb +181 -0
- data/lib/app_info/util.rb +1 -1
- data/lib/app_info/version.rb +1 -1
- metadata +3 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db2a658da1cd03d7129e25b303508ba909275033afefdad334051df0cf3ef28d
|
4
|
+
data.tar.gz: a8756a88ca2039d14debca872ab586d774f9efe19ecb296cedd87a9cf65ac038
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a69147119d7201d1c4e4a584ec53cbb158d94350a28886529439a6e156ff6c3d107914a23a3d89f386228b34fcc947af93364cd84125413375719f20d994481c
|
7
|
+
data.tar.gz: 5e7f59d142fbfb5b29b3bad6c97224a091a88207ec8de502a8655456dda81550a3a2698b21893f5e6b6398d86fcc387de5502594c2d66a8f632d087fdf5e6f79
|
data/CHANGELOG.md
CHANGED
@@ -9,6 +9,40 @@ 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
|
+
## [2.5.3] (2021-06-16)
|
13
|
+
|
14
|
+
### Fixed
|
15
|
+
|
16
|
+
- Fix decompress png error (mostly because of it is a normal png file) [#32](https://github.com/icyleaf/app_info/pull/32) thanks @[莫小七](https://github.com/mxq0923)
|
17
|
+
|
18
|
+
## [2.5.2] (2021-04-15)
|
19
|
+
|
20
|
+
### Fixed
|
21
|
+
|
22
|
+
- Fix handle get Android application name from manifest first [#29](https://github.com/icyleaf/app_info/issues/29) thanks @[DreamPWJ](https://github.com/DreamPWJ)
|
23
|
+
|
24
|
+
## [2.5.1] (2021-04-14)
|
25
|
+
|
26
|
+
### Add
|
27
|
+
|
28
|
+
- Restore `dimensions` key from icons method and icon pnguncrush back.
|
29
|
+
|
30
|
+
## [2.4.3] (2021-04-12)
|
31
|
+
|
32
|
+
### Fixed
|
33
|
+
|
34
|
+
- Fix throws an exception 'IHDR not in place for PNG' during parse ipa file.
|
35
|
+
|
36
|
+
### Changed
|
37
|
+
|
38
|
+
- Temporary remove `dimensions` key from icons method (Only ipa file)
|
39
|
+
|
40
|
+
## [2.4.2] (2021-04-06)
|
41
|
+
|
42
|
+
### Changed
|
43
|
+
|
44
|
+
- Remove [pngdefry](https://github.com/soffes/pngdefry) gem, install it to decode iOS png file if needs.
|
45
|
+
|
12
46
|
## [2.4.1] (2021-03-08)
|
13
47
|
|
14
48
|
### Changed
|
@@ -102,8 +136,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
102
136
|
|
103
137
|
- Updated dependency of CFPropertly list be a range between 2.3.4. (thanks @[cschroed](https://github.com/cschroed))
|
104
138
|
|
105
|
-
[Unreleased]: https://github.com/icyleaf/app-info/compare/v2.
|
106
|
-
[2.2
|
139
|
+
[Unreleased]: https://github.com/icyleaf/app-info/compare/v2.5.2..HEAD
|
140
|
+
[2.5.2]: https://github.com/icyleaf/app-info/compare/v2.5.1...v2.5.2
|
141
|
+
[2.5.1]: https://github.com/icyleaf/app-info/compare/v2.4.3...v2.5.1
|
142
|
+
[2.4.3]: https://github.com/icyleaf/app-info/compare/v2.4.2...v2.4.3
|
143
|
+
[2.4.2]: https://github.com/icyleaf/app-info/compare/v2.4.1...v2.4.2
|
144
|
+
[2.4.1]: https://github.com/icyleaf/app-info/compare/v2.3.0...v2.4.1
|
145
|
+
[2.3.0]: https://github.com/icyleaf/app-info/compare/v2.2.0...v2.3.0
|
107
146
|
[2.2.0]: https://github.com/icyleaf/app-info/compare/v2.1.4...v2.2.0
|
108
147
|
[2.1.4]: https://github.com/icyleaf/app-info/compare/v2.1.3...v2.1.4
|
109
148
|
[2.1.3]: https://github.com/icyleaf/app-info/compare/v2.1.2...v2.1.3
|
data/README.md
CHANGED
@@ -82,7 +82,7 @@ ipa.bundle_id
|
|
82
82
|
|
83
83
|
# get app icons
|
84
84
|
ipa.icons
|
85
|
-
# => [{:name=>"AppIcon29x29@2x~ipad.png", :file=>"/var/folders/mb/8cm0fz4d499968yss9y1j8bc0000gp/T/d20160728-69669-1xnub30/AppInfo-ios-a5369339399e62046d7d59c52254dac6/Payload/bundle.app/AppIcon29x29@2x~ipad.png", :dimensions=>[
|
85
|
+
# => [{:name=>"AppIcon29x29@2x~ipad.png", :file=>"/var/folders/mb/8cm0fz4d499968yss9y1j8bc0000gp/T/d20160728-69669-1xnub30/AppInfo-ios-a5369339399e62046d7d59c52254dac6/Payload/bundle.app/AppIcon29x29@2x~ipad.png"}, :dimensions=>[29, 29], :uncrushed_file=>"..." ...]
|
86
86
|
|
87
87
|
# get provisioning profile devices
|
88
88
|
ipa.devices
|
@@ -239,6 +239,11 @@ apk.tv?
|
|
239
239
|
apk.wear?
|
240
240
|
```
|
241
241
|
|
242
|
+
## Best Practice
|
243
|
+
|
244
|
+
- [fastlane-plugin-app_info](https://github.com/icyleaf/fastlane-plugin-app_info): fastlane plugin
|
245
|
+
- [zealot](https://github.com/tryzealot/zealot/): Over The Air Server for deployment of Android and iOS apps
|
246
|
+
|
242
247
|
## Development
|
243
248
|
|
244
249
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -247,7 +252,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
247
252
|
|
248
253
|
## Contributing
|
249
254
|
|
250
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
255
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/icyleaf/app-info. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
251
256
|
|
252
257
|
## License
|
253
258
|
|
data/app_info.gemspec
CHANGED
@@ -21,7 +21,6 @@ Gem::Specification.new do |spec|
|
|
21
21
|
|
22
22
|
spec.add_dependency 'CFPropertyList', ['< 3.1.0', '>= 2.3.4']
|
23
23
|
spec.add_dependency 'image_size', '>= 1.5', '< 2.2'
|
24
|
-
spec.add_dependency 'pngdefry', '~> 0.1.2'
|
25
24
|
spec.add_dependency 'ruby-macho', '~> 2.2.0'
|
26
25
|
spec.add_dependency 'ruby_android', '~> 0.7.7'
|
27
26
|
spec.add_dependency 'rubyzip', '>= 1.2', '< 3.0'
|
data/lib/app_info/apk.rb
CHANGED
data/lib/app_info/ipa.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'cfpropertylist'
|
4
|
+
require 'app_info/png_uncrush'
|
4
5
|
require 'app_info/util'
|
5
6
|
|
6
7
|
module AppInfo
|
@@ -42,7 +43,7 @@ module AppInfo
|
|
42
43
|
info.try(:[], 'MinimumOSVersion')
|
43
44
|
end
|
44
45
|
|
45
|
-
def icons
|
46
|
+
def icons(uncrush = true)
|
46
47
|
return @icons if @icons
|
47
48
|
|
48
49
|
@icons = []
|
@@ -55,13 +56,7 @@ module AppInfo
|
|
55
56
|
|
56
57
|
icon_array.each do |items|
|
57
58
|
Dir.glob(File.join(@app_path, "#{items}*")).find_all.each do |file|
|
58
|
-
|
59
|
-
name: File.basename(file),
|
60
|
-
file: file,
|
61
|
-
dimensions: Pngdefry.dimensions(file)
|
62
|
-
}
|
63
|
-
|
64
|
-
@icons.push(dict)
|
59
|
+
@icons << icon_info(file, uncrush)
|
65
60
|
end
|
66
61
|
end
|
67
62
|
end
|
@@ -121,6 +116,25 @@ module AppInfo
|
|
121
116
|
|
122
117
|
private
|
123
118
|
|
119
|
+
def icon_info(file, uncrush = true)
|
120
|
+
uncrushed_file = nil
|
121
|
+
if uncrush
|
122
|
+
path = File.join(File.dirname(file), 'uncrushed')
|
123
|
+
Dir.mkdir(path, 0700) unless Dir.exist?(path)
|
124
|
+
|
125
|
+
uncrushed_file = File.join(path, File.basename(file))
|
126
|
+
PngUncrush.decompress(file, uncrushed_file)
|
127
|
+
uncrushed_file = nil unless File.exists?(uncrushed_file)
|
128
|
+
end
|
129
|
+
|
130
|
+
{
|
131
|
+
name: File.basename(file),
|
132
|
+
file: file,
|
133
|
+
uncrushed_file: uncrushed_file,
|
134
|
+
dimensions: PngUncrush.dimensions(file)
|
135
|
+
}
|
136
|
+
end
|
137
|
+
|
124
138
|
def info
|
125
139
|
return unless File.file?(info_path)
|
126
140
|
|
@@ -0,0 +1,181 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright @ Wenwei Cai on 26 Aug 2012.
|
4
|
+
# https://github.com/swcai/iphone-png-normalizer
|
5
|
+
|
6
|
+
require 'zlib'
|
7
|
+
require 'stringio'
|
8
|
+
|
9
|
+
module AppInfo
|
10
|
+
class PngUncrush
|
11
|
+
class Error < StandardError; end
|
12
|
+
class FormatError < Error; end
|
13
|
+
|
14
|
+
class PngReader # :nodoc:
|
15
|
+
PNG_HEADER = "\x89PNG\r\n\x1a\n".bytes
|
16
|
+
CHUNK = 1024
|
17
|
+
|
18
|
+
attr_reader :data
|
19
|
+
|
20
|
+
def initialize(raw)
|
21
|
+
@io = if raw.is_a?(String)
|
22
|
+
StringIO.new(raw)
|
23
|
+
elsif raw.respond_to?(:read) && raw.respond_to?(:eof?)
|
24
|
+
raw
|
25
|
+
else
|
26
|
+
raise ArgumentError, "expected data as String or an object responding to read, got #{raw.class}"
|
27
|
+
end
|
28
|
+
|
29
|
+
@data = String.new
|
30
|
+
end
|
31
|
+
|
32
|
+
def size
|
33
|
+
@io.size
|
34
|
+
end
|
35
|
+
|
36
|
+
def unpack(a)
|
37
|
+
@io.unpack(a)
|
38
|
+
end
|
39
|
+
|
40
|
+
def header
|
41
|
+
@header ||= self[0, 8]
|
42
|
+
end
|
43
|
+
|
44
|
+
def png?
|
45
|
+
PNG_HEADER == header.bytes
|
46
|
+
end
|
47
|
+
|
48
|
+
def [](offset, length)
|
49
|
+
while !@io.eof? && @data.length < offset + length
|
50
|
+
data = @io.read(CHUNK)
|
51
|
+
break unless data
|
52
|
+
|
53
|
+
data.force_encoding(@data.encoding) if data.respond_to?(:encoding)
|
54
|
+
@data << data
|
55
|
+
end
|
56
|
+
|
57
|
+
@data[offset, length]
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.decompress(input, output)
|
62
|
+
new(input).decompress(output)
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.dimensions(input)
|
66
|
+
new(input).dimensions
|
67
|
+
end
|
68
|
+
|
69
|
+
def initialize(filename)
|
70
|
+
@io = PngReader.new(File.open(filename))
|
71
|
+
raise FormatError, 'not a png file' unless @io.png?
|
72
|
+
end
|
73
|
+
|
74
|
+
def dimensions
|
75
|
+
_dump_sections(dimensions: true)
|
76
|
+
end
|
77
|
+
|
78
|
+
def decompress(output)
|
79
|
+
content = _remap(_dump_sections)
|
80
|
+
return false unless content
|
81
|
+
|
82
|
+
write_file(output, content)
|
83
|
+
rescue Zlib::DataError
|
84
|
+
# perhops thi is a normal png image file
|
85
|
+
return false
|
86
|
+
end
|
87
|
+
|
88
|
+
private
|
89
|
+
|
90
|
+
def _dump_sections(dimensions: false)
|
91
|
+
pos = @io.header.size
|
92
|
+
optimized = false
|
93
|
+
[].tap do |sections|
|
94
|
+
while pos < @io.size
|
95
|
+
type = @io[pos + 4, 4]
|
96
|
+
length = @io[pos, 4].unpack('N')[0]
|
97
|
+
data = @io[pos + 8, length]
|
98
|
+
crc = @io[pos + 8 + length, 4].unpack('N')[0]
|
99
|
+
pos += length + 12
|
100
|
+
|
101
|
+
if type == 'CgBI'
|
102
|
+
optimized = true
|
103
|
+
next
|
104
|
+
end
|
105
|
+
|
106
|
+
if type == 'IHDR'
|
107
|
+
width = data[0, 4].unpack("N")[0]
|
108
|
+
height = data[4, 4].unpack("N")[0]
|
109
|
+
return [width, height] if dimensions
|
110
|
+
end
|
111
|
+
|
112
|
+
break if type == 'IEND'
|
113
|
+
|
114
|
+
if type == 'IDAT' && sections.size > 0 && sections.last.first == 'IDAT'
|
115
|
+
# Append to the previous IDAT
|
116
|
+
sections.last[1] += length
|
117
|
+
sections.last[2] += data
|
118
|
+
else
|
119
|
+
sections << [type, length, data, crc, width, height]
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def write_file(path, content)
|
126
|
+
File.open(path, 'wb') do |file|
|
127
|
+
file.puts content
|
128
|
+
end
|
129
|
+
|
130
|
+
true
|
131
|
+
end
|
132
|
+
|
133
|
+
def _remap(sections)
|
134
|
+
newPNG = String.new(@io.header)
|
135
|
+
sections.map do |(type, length, data, crc, width, height)|
|
136
|
+
if type == 'IDAT'
|
137
|
+
bufSize = width * height * 4 + height
|
138
|
+
data = inflate(data[0, bufSize])
|
139
|
+
# duplicate the content of old data at first to avoid creating too many string objects
|
140
|
+
newdata = String.new(data)
|
141
|
+
pos = 0
|
142
|
+
|
143
|
+
(0...height).each do |y|
|
144
|
+
newdata[pos] = data[pos, 1]
|
145
|
+
pos += 1
|
146
|
+
(0...width).each do |x|
|
147
|
+
newdata[pos+0] = data[pos+2, 1]
|
148
|
+
newdata[pos+1] = data[pos+1, 1]
|
149
|
+
newdata[pos+2] = data[pos+0, 1]
|
150
|
+
newdata[pos+3] = data[pos+3, 1]
|
151
|
+
pos += 4
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
data = deflate(newdata)
|
156
|
+
length = data.length
|
157
|
+
crc = Zlib::crc32(type)
|
158
|
+
crc = Zlib::crc32(data, crc)
|
159
|
+
crc = (crc + 0x100000000) % 0x100000000
|
160
|
+
end
|
161
|
+
|
162
|
+
newPNG += [length].pack("N") + type + (data if length > 0) + [crc].pack("N")
|
163
|
+
end
|
164
|
+
|
165
|
+
newPNG
|
166
|
+
end
|
167
|
+
|
168
|
+
def inflate(data)
|
169
|
+
# make zlib not check the header
|
170
|
+
zstream = Zlib::Inflate.new(-Zlib::MAX_WBITS)
|
171
|
+
buf = zstream.inflate(data)
|
172
|
+
zstream.finish
|
173
|
+
zstream.close
|
174
|
+
buf
|
175
|
+
end
|
176
|
+
|
177
|
+
def deflate(data)
|
178
|
+
Zlib::Deflate.deflate(data)
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
data/lib/app_info/util.rb
CHANGED
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.
|
4
|
+
version: 2.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- icyleaf
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: CFPropertyList
|
@@ -50,20 +50,6 @@ dependencies:
|
|
50
50
|
- - "<"
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: '2.2'
|
53
|
-
- !ruby/object:Gem::Dependency
|
54
|
-
name: pngdefry
|
55
|
-
requirement: !ruby/object:Gem::Requirement
|
56
|
-
requirements:
|
57
|
-
- - "~>"
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
version: 0.1.2
|
60
|
-
type: :runtime
|
61
|
-
prerelease: false
|
62
|
-
version_requirements: !ruby/object:Gem::Requirement
|
63
|
-
requirements:
|
64
|
-
- - "~>"
|
65
|
-
- !ruby/object:Gem::Version
|
66
|
-
version: 0.1.2
|
67
53
|
- !ruby/object:Gem::Dependency
|
68
54
|
name: ruby-macho
|
69
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -203,6 +189,7 @@ files:
|
|
203
189
|
- lib/app_info/ipa/info_plist.rb
|
204
190
|
- lib/app_info/ipa/mobile_provision.rb
|
205
191
|
- lib/app_info/ipa/plugin.rb
|
192
|
+
- lib/app_info/png_uncrush.rb
|
206
193
|
- lib/app_info/proguard.rb
|
207
194
|
- lib/app_info/util.rb
|
208
195
|
- lib/app_info/version.rb
|