fastlane-plugin-app_info 0.1.0 → 0.4.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
- SHA1:
3
- metadata.gz: c491623d54fa2a594504a83a93e79d8d897b01d1
4
- data.tar.gz: 4e7de4e2c1b7d54276c719bc31b9a954242f88ef
2
+ SHA256:
3
+ metadata.gz: efd407eeeac3fd255b45842ee06c737325c0b3cb088c88ef579560c3d720cd2c
4
+ data.tar.gz: 43a7cd7b7afa0a8d81bb1945400cc262df99134cfc5d7fcd3e2ae5ce16744364
5
5
  SHA512:
6
- metadata.gz: 431d3babf08aeb5059754bba49a8126d30a02a691f777c94742d23d94efc0b2d21feae98c6153b5b0ae15181c0ce74f6ae23d3bd62c24443e78e1eb8428c9456
7
- data.tar.gz: aef6593197881e2d2184c3ad315fc9035b806eeb3779e18baeacbb0ae8c1956979017200b965b7097ac298b8acb5581c1456958f9b83303403ed552f30100adc
6
+ metadata.gz: bccc10c35fdf26fa42fb000427932ef9ca39b6d48def6b101940abb2be9f18ee49f09d82db56f57e6e94737f6ef48d5440194f0323aaa040a7c3a0a807aa7e95
7
+ data.tar.gz: 761a44e70df42606da6f9622df889a0d3b028482754dd71fe7371341c7a9447d7c7c97453d13da73369fbd86f7d504dbbdde24f26d01c67c66ceec45e6ccc08a
data/README.md CHANGED
@@ -14,6 +14,41 @@ fastlane add_plugin app_info
14
14
 
15
15
  Teardown tool for mobile app(ipa/apk), analysis metedata like version, name, icon etc.
16
16
 
17
+ ## Configure
18
+
19
+ ```
20
+ +----------------------------------------------------------------------------------------+
21
+ | app_info |
22
+ +----------------------------------------------------------------------------------------+
23
+ | Parse and dump mobile app(ipa/apk) metedata. |
24
+ | |
25
+ | Teardown tool for mobile app(ipa/apk), analysis metedata like version, name, icon etc. |
26
+ | |
27
+ | Created by icyleaf <icyleaf.cn@gmail.com> |
28
+ +----------------------------------------------------------------------------------------+
29
+
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
+
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]`
50
+ ```
51
+
17
52
  ## Example
18
53
 
19
54
  Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
@@ -22,9 +57,9 @@ Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plu
22
57
 
23
58
  ### iOS
24
59
 
25
- ```bash
60
+ ```text
26
61
  +-----------------------------+-------------------------------------------------+
27
- | Summary for app_info 0.1.0 |
62
+ | Summary for app_info 0.4.0 |
28
63
  +-----------------------------+-------------------------------------------------+
29
64
  | Name | iOS Team Provisioning Profile: * |
30
65
  | ReleaseVersion | 1.2.3 |
@@ -52,16 +87,24 @@ Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plu
52
87
 
53
88
  ### Android
54
89
 
55
- ```bash
56
- +----------------+-------------------------+
57
- | Summary for app_info 0.1.0 |
58
- +----------------+-------------------------+
59
- | Name | AppInfoDemo |
60
- | ReleaseVersion | 1.2.3 |
61
- | BuildVersion | 5 |
62
- | Identifier | com.icyleaf.appinfodemo |
63
- | Os | Android |
64
- +----------------+-------------------------+
90
+ ```text
91
+ +--------------------+------------------------------+
92
+ | Summary for app_info 0.4.0 |
93
+ +--------------------+------------------------------+
94
+ | Name | AppInfoDemo |
95
+ | ReleaseVersion | 1.2.3 |
96
+ | BuildVersion | 5 |
97
+ | Identifier | com.icyleaf.appinfodemo |
98
+ | OS | Android |
99
+ | Size | 2.93 MB |
100
+ | MinSDKVersion | 14 |
101
+ | TargetSDKVersion | 29 |
102
+ | Signatures | META-INF/CERT.RSA |
103
+ | CertificateIssuers | CN:Android Debug O:Android |
104
+ | UsePermissions (2) | android.permission.BLUETOOTH |
105
+ | | android.permission.CAMERA |
106
+ | UseFeatures (0) | |
107
+ +--------------------+------------------------------+
65
108
  ```
