app-info 2.5.4 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b79b22cebadeb4bb9b7f0a2febe6d996cb47b7a399bc0d25fa2132c1b7a260f9
4
- data.tar.gz: 87547d3dba6b1972a5875d0e3daf269b3e0d694b9a852caf8f99bbdd2336b715
3
+ metadata.gz: c3f41cd5992337273a19a91e968dcae822aac9e4e022368e02d0d2a262394898
4
+ data.tar.gz: 1b0f8391aa791da7d9138ecd50727c8f9afe150f8834af600ff571b812e5f29d
5
5
  SHA512:
6
- metadata.gz: 468aedb4563c48b03a0e9e2a58bb7191f69168c46cad443d8f0e9ab01d5114d19b205d25e111a481119b5510b337208475e15cfb1c09106fde48d287c7b65cfe
7
- data.tar.gz: 567e84b8577840273235212c3c1d03f9861f3c674adcd52017c54266304dd7510dbed41913c89cbb2d228fdb6a6541ed1438c4ea9b3a83de61411c3014e6cc02
6
+ metadata.gz: fa7c8b0ae2e4493eac060411fdb1ea9b34d948a4d2c2bdf74431d43723b29e4f47879aec62cf456a41798f46df16cd4dcf1e6f4c1419aee373395a746c82372e
7
+ data.tar.gz: 6b5263c1b0a2d145002cb19a410c06de2f659c5f88e9cdb76d83e7739263adb4226b293e231c09daeb7a8ca0a82839d97457c99c288650bcf39ce218d6320ebe
@@ -0,0 +1,9 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: "/"
5
+ schedule:
6
+ interval: daily
7
+ time: "21:00"
8
+ timezone: Asia/Shanghai
9
+ open-pull-requests-limit: 10
@@ -0,0 +1,41 @@
1
+ name: CI
2
+ on:
3
+ push:
4
+ branches:
5
+ - master
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ${{ matrix.os }}
11
+
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ ruby: [ ruby-2.5, ruby-2.6, ruby-2.7, ruby-3.0 ]
16
+ os: [ ubuntu-latest ]
17
+
18
+ steps:
19
+ - uses: actions/checkout@v2
20
+
21
+ - uses: ruby/setup-ruby@v1
22
+ with:
23
+ ruby-version: ${{ matrix.ruby }}
24
+ bundler-cache: true
25
+
26
+ - name: bundle exec rspec
27
+ run: bundle exec rspec --format progress --force-colour
28
+
29
+ lint:
30
+ runs-on: ubuntu-latest
31
+
32
+ steps:
33
+ - uses: actions/checkout@v2
34
+
35
+ - uses: ruby/setup-ruby@v1
36
+ with:
37
+ ruby-version: 2.7
38
+ bundler-cache: true
39
+
40
+ - name: bundle exec rubocop
41
+ run: bundle exec rubocop --format progress --color
data/.rubocop.yml CHANGED
@@ -9,22 +9,35 @@
9
9
  #
10
10
  # See https://github.com/rubocop-hq/rubocop/blob/master/manual/configuration.md
11
11
 
12
+ inherit_mode:
13
+ merge:
14
+ - Exclude
15
+
12
16
  AllCops:
13
- TargetRubyVersion: 2.3
17
+ TargetRubyVersion: 2.7
18
+ NewCops: enable
19
+ SuggestExtensions: false
14
20
  Exclude:
15
- - 'spec/**/*'
16
- - 'Rakefile'
17
- - 'app_info.gemspec'
18
- - 'lib/app-info.rb'
21
+ - 'bin/*'
22
+ - 'spec/**/*'
23
+ - vendor/bundle/**/*
24
+ - 'Rakefile'
25
+ - 'app_info.gemspec'
26
+ - 'lib/app-info.rb'
19
27
 
20
28
  Metrics/AbcSize:
21
29
  Max: 100
22
30
 
23
31
  Metrics/BlockLength:
24
32
  Max: 35
33
+ Exclude:
34
+ - 'lib/app_info/mobile_provision.rb'
25
35
 
26
36
  Metrics/MethodLength:
27
37
  Max: 20
38
+ Exclude:
39
+ - 'lib/app_info/png_uncrush.rb'
40
+ - 'lib/app_info/mobile_provision.rb'
28
41
 
29
42
  Layout/LineLength:
