fastlane-plugin-app_info 0.2.0 → 0.5.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: b788b8b56afc93ec405d1d2d538010f4579f272e
4
- data.tar.gz: 9921dc1352fa525c368448a361e15700efebf75b
2
+ SHA256:
3
+ metadata.gz: ec6c3be09ebd56b7d1a41d93d2db25dc1621342b1fb4e377340d7207622730f2
4
+ data.tar.gz: 4f4c9874d37aca154f5fee52723a43959ecb3a49c7592cf82064d1e271750924
5
5
  SHA512:
6
- metadata.gz: cd453c003f402e9af916e800a5ceba14f755697f4fe15b6202d2736bf17cddb1bbfd049857b3630a61c0659c757d21dd6c1cf1dcd226188c0992f9c399ef01bd
7
- data.tar.gz: d247080aa87eb7635b055a849acdda62170d1184f0052220807a2958f979873d6f6b1dc57bc0d554d236600b9a33d1a527700504189ac994f111ced252bfa00d
6
+ metadata.gz: 04604c168bf9f9afc77953948a96ef86facce874432c9985bd179dd418d351f42ebaab8b460c769966291ca66e84480197c66b595e307be27652a08b5a56a28b
7
+ data.tar.gz: 58695d47494cedc66f5f412fc31c4c7a343fd158fad29f5216528e65d93a5a1b8112039342eb3885f9ac3787c5208988707bcdc8a34b6ef17499a5b9a521ba3d
data/README.md CHANGED
@@ -16,7 +16,8 @@ Teardown tool for mobile app(ipa/apk), analysis metedata like version, name, ico
16
16
 
17
17
  ## Configure
18
18
 
19
- ```+----------------------------------------------------------------------------------------+
19
+ ```
20
+ +----------------------------------------------------------------------------------------+
20
21
  | app_info |
21
22
  +----------------------------------------------------------------------------------------+
22
23
  | Parse and dump mobile app(ipa/apk) metedata. |
@@ -26,23 +27,33 @@ Teardown tool for mobile app(ipa/apk), analysis metedata like version, name, ico
26
27
  | Created by icyleaf <icyleaf.cn@gmail.com> |
27
28
  +----------------------------------------------------------------------------------------+
28
29
 