66
109
 
67
110
  ## Run tests for this plugin
@@ -1,8 +1,12 @@
1
- require 'app_info'
1
+ require 'app-info'
2
2
  require 'terminal-table'
3
3
 
4
4
  module Fastlane
5
5
  module Actions
6
+ module SharedValues
7
+ APP_INFO = :APP_INFO
8
+ end
9
+
6
10
  class AppInfoAction < Action
7
11
  def self.run(params)
8
12
  @file = params.fetch(:file)
@@ -11,6 +15,11 @@ module Fastlane
11
15
  @app = ::AppInfo.parse(@file)
12
16
 
13
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))
14
23
  end
15
24
 
16
25
  def self.print_table!
@@ -24,39 +33,64 @@ module Fastlane
24
33
  end
25
34
 
26
35
  def self.table_columns
27
- common_columns.merge(ios_columns)
36
+ common_columns.merge(extra_columns)
28
37
  end
29
38
 
30
39
  def self.common_columns
31
- %w(name release_version build_version identifier os).each_with_object({}) do |key, hash|
32
- name = key.split('_').map(&:capitalize).join('')
33
- hash[name] = Helper::AppInfoHelper.object_to_column(@app.send(key.to_sym))
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)
34
44
  end
35
45
  end
36
46
 
37
- def self.ios_columns
38
- return {} unless @app.os == 'iOS' && @app.mobileprovision && !@app.mobileprovision.empty?
47
+ def self.extra_columns
48
+ if @app.os == 'iOS'
49
+ return {} unless @app.mobileprovision && !@app.mobileprovision.empty?
39
50
 
40
- @app.mobileprovision.mobileprovision.each_with_object({}) do |(key, value), hash|
41
- next if key == 'DeveloperCertificates'
51
+ @app.mobileprovision.mobileprovision.each_with_object({}) do |(key, value), hash|
52
+ next if key == 'DeveloperCertificates' || key == 'Name'
42
53
 
43
- name = Helper::AppInfoHelper.column_name(key, value)
44
- hash[name] = Helper::AppInfoHelper.object_to_column(value)
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
+ {}
45
73
  end
46
74
  end
47
75
 
48
76
  def self.description
49
- "Teardown tool for mobile app(ipa/apk), analysis metedata like version, name, icon etc."
77
+ "Parse and dump mobile app(ipa/apk) metedata."
50
78
  end
51
79
 
52
80
  def self.authors
53
- ["icyleaf"]
81
+ ["icyleaf <icyleaf.cn@gmail.com>"]
54
82
  end
55
83
 
56
84
  def self.details
57
85
  "Teardown tool for mobile app(ipa/apk), analysis metedata like version, name, icon etc."
58
86
  end
59
87
 
88
+ def self.output
89
+ [
90
+ [SharedValues::APP_INFO.to_s, 'the json formated app info data']
91
+ ]
92
+ end
93
+
60
94
  def self.available_options
61
95
  [
62
96
  FastlaneCore::ConfigItem.new(key: :file,
@@ -66,12 +100,17 @@ module Fastlane
66
100
  optional: true,
67
101
  verify_block: proc do |value|
68
102
  raise "Couldn't find app file".red unless File.exist?(value)
69
- end)
103
+ end),
104
+ FastlaneCore::ConfigItem.new(key: :clean,
105
+ env_name: 'APP_INFO_CLEAN',
106
+ description: 'Clean cache files to reduce disk size',
107
+ default_value: true,
108
+ optional: true)
70
109
  ]
71
110
  end
72
111
 
73
112
  def self.is_supported?(platform)
74
- [:ios, :android].include?(platform)
113
+ %i[ios android].include?(platform)
75
114
  end