30
43
  Max: 100
@@ -34,7 +47,13 @@ Metrics/ClassLength:
34
47
  Max: 300
35
48
 
36
49
  Metrics/CyclomaticComplexity:
37
- Max: 10
50
+ Enabled: false
38
51
 
39
- Style/Documentation:
52
+ Metrics/PerceivedComplexity:
53
+ Max: 18
54
+
55
+ Lint/AssignmentInCondition:
40
56
  Enabled: false
57
+
58
+ Style/Documentation:
59
+ Enabled: false
data/CHANGELOG.md CHANGED
@@ -9,6 +9,31 @@ 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.6.0] (2021-08-24)
13
+
14
+ ### Changed
15
+
16
+ - [breaking changes] Dropped Ruby 2.3, 2.4
17
+ - [breaking changes] get all parser size with human reable changes to keyword arguments
18
+ - Rewrite InfoPlist parser
19
+ - iOS framework and plugin array sortted by ASC
20
+ - Move CI to Github Action
21
+
22
+ ### Added
23
+
24
+ - macOS App parser support [#34](https://github.com/icyleaf/app_info/pull/34)
25
+ - CLI shell mode support
26
+
27
+ ### Fixed
28
+
29
+ - Ruby 3.0 support
30
+
31
+ ## [2.5.4] (2021-07-08)
32
+
33
+ ### Fixed
34
+
35
+ - Make `ruby-macho` version match a range between 1.4 and 3.
36
+
12
37
  ## [2.5.3] (2021-06-16)
13
38
 
14
39
  ### Fixed
@@ -136,7 +161,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
136
161
 
137
162
  - Updated dependency of CFPropertly list be a range between 2.3.4. (thanks @[cschroed](https://github.com/cschroed))
138
163
 
139
- [Unreleased]: https://github.com/icyleaf/app-info/compare/v2.5.2..HEAD
164
+ [Unreleased]: https://github.com/icyleaf/app-info/compare/v2.6.0..HEAD
165
+ [2.6.0]: https://github.com/icyleaf/app-info/compare/v2.5.4...v2.6.0
166
+ [2.5.4]: https://github.com/icyleaf/app-info/compare/v2.5.3...v2.5.4
167
+ [2.5.3]: https://github.com/icyleaf/app-info/compare/v2.5.2...v2.5.3
140
168
  [2.5.2]: https://github.com/icyleaf/app-info/compare/v2.5.1...v2.5.2
141
169
  [2.5.1]: https://github.com/icyleaf/app-info/compare/v2.4.3...v2.5.1
142
170
  [2.4.3]: https://github.com/icyleaf/app-info/compare/v2.4.2...v2.4.3
data/Gemfile CHANGED
@@ -5,6 +5,8 @@ source 'https://rubygems.org'
5
5
  # Specify your gem's dependencies in app-info.gemspec
6
6
  gemspec
7
7
 
8
- gem 'awesome_print'
9
- gem 'debase'
10
- gem 'ruby-debug-ide'
8
+ group :development do
9
+ gem 'awesome_print'
10
+ gem 'debase'
11
+ gem 'ruby-debug-ide'
12
+ end
data/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  # app_info
2
2
 
3
- [![Language](https://img.shields.io/badge/ruby-2.3+-701516.svg)](.travis.yml)
4
- [![Build Status](https://travis-ci.org/icyleaf/app_info.svg?branch=master)](https://travis-ci.org/icyleaf/app_info)
3
+ [![Language](https://img.shields.io/badge/ruby-2.5+-701516.svg)](.github/workflows/ci.yml)
4
+ [![Build Status](https://img.shields.io/github/workflow/status/icyleaf/app_info/CI)](https://github.com/icyleaf/app_info/actions/workflows/ci.yml)
5
5
  [![Gem version](https://img.shields.io/gem/v/app-info.svg?style=flat)](https://rubygems.org/gems/app_info)
6
6
  [![License](https://img.shields.io/badge/license-MIT-red.svg?style=flat)](LICENSE)
7
7
 
8
- Teardown tool for mobile app(ipa/apk) and dSYM.zip file, analysis metedata like version, name, icon etc.
8
+ Teardown tool for mobile(ipa/apk) app, macOS app and dSYM.zip file, analysis metedata like version, name, icon etc.
9
9
 
10
10
  ## Support
11
11
 
@@ -13,6 +13,7 @@ Teardown tool for mobile app(ipa/apk) and dSYM.zip file, analysis metedata like
13
13
  - iOS ipa file
14
14
  - Info.plist file
15
15
  - .mobileprovision/.provisionprofile file
16
+ - macOS App(.zip) file
16
17
  - dSYM(.zip) file
17
18
 
18
19
  ## Installation
@@ -47,13 +48,15 @@ parser = AppInfo.parse('iphone.ipa')
47
48
  parser = AppInfo.parse('ipad.ipa')
48
49
  parser = AppInfo.parse('android.apk')
49
50
  parser = AppInfo.parse('u-u-i-d.mobileprovision')
51
+ parser = AppInfo.parse('macOS.App.zip')
50
52
  parser = AppInfo.parse('App.dSYm.zip')
51
53
 
52
54
  # If detect file type failed, you can parse in other way
53
55
  parser = AppInfo::IPA.new('iphone.ipa')
54
56
  parser = AppInfo::APK.new('android.apk')
55
- parser = AppInfo::InfoPlist.new('App/Info.plist')
56
- parser = AppInfo::MobileProvision.new('provisioning_profile/uuid.mobileprovision')
57
+ parser = AppInfo::InfoPlist.new('Info.plist')
58
+ parser = AppInfo::MobileProvision.new('uuid.mobileprovision')
59
+ parser = AppInfo::Macos.new('App.dSYm.zip')
57
60
  parser = AppInfo::DSYM.new('App.dSYm.zip')
58
61
  ```
59
62
 
@@ -69,7 +72,7 @@ ipa.size
69
72
  # => 3093823
70
73
 
71
74
  # get app file size in human reable.
72
- ipa.size(true)
75
+ ipa.size(human_size: true)
73
76
  # => 29 MB
74
77
 
75
78
  # get app release version
@@ -80,9 +83,9 @@ ipa.release_version
80
83
  ipa.bundle_id
81
84
  # => com.icyleaf.AppInfoDemo
82
85
 
83
- # get app icons
86
+ # get app icons (uncrushed png by default)
84
87
  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=>[29, 29], :uncrushed_file=>"..." ...]
88
+ # => [{:name=>"AppIcon29x29@2x~ipad.png", :file=>"temp/dir/app/AppIcon29x29@2x~ipad.png"}, :dimensions=>[29, 29], :uncrushed_file=>"..." ...]
86
89
 
87
90
  # get provisioning profile devices
88
91
  ipa.devices
@@ -145,46 +148,6 @@ profile.enabled_capabilities
145
148
  # => ['Apple Pay', 'iCloud', 'Sign In with Apple', ...]
146
149
  ```
147
150
 
148
- ### dSYM
149
-
150
- ```ruby
151
- dsym = AppInfo.parse('ios.dSYM.zip')
152
-
153
- # get object name
154
- dsym.object
155
- # => iOS
156
-
157
- # get macho size
158
- dsym.machos.size
159
- # => 1 or 2
160
-
161
- dsym.machos.each do |macho|
162
- # get cpu type
163
- macho.cpu_type
164
- # => :arm
165
-
166
- # get cpu name
167
- macho.cpu_name
168
- # => armv7
169
-
170
- # get UUID (debug id)
171
- macho.uuid
172
- # => 26dfc15d-bdce-351f-b5de-6ee9f5dd6d85
173
-
174
- # get macho size
175
- macho.size
176
- # => 866526
177
-
178
- # get macho size in human reable.
179
- macho.size(true)
180
- # => 862 KB
181
-
182
- # dump data to Hash
183
- macho.to_h
184
- # => {uuid:"26dfc15d-bdce-351f-b5de-6ee9f5dd6d85", cpu_type: :arm, cpu_name: :armv7, ...}
185
- end
186
- ```
187
-
188
151
  ### Android
189
152
 
190
153
  ```ruby
@@ -195,7 +158,7 @@ apk.size
195
158
  # => 3093823
196
159
 
197
160
  # get app file size in human reable.
198
- apk.size(true)
161
+ apk.size(human_size: true)
199
162
  # => 29 MB
200
163
 
201
164
  # get app release version
@@ -208,7 +171,7 @@ apk.bundle_id
208
171
 
209
172
  # get app icons
210
173
  apk.icons
211
- # => [{:name=>"ic_launcher.png", :file=> "/var/folders/mb/8cm0fz4d499968yss9y1j8bc0000gp/T/d20160728-70163-10d47fl/AppInfo-android-cccbf89a889eb592c5c6f342d56b9a49/res/mipmap-mdpi-v4/ic_launcher.png/ic_launcher.png", :dimensions=>[48, 48]}, ...]
174
+ # => [{:name=>"ic_launcher.png", :file=> "/temp/dir/app/ic_launcher.png", :dimensions=>[48, 48]}, ...]
212
175
 
213
176
  # get app support min sdk version
214
177
  apk.min_sdk_version
@@ -239,6 +202,103 @@ apk.tv?
239
202
  apk.wear?
240
203
  ```
241
204
 
205
+ ### macOS
206
+
207
+ Only accept zipped macOS file.
208
+
209
+ ```ruby
210
+ macos = AppInfo.parse('macos_app.zip')
211
+
212
+ # get app file size
213
+ macos.size
214
+ # => 3093823
215
+
216
+ # get app file size in human reable.
217
+ macos.size(human_size: true)
218
+ # => 29 MB
219
+
220
+ # get app release version
221
+ macos.release_version
222
+ # => 1.0
223
+
224
+ # get app bundle id
225
+ macos.bundle_id
226
+ # => com.icyleaf.AppInfoDemo
227
+
228
+ # Get minimize os version
229
+ macos.min_os_version
230
+ # => 11.3
231
+
232
+ # get app icons(convertd icns to png icon sets by default)
233
+ macos.icons
234
+ # => [{:name=>"AppIcon.icns", :file=>"/temp/dir/app/AppIcon.icns"}, :sets=>[{:name=>"64x64_AppIcon.png", :file=>"/temp/dir/app/64x64_AppIcon.png", :dimensions=>[64, 64]}, ...]
235
+
236
+ # detect publish on mac app store
237
+ macos.stored?
238
+ # => true/false
239
+
240
+ # detect architecture(s)
241
+ macos.archs
242
+ # => [:x86_64, :arm64]
243
+
244
+ # get more propety in Info.plist
245
+ macos.info[:CFBundleDisplayName]
246
+ # => 'AppInfoDemo'
247
+ ```
248
+
249
+ ### dSYM
250
+
251
+ ```ruby
252
+ dsym = AppInfo.parse('ios.dSYM.zip')
253
+
254
+ # get object name
255
+ dsym.object
256
+ # => iOS
257
+
258
+ # get total count of macho
259
+ dsym.machos.count
260
+ # => 1 or 2
261
+
262
+ dsym.machos.each do |macho|
263
+ # get cpu type
264
+ macho.cpu_type
265
+ # => :arm
266
+
267
+ # get cpu name
268
+ macho.cpu_name
269
+ # => armv7
270
+
271
+ # get UUID (debug id)
272
+ macho.uuid
273
+ # => 26dfc15d-bdce-351f-b5de-6ee9f5dd6d85
274
+
275
+ # get macho size
276
+ macho.size
277
+ # => 866526
278
+
279
+ # get macho size in human reable.
280
+ macho.size(human_size: true)
281
+ # => 862 KB
282
+
283
+ # dump data to Hash
284
+ macho.to_h
285
+ # => {uuid:"26dfc15d-bdce-351f-b5de-6ee9f5dd6d85", cpu_type: :arm, cpu_name: :armv7, ...}
286
+ end
287
+ ```
288
+
289
+ ## CLI Shell (Interactive console)
290
+
291
+ It is possible to use this gem as a command line interface to parse mobile app:
292
+
293
+ ```
294
+ > app-info
295
+
296
+ app-info (0.6.0)> p = AppInfo.parse('/path/to/app')
297
+ => #<AppInfo::APK::......>
298
+ app-info (0.6.0)> p.name
299
+ => "AppName"
300
+ ```
301
+
242
302
  ## Best Practice
243
303
 
244
304
  - [fastlane-plugin-app_info](https://github.com/icyleaf/fastlane-plugin-app_info): fastlane plugin
data/app_info.gemspec CHANGED
@@ -15,9 +15,10 @@ Gem::Specification.new do |spec|
15
15
  spec.homepage = 'http://github.com/icyleaf/app-info'
16
16
  spec.license = 'MIT'
17
17
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = 'exe'
18
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
20
  spec.require_paths = ['lib']
20
- spec.required_ruby_version = '>= 2.3'
21
+ spec.required_ruby_version = '>= 2.5'
21
22
 
22
23
  spec.add_dependency 'CFPropertyList', '< 3.1.0', '>= 2.3.4'
23
24
  spec.add_dependency 'image_size', '>= 1.5', '< 2.2'
@@ -25,8 +26,10 @@ Gem::Specification.new do |spec|
25
26
  spec.add_dependency 'ruby_android', '~> 0.7.7'
26
27
  spec.add_dependency 'rubyzip', '>= 1.2', '< 3.0'
27
28
  spec.add_dependency 'uuidtools', '>= 2.1.5', '< 2.3.0'
29
+ spec.add_dependency 'icns', '~> 0.2.0'
28
30
 
29
31
  spec.add_development_dependency 'bundler', '>= 1.12'
30
32
  spec.add_development_dependency 'rake', '>= 10.0'
31
33
  spec.add_development_dependency 'rspec', '~> 3.0'
34
+ spec.add_development_dependency 'rubocop', '~> 1.19'
32
35
  end
data/exe/app-info ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ $LOAD_PATH.unshift File.expand_path('../lib', __dir__)
5
+
6
+ # Exit cleanly from an early interrupt
7
+ Signal.trap('INT') { exit 1 }
8
+
9
+ require 'app_info'
10
+ require 'app_info/shell'
11
+
12
+ AppInfo::Shell.run
data/lib/app_info/apk.rb CHANGED
@@ -3,7 +3,6 @@
3
3
  require 'ruby_apk'
4
4
  require 'image_size'
5
5
  require 'forwardable'
6
- require 'app_info/util'
7
6
 
8
7
  module AppInfo
9
8
  # Parse APK file
@@ -24,8 +23,8 @@ module AppInfo
24
23
  @file = file
25
24
  end
26
25
 
27
- def size(humanable = false)
28
- AppInfo::Util.file_size(@file, humanable)
26
+ def size(human_size: false)
27
+ AppInfo::Util.file_size(@file, human_size)
29
28
  end
30
29
 
31
30
  def os
@@ -110,29 +109,23 @@ module AppInfo
110
109
  end
111
110
 
112
111
  def apk
113
- Zip.warn_invalid_date = false # fix invaild date format warnings
114
-
115
112
  @apk ||= ::Android::Apk.new(@file)
116
113
  end
117
114
 
118
115
  def icons
119
- unless @icons
120
- @icons = apk.icon.each_with_object([]) do |(path, data), obj|
121
- icon_name = File.basename(path)
122
- icon_path = File.join(contents, File.dirname(path))
123
- icon_file = File.join(icon_path, icon_name)
124
- FileUtils.mkdir_p icon_path
125
- File.open(icon_file, 'wb') { |f| f.write(data) }
126
-
127
- obj << {
128
- name: icon_name,
129
- file: icon_file,
130
- dimensions: ImageSize.path(icon_file).size
131
- }
132
- end
116
+ @icons ||= apk.icon.each_with_object([]) do |(path, data), obj|
117
+ icon_name = File.basename(path)
118
+ icon_path = File.join(contents, File.dirname(path))
119
+ icon_file = File.join(icon_path, icon_name)
120
+ FileUtils.mkdir_p icon_path
121
+ File.open(icon_file, 'wb') { |f| f.write(data) }
122
+
123
+ obj << {
124
+ name: icon_name,
125
+ file: icon_file,
126
+ dimensions: ImageSize.path(icon_file).size
127
+ }
133
128
  end
134
-
135
- @icons
136
129
  end
137
130
 
138
131
  def clear!
@@ -164,6 +157,7 @@ module AppInfo
164
157
  # Android Certificate
165
158
  class Certificate
166
159
  attr_reader :path, :certificate
160
+
167
161
  def initialize(path, certificate)
168
162
  @path = path
169
163
  @certificate = certificate
@@ -173,6 +167,7 @@ module AppInfo
173
167
  # Android Sign
174
168
  class Sign
175
169
  attr_reader :path, :sign
170
+
176
171
  def initialize(path, sign)
177
172
  @path = path
178
173
  @sign = sign