29
- +------+-------------------------------------------------+---------------+---------+
30
- | app_info Options |
31
- +------+-------------------------------------------------+---------------+---------+
32
- | Key | Description | Env Var | Default |
33
- +------+-------------------------------------------------+---------------+---------+
34
- | file | Path to your ipa/apk file. Optional if you use | APP_INFO_FILE | |
35
- | | the `gym`, `ipa` or `xcodebuild` action. | | |
36
- +------+-------------------------------------------------+---------------+---------+
37
-
38
- +----------+---------------------------------+
39
- | app_info Output Variables |
40
- +----------+---------------------------------+
41
- | Key | Description |
42
- +----------+---------------------------------+
43
- | APP_INFO | the json formated app info data |
44
- +----------+---------------------------------+
45
- Access the output values using `lane_context[SharedValues::VARIABLE_NAME]`
30
+ +-------+---------------------------------+----------------+---------+
31
+ | app_info Options |
32
+ +-------+---------------------------------+----------------+---------+
33
+ | Key | Description | Env Var(s) | Default |
34
+ +-------+---------------------------------+----------------+---------+
35
+ | file | Path to your ipa/apk file. | APP_INFO_FILE | |
36
+ | | Optional if you use the `gym`, | | |
37
+ | | `ipa` or `xcodebuild` action. | | |
38
+ | clean | Clean cache files to reduce | APP_INFO_CLEAN | true |
39
+ | | disk size | | |
40
+ +-------+---------------------------------+----------------+---------+
41
+ * = default value is dependent on the user's system
42
+
43
+ +----------+-----------------------------------------+
44
+ | app_info Output Variables |
45
+ +----------+-----------------------------------------+
46
+ | Key | Description |
47
+ +----------+-----------------------------------------+
48
+ | APP_INFO | The JSON formated metadata of given app |
49
+ +----------+-----------------------------------------+
50
+ Access the output values using `lane_context[SharedValues::APP_INFO]`
51
+
52
+ +-----------------------------------------------+
53
+ | app_info Return Value |
54
+ +-----------------------------------------------+
55
+ | Returns a Hash formated metadata of given app |
56
+ +-----------------------------------------------+
46
57
  ```
47
58
 
48
59
  ## Example
@@ -53,26 +64,30 @@ Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plu
53
64
 
54
65
  ### iOS
55
66
 
56
- ```bash
57
- $ bundle exec fastlane action app_info
67
+ ```text
58
68
  +-----------------------------+-------------------------------------------------+
59
- | Summary for app_info 0.1.0 |
69
+ | Summary for app_info 0.5.0 |
60
70
  +-----------------------------+-------------------------------------------------+
61
- | Name | iOS Team Provisioning Profile: * |
71
+ | OS | iOS |
72
+ | Name | AppInfoDemo |
62
73
  | ReleaseVersion | 1.2.3 |
63
74
  | BuildVersion | 5 |
64
75
  | Identifier | com.icyleaf.AppInfoDemo |
65
- | Os | iOS |
66
- | AppIDName | XC Wildcard |
67
- | ApplicationIdentifierPrefix | ********** |
68
- | CreationDate | 2016-07-27 17:44:49 +0800 |
76
+ | Size | 41.70 KB |
77
+ | DeviceType | iPhone |
78
+ | Releasetype | AdHoc |
79
+ | Archs (2) | armv7 |
80
+ | | arm64 |
81
+ | Appidname | XC Wildcard |
82
+ | Applicationidentifierprefix | 5PJA6N5A3B |
83
+ | Creationdate | 2016-07-27 17:44:49 +0800 |
69
84
  | Platform | iOS |
70
- | Entitlements (4) | keychain-access-groups: ["**********.*"] |
85
+ | Entitlements (4) | keychain-access-groups: ["5PJA6N5A3B.*"] |
71
86
  | | get-task-allow: true |
72
- | | application-identifier: **********.* |
73
- | | com.apple.developer.team-identifier: ********** |
74
- | ExpirationDate | 2017-07-27 17:44:49 +0800 |
75
- | ProvisionedDevices (2) | **************************************** |
87
+ | | application-identifier: 5PJA6N5A3B.* |
88
+ | | com.apple.developer.team-identifier: 5PJA6N5A3B |
89
+ | Expirationdate | 2017-07-27 17:44:49 +0800 |
90
+ | Provisioneddevices (100) | 18cf53cddee60c52f9c97b1521e7cbf8342628da |
76
91
  | | **************************************** |
77
92
  | TeamIdentifier | ********** |
78
93
  | TeamName | EWS Inc |
@@ -84,16 +99,25 @@ $ bundle exec fastlane action app_info
84
99
 
85
100
  ### Android
86
101
 
87
- ```bash
88
- +----------------+-------------------------+
89
- | Summary for app_info 0.1.0 |
90
- +----------------+-------------------------+
91
- | Name | AppInfoDemo |
92
- | ReleaseVersion | 1.2.3 |
93
- | BuildVersion | 5 |
94
- | Identifier | com.icyleaf.appinfodemo |
95
- | Os | Android |
96
- +----------------+-------------------------+
102
+ ```text
103
+ +--------------------+------------------------------+
104
+ | Summary for app_info 0.5.0 |
105
+ +--------------------+------------------------------+
106
+ | OS | Android |
107
+ | Name | AppInfoDemo |
108
+ | ReleaseVersion | 1.2.3 |
109
+ | BuildVersion | 5 |
110
+ | Identifier | com.icyleaf.appinfodemo |
111
+ | Size | 2.93 MB |
112
+ | DeviceType | Phone |
113
+ | Minsdkversion | 14 |
114
+ | Targetsdkversion | 29 |
115
+ | Signatures | META-INF/CERT.RSA |
116
+ | Certificateissuers | CN:Android Debug O:Android |
117
+ | Usepermissions (2) | android.permission.BLUETOOTH |
118
+ | | android.permission.CAMERA |
119
+ | Usefeatures | |
120
+ +--------------------+------------------------------+
97
121
  ```
98
122
 
99
123
  ## Run tests for this plugin
@@ -9,47 +9,25 @@ module Fastlane
9
9
 
10
10
  class AppInfoAction < Action
11
11
  def self.run(params)