76
115
  end
77
116
  end
@@ -1,3 +1,5 @@
1
+ require 'json'
2
+
1
3
  module Fastlane
2
4
  module Helper
3
5
  class AppInfoHelper
@@ -22,6 +24,50 @@ module Fastlane
22
24
  key
23
25
  end
24
26
  end
27
+
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
38
+
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
51
+ end
52
+
53
+ JSON.dump(data)
54
+ end
55
+
56
+ def self.android_certificate_issuer(app)
57
+ app.certificates.each_with_object([]) do |cert, obj|
58
+ issuer = cert.certificate.issuer.to_a.map {|c| [c[0], c[1]] }.flatten.each_slice(2).to_h
59
+ obj << issuer.select{ |k, _| ['CN', 'OU', 'O'].include?(k) }
60
+ .map {|k, v| "#{k}:#{v}"}
61
+ .join(' ')
62
+ end
63
+ end
64
+
65
+ def self.store_sharedvalue(key, value)
66
+ Actions.lane_context[key] = value
67
+ ENV[key.to_s] = value
68
+
69
+ value
70
+ end
25
71
  end
26
72
  end
27
73
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module AppInfo
3
- VERSION = "0.1.0"
3
+ VERSION = '0.4.2'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,31 +1,37 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-app_info
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - icyleaf
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-08 00:00:00.000000000 Z
11
+ date: 2021-04-15 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.3
22
+ version: '3'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
- version: 1.0.3
29
+ version: 2.5.2
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '3'
27
33
  - !ruby/object:Gem::Dependency
28
- name: pry
34
+ name: bundler
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - ">="
@@ -39,21 +45,21 @@ dependencies:
39
45
  - !ruby/object:Gem::Version
40
46
  version: '0'
41
47
  - !ruby/object:Gem::Dependency
42
- name: bundler
48
+ name: fastlane
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
51
  - - ">="
46
52
  - !ruby/object:Gem::Version
47
- version: '0'
53
+ version: 1.111.0
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
51
57
  requirements:
52
58
  - - ">="
53
59
  - !ruby/object:Gem::Version
54
- version: '0'
60
+ version: 1.111.0
55
61
  - !ruby/object:Gem::Dependency
56
- name: rspec
62
+ name: pry
57
63
  requirement: !ruby/object:Gem::Requirement
58
64
  requirements:
59
65
  - - ">="
@@ -81,7 +87,7 @@ dependencies:
81
87
  - !ruby/object:Gem::Version
82
88
  version: '0'
83
89
  - !ruby/object:Gem::Dependency
84
- name: rubocop
90
+ name: rspec
85
91
  requirement: !ruby/object:Gem::Requirement
86
92
  requirements:
87
93
  - - ">="
@@ -95,20 +101,20 @@ dependencies:
95
101
  - !ruby/object:Gem::Version
96
102
  version: '0'
97
103
  - !ruby/object:Gem::Dependency
98
- name: fastlane
104
+ name: rubocop
99
105
  requirement: !ruby/object:Gem::Requirement
100
106
  requirements:
101
107
  - - ">="
102
108
  - !ruby/object:Gem::Version
103
- version: 1.111.0
109
+ version: '0'
104
110
  type: :development
105
111
  prerelease: false
106
112
  version_requirements: !ruby/object:Gem::Requirement
107
113
  requirements:
108
114
  - - ">="
109
115
  - !ruby/object:Gem::Version
110
- version: 1.111.0
111
- description:
116
+ version: '0'
117
+ description:
112
118
  email: icyleaf.cn@gmail.com
113
119
  executables: []
114
120
  extensions: []
@@ -120,11 +126,11 @@ files:
120
126
  - lib/fastlane/plugin/app_info/actions/app_info_action.rb
121
127
  - lib/fastlane/plugin/app_info/helper/app_info_helper.rb
122
128
  - lib/fastlane/plugin/app_info/version.rb
123
- homepage:
129
+ 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.8
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.