fastlane-plugin-app_info 0.4.1 → 0.5.2

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
2
  SHA256:
3
- metadata.gz: 8733326026a00d40a50b993397fc2e9f86b113160ec6f5d5bd117c52ebecaba5
4
- data.tar.gz: 9fa9b3aaa9846700117a22507047bfb0aa5aa72eeef4cfe631e4e4109e9ee1c5
3
+ metadata.gz: cf6ec1a91ce4659cca2e3ef7c061e8c5e669b6830bfa9993a632d067b4299f2a
4
+ data.tar.gz: 6e0c2257caa7ad083a70c01fb804caac49c5b1397602ba0ee3453675955c2afa
5
5
  SHA512:
6
- metadata.gz: 32d9dd567b9d12ea77a237ff0c51c5447f2c0ae49e07f09a7d624cd6ce70c435ba41e6e677e1dd5fc008c0461a4b82bfa4d9cf1cc0a4f06d1937528715c7dd6e
7
- data.tar.gz: a9cd116b4a81056bd6ec8a8db04823e1f63c769305e181a0492bdb64ffad9a8f0473836090d84225db4b75c787ef7d91f5694684c9d16bb899a0870442c531eb
6
+ metadata.gz: 54405927aa32d6b56ca0eebced81c389c56b4a640a60cd95dc9d08b037b6377453719578e0a598792eb9f09746c45c3e9f4194039df049bb5b9ba2e4845f802e
7
+ data.tar.gz: a87b625bfb4a0f3c4a40fdca6c039295e6a20c3626b018e533f7652715dc100b83cb024149ab2cc694c11ef52dac25c4fb8e6776c2fda877db0f993323eaa888
data/README.md CHANGED
@@ -38,15 +38,22 @@ Teardown tool for mobile app(ipa/apk), analysis metedata like version, name, ico
38
38
  | clean | Clean cache files to reduce | APP_INFO_CLEAN | true |
39
39
  | | disk size | | |
40
40
  +-------+---------------------------------+----------------+---------+
41
-
42
- +----------+---------------------------------+
43
- | app_info Output Variables |
44
- +----------+---------------------------------+
45
- | Key | Description |
46
- +----------+---------------------------------+
47
- | APP_INFO | the json formated app info data |
48
- +----------+---------------------------------+
49
- Access the output values using `lane_context[SharedValues::VARIABLE_NAME]`
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
+ +-----------------------------------------------+
50
57
  ```
51
58
 
52
59
  ## Example
@@ -59,23 +66,28 @@ Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plu
59
66
 
60
67
  ```text
61
68
  +-----------------------------+-------------------------------------------------+
62
- | Summary for app_info 0.4.0 |
69
+ | Summary for app_info 0.5.0 |
63
70
  +-----------------------------+-------------------------------------------------+
64
- | Name | iOS Team Provisioning Profile: * |
71
+ | OS | iOS |
72
+ | Name | AppInfoDemo |
65
73
  | ReleaseVersion | 1.2.3 |
66
74
  | BuildVersion | 5 |
67
75
  | Identifier | com.icyleaf.AppInfoDemo |
68
- | Os | iOS |
69
- | AppIDName | XC Wildcard |
70
- | ApplicationIdentifierPrefix | ********** |
71
- | 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 |
72
84
  | Platform | iOS |
73
- | Entitlements (4) | keychain-access-groups: ["**********.*"] |
85
+ | Entitlements (4) | keychain-access-groups: ["5PJA6N5A3B.*"] |
74
86
  | | get-task-allow: true |
75
- | | application-identifier: **********.* |
76
- | | com.apple.developer.team-identifier: ********** |
77
- | ExpirationDate | 2017-07-27 17:44:49 +0800 |
78
- | 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 |
79
91
  | | **************************************** |
80
92
  | TeamIdentifier | ********** |
81
93
  | TeamName | EWS Inc |
@@ -89,21 +101,22 @@ Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plu
89
101
 
90
102
  ```text
91
103
  +--------------------+------------------------------+
92
- | Summary for app_info 0.4.0 |
104
+ | Summary for app_info 0.5.0 |
93
105
  +--------------------+------------------------------+
106
+ | OS | Android |
94
107
  | Name | AppInfoDemo |
95
108
  | ReleaseVersion | 1.2.3 |
96
109
  | BuildVersion | 5 |
97
110
  | Identifier | com.icyleaf.appinfodemo |
98
- | OS | Android |
99
111
  | Size | 2.93 MB |
100
- | MinSDKVersion | 14 |
101
- | TargetSDKVersion | 29 |
112
+ | DeviceType | Phone |
113
+ | Minsdkversion | 14 |
114
+ | Targetsdkversion | 29 |
102
115
  | Signatures | META-INF/CERT.RSA |
103
- | CertificateIssuers | CN:Android Debug O:Android |
104
- | UsePermissions (2) | android.permission.BLUETOOTH |
116
+ | Certificateissuers | CN:Android Debug O:Android |
117
+ | Usepermissions (2) | android.permission.BLUETOOTH |
105
118
  | | android.permission.CAMERA |
106
- | UseFeatures (0) | |
119
+ | Usefeatures | |
107
120
  +--------------------+------------------------------+
108
121
  ```
109
122
 