12
- @file = params.fetch(:file)
13
- UI.user_error! 'You have to either pass an ipa or an apk file' unless @file
14
- @file = File.expand_path(@file)
15
- @app = ::AppInfo.parse(@file)
16
-
17
- print_table!
18
-
19
- # Store shared value
20
- Helper::AppInfoHelper.store_sharedvalue(:APP_INFO, Helper::AppInfoHelper.app_to_json(@app))
21
- end
22
-
23
- def self.print_table!
24
- params = {}
25
- params[:rows] = table_columns
26
- params[:title] = "Summary for app_info #{AppInfo::VERSION}".green
27
-
28
- puts ""
29
- puts Terminal::Table.new(params)
30
- puts ""
31
- end
32
-
33
- def self.table_columns
34
- common_columns.merge(ios_columns)
12
+ file = params.fetch(:file)
13
+ UI.user_error! 'You have to either pass an ipa or an apk file' unless file
14
+ file = File.expand_path(file)
15
+ app = ::AppInfo.parse(file)
16
+ raw = Helper::AppInfoHelper.raw_data(app)
17
+
18
+ UI.verbose "Raw params: #{raw}"
19
+ print_table(raw)
20
+ app.clear! if params.fetch(:clean)
21
+
22
+ Helper::AppInfoHelper.store_sharedvalue(:APP_INFO, JSON.dump(raw))
23
+ raw
35
24
  end
36
25
 
37
- def self.common_columns
38
- Helper::AppInfoHelper.common_columns.each_with_object({}) do |key, hash|
39
- name = key.split('_').map(&:capitalize).join('')
40
- hash[name] = Helper::AppInfoHelper.object_to_column(@app.send(key.to_sym))
41
- end
42
- end
43
-
44
- def self.ios_columns
45
- return {} unless @app.os == 'iOS' && @app.mobileprovision && !@app.mobileprovision.empty?
46
-
47
- @app.mobileprovision.mobileprovision.each_with_object({}) do |(key, value), hash|
48
- next if key == 'DeveloperCertificates'
49
-
50
- name = Helper::AppInfoHelper.column_name(key, value)
51
- hash[name] = Helper::AppInfoHelper.object_to_column(value)
52
- end
26
+ def self.print_table(raw)
27
+ puts Terminal::Table.new(
28
+ title: "Summary for app_info #{AppInfo::VERSION}".green,
29
+ rows: Helper::AppInfoHelper.hash_to_columns(raw)
30
+ )
53
31
  end
54
32
 
55
33
  def self.description
@@ -64,9 +42,13 @@ module Fastlane
64
42
  "Teardown tool for mobile app(ipa/apk), analysis metedata like version, name, icon etc."
65
43
  end
66
44
 
45
+ def self.return_value
46
+ "Returns a Hash formated metadata of given app"
47
+ end
48
+
67
49
  def self.output
68
50
  [
69
- [SharedValues::APP_INFO.to_s, 'the json formated app info data']
51
+ [SharedValues::APP_INFO.to_s, 'The JSON formated metadata of given app']
70
52
  ]
71
53
  end
72
54
 
@@ -79,7 +61,12 @@ module Fastlane
79
61
  optional: true,
80
62
  verify_block: proc do |value|
81
63
  raise "Couldn't find app file".red unless File.exist?(value)
82
- end)
64
+ end),
65
+ FastlaneCore::ConfigItem.new(key: :clean,
66
+ env_name: 'APP_INFO_CLEAN',
67
+ description: 'Clean cache files to reduce disk size',
68
+ default_value: true,
69
+ optional: true)
83
70
  ]
84
71
  end
85
72
 
@@ -3,6 +3,60 @@ require 'json'
3
3
  module Fastlane
4
4
  module Helper
5
5
  class AppInfoHelper