@@ -9,68 +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
- @app.clear! if params.fetch(:clean)
20
-
21
- # Store shared value
22
- Helper::AppInfoHelper.store_sharedvalue(:APP_INFO, Helper::AppInfoHelper.app_to_json(@app))
23
- end
24
-
25
- def self.print_table!
26
- params = {}
27
- params[:rows] = table_columns
28
- params[:title] = "Summary for app_info #{AppInfo::VERSION}".green
29
-
30
- puts ""
31
- puts Terminal::Table.new(params)
32
- puts ""
33
- end
34
-
35
- def self.table_columns
36
- common_columns.merge(extra_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
37
24
  end
38
25
 
39
- def self.common_columns
40
- Helper::AppInfoHelper.common_columns.each_with_object({}) do |key, hash|
41
- name = key == 'os' ? key.upcase : key.split('_').map(&:capitalize).join('')
42
- value = key == 'size' ? @app.size(true) : @app.send(key.to_sym)
43
- hash[name] = Helper::AppInfoHelper.object_to_column(value)
44
- end
45
- end
46
-
47
- def self.extra_columns
48
- if @app.os == 'iOS'
49
- return {} unless @app.mobileprovision && !@app.mobileprovision.empty?
50
-
51
- @app.mobileprovision.mobileprovision.each_with_object({}) do |(key, value), hash|
52
- next if key == 'DeveloperCertificates' || key == 'Name'
53
-
54
- name = Helper::AppInfoHelper.column_name(key, value)
55
- hash[name] = Helper::AppInfoHelper.object_to_column(value)
56
- end
57
- elsif @app.os == 'Android'
58
- signs = @app.signs.map {|f| f.path }
59
- issuers = Helper::AppInfoHelper.android_certificate_issuer(@app)
60
- permissions = @app.use_permissions
61
- features = @app.use_features
62
-
63
- {
64
- "MinSDKVersion" => Helper::AppInfoHelper.object_to_column(@app.min_sdk_version),
65
- "TargetSDKVersion" => Helper::AppInfoHelper.object_to_column(@app.target_sdk_version),
66
- "Signatures" => Helper::AppInfoHelper.object_to_column(signs),
67
- "CertificateIssuers" => Helper::AppInfoHelper.object_to_column(issuers),
68
- "UsePermissions (#{permissions.size})" => Helper::AppInfoHelper.object_to_column(permissions),
69
- "UseFeatures (#{features.size})" => Helper::AppInfoHelper.object_to_column(features),
70
- }
71
- else
72
- {}
73
- 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
+ )
74
31
  end
75
32
 
76
33
  def self.description
@@ -85,9 +42,13 @@ module Fastlane
85
42
  "Teardown tool for mobile app(ipa/apk), analysis metedata like version, name, icon etc."
86
43
  end
87
44
 
45
+ def self.return_value
46
+ "Returns a Hash formated metadata of given app"
47
+ end
48
+
88
49
  def self.output
89
50
  [
90
- [SharedValues::APP_INFO.to_s, 'the json formated app info data']
51
+ [SharedValues::APP_INFO.to_s, 'The JSON formated metadata of given app']
91
52
  ]
92
53
  end
93
54
 
@@ -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(&: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(human_size: true) : app.send(key.to_sym)
56
+ hash[upcase(key)] = value
57
+ end
58
+ end
59
+
6
60
  def self.object_to_column(object)
7
61
  case object
8
62
  when Hash
@@ -25,32 +79,15 @@ module Fastlane
25
79
  end
26
80
  end
27
81
 
28
- def self.common_columns
29
- %w[name release_version build_version identifier os size]
30
- end
31
-
32
- def self.app_to_json(app)
33
- data = common_columns.each_with_object({}) do |key, obj|
34
- name = key.downcase == 'os' ? key.upcase : key.split('_').map(&:capitalize).join('')
35
- value = key == 'size' ? app.size(true) : app.send(key.to_sym)
36
- obj[name] = value
37
- end
82
+ def self.upcase(key)
83
+ return key.upcase if key == 'os'
38
84
 
39
- if app.os == 'iOS' && app.mobileprovision && !app.mobileprovision.empty?
40
- app.mobileprovision.mobileprovision.each do |key, value|
41
- next if key == 'DeveloperCertificates'
42
- data[key] = value
43
- end
44
- elsif app.os == 'Android'
45
- data["MinSDKVersion"] = app.min_sdk_version
46
- data["TargetSDKVersion"] = app.target_sdk_version
47
- data["CertificateIssuers"] = android_certificate_issuer(app)
48
- data["Signatures"] = app.signs.map {|sign| sign.path }
49
- data["UsePermissions"] = app.use_permissions
50
- data["UseFeatures"] = app.use_features
85
+ str = key.dup
86
+ ['-', '_', '\s'].each do |s|
87
+ str = str.gsub(/(?:#{s}+)([a-z])/) { $1.upcase }
51
88
  end
52
89
 
53
- JSON.dump(data)
90
+ return str.gsub(/(\A|\s)([a-z])/) { $1 + $2.upcase }
54
91
  end
55
92
 
56
93
  def self.android_certificate_issuer(app)
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module AppInfo
3
- VERSION = '0.4.1'.freeze
3
+ VERSION = '0.5.2'.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.4.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - icyleaf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-07 00:00:00.000000000 Z
11
+ date: 2021-09-29 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.6.5
20
+ - - "<"
18
21
  - !ruby/object:Gem::Version
19
- version: 2.4.2
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.6.5
30
+ - - "<"
25
31
  - !ruby/object:Gem::Version
26
- version: 2.4.2
32
+ version: '3'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: bundler
29
35
  requirement: !ruby/object:Gem::Requirement