6
+ COMMON_COLUMNS = %w[os name release_version build_version identifier size device_type]
7
+
8
+ def self.hash_to_columns(raw)
9
+ raw.each_with_object({}) do |(key, value), obj|
10
+ next if value.respond_to?(:empty?) && value.empty?
11
+
12
+ name = upcase(column_name(key, value))
13
+ obj[name] = object_to_column(value)
14
+ end
15
+ end
16
+
17
+ def self.raw_data(app)
18
+ common_columns(app).merge(platform_columns(app))
19
+ end
20
+
21
+ def self.platform_columns(app)
22
+ obj = {}
23
+
24
+ if app.os == 'iOS'
25
+ obj[upcase('release_type')] = app.release_type
26
+ obj[upcase('archs')] = app.archs
27
+ return {} unless app.mobileprovision && !app.mobileprovision.empty?
28
+
29
+ app.mobileprovision.mobileprovision.each do |key, value|
30
+ next if key == 'DeveloperCertificates' || key == 'Name' || key == 'DER-Encoded-Profile'
31
+
32
+ obj[upcase(key)] = value
33
+ end
34
+ elsif app.os == 'Android'
35
+ signs = app.signs.map { |f| f.path }
36
+ issuers = android_certificate_issuer(app)
37
+ permissions = app.use_permissions
38
+ features = app.use_features
39
+
40
+ obj = {
41
+ "MinSDKVersion" => app.min_sdk_version,
42
+ "TargetSDKVersion" => app.target_sdk_version,
43
+ "Signatures" => signs,
44
+ "CertificateIssuers" => issuers,
45
+ "UsePermissions" => permissions,
46
+ "UseFeatures" => features,
47
+ }
48
+ end
49
+
50
+ obj
51
+ end
52
+
53
+ def self.common_columns(app)
54
+ COMMON_COLUMNS.each_with_object({}) do |key, hash|
55
+ value = key == 'size' ? app.size(true) : app.send(key.to_sym)
56
+ hash[key] = value
57
+ end
58
+ end
59
+
6
60
  def self.object_to_column(object)
7
61
  case object
8
62
  when Hash
@@ -25,24 +79,17 @@ module Fastlane
25
79
  end
26
80
  end
27
81
 
28
- def self.common_columns
29
- %w[name release_version build_version identifier os]
82
+ def self.upcase(key)
83
+ key == 'os' ? key.upcase : key.split('_').map(&:capitalize).join('')
30
84
  end
31
85
 
32
- def self.app_to_json(app)
33
- data = common_columns.each_with_object({}) do |key, obj|
34
- name = key.split('_').map(&:capitalize).join('')
35
- obj[name] = app.send(key.to_sym)
36
- end
37
-
38
- if app.os == 'iOS' && app.mobileprovision && !app.mobileprovision.empty?
39
- app.mobileprovision.mobileprovision.each do |key, value|
40
- next if key == 'DeveloperCertificates'
41
- data[key] = value
42
- end
86
+ def self.android_certificate_issuer(app)
87
+ app.certificates.each_with_object([]) do |cert, obj|
88
+ issuer = cert.certificate.issuer.to_a.map {|c| [c[0], c[1]] }.flatten.each_slice(2).to_h
89
+ obj << issuer.select{ |k, _| ['CN', 'OU', 'O'].include?(k) }
90
+ .map {|k, v| "#{k}:#{v}"}
91
+ .join(' ')
43
92
  end
44
-
45
- JSON.dump(data)
46
93
  end
47
94
 
48
95
  def self.store_sharedvalue(key, value)
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module AppInfo
3
- VERSION = '0.2.0'.freeze
3
+ VERSION = '0.5.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-app_info
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - icyleaf
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-25 00:00:00.000000000 Z
11
+ date: 2021-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: app-info
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 2.5.2
20
+ - - "<"
18
21
  - !ruby/object:Gem::Version
19
- version: 1.0.4
22
+ version: '3'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 2.5.2
30
+ - - "<"
25
31
  - !ruby/object:Gem::Version
26
- version: 1.0.4
32
+ version: '3'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: bundler
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -108,7 +114,7 @@ dependencies:
108
114
  - - ">="
109
115
  - !ruby/object:Gem::Version
110
116
  version: '0'
111
- description:
117
+ description:
112
118
  email: icyleaf.cn@gmail.com
113
119
  executables: []
114
120
  extensions: []
@@ -124,7 +130,7 @@ homepage: https://github.com/icyleaf/fastlane-plugin-app_info
124
130
  licenses:
125
131
  - MIT
126
132
  metadata: {}
127
- post_install_message:
133
+ post_install_message:
128
134
  rdoc_options: []
129
135
  require_paths:
130
136
  - lib
@@ -139,9 +145,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
145
  - !ruby/object:Gem::Version
140
146
  version: '0'
141
147
  requirements: []
142
- rubyforge_project:
143
- rubygems_version: 2.6.12
144
- signing_key:
148
+ rubygems_version: 3.1.4
149
+ signing_key:
145
150
  specification_version: 4
146
151
  summary: Teardown tool for mobile app(ipa/apk), analysis metedata like version, name,
147
152
  icon etc.