cocoapods-entitlements-statistics 0.0.1 → 0.0.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78d44f3a0db351e7ad3cb4bbb426580cffcf959a9cf4621d989458a1e2cc657f
|
4
|
+
data.tar.gz: 4245ab156cf2c05355ce391493dbd5fd58266dd038e3d9e75ecead3c6c74ead0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e07b6ba5362321dfcb4edffa1431ef56bf95d4ee3bf40a287e45e1853ce6d8a88675c024bd2a802d7c7bae09f29f83d63915c182b03d21a12de1674d21979997
|
7
|
+
data.tar.gz: '0956de16c391e87cfd659e3310d24904f5c234a171580a40f4f9c335a343d87ba26df231ad0edd703230e334a3d1898761e572f47aa9a455c18e3fdd6d30fb3f'
|
data/Gemfile
CHANGED
@@ -2,8 +2,7 @@ source 'https://rubygems.org'
|
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in cocoapods-entitlements-statistics.gemspec
|
4
4
|
gemspec
|
5
|
-
|
6
|
-
gem 'zip'
|
5
|
+
|
7
6
|
|
8
7
|
group :development do
|
9
8
|
gem 'cocoapods'
|
@@ -14,5 +13,6 @@ group :development do
|
|
14
13
|
gem 'prettybacon'
|
15
14
|
gem 'crimp'
|
16
15
|
gem 'zip'
|
16
|
+
gem 'terminal-table'
|
17
17
|
|
18
18
|
end
|
data/README.md
CHANGED
@@ -6,16 +6,25 @@ iOS app 权限统计, 使用cocoapods plugin 触发
|
|
6
6
|
## 安装
|
7
7
|
|
8
8
|
```shell
|
9
|
-
|
10
|
-
sudo gem install cocoapods-entitlements-statistics-0.0.1.gem
|
9
|
+
sudo gem install cocoapods-entitlements-statistics
|
11
10
|
```
|
12
11
|
|
13
12
|
## 使用
|
14
13
|
|
14
|
+
在Gemfile中声明插件
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
source "https://rubygems.org"
|
18
|
+
#声明
|
19
|
+
gem 'cocoapods-entitlements-statistics'
|
20
|
+
...
|
21
|
+
```
|
22
|
+
|
23
|
+
|
15
24
|
在 Podfile 文件添加插件引用
|
16
25
|
|
17
26
|
```ruby
|
18
|
-
|
27
|
+
#引入, 可以自定义 report_path, 默认在(iOS)项目根目录
|
19
28
|
plugin 'cocoapods-entitlements-statistics', :report_path => '/Users/rd01/Desktop'
|
20
29
|
#plugin 'cocoapods-entitlements-statistics'
|
21
30
|
|
@@ -34,6 +43,10 @@ Pod installation complete! There are 75 dependencies from the Podfile and 116 to
|
|
34
43
|
|
35
44
|
```
|
36
45
|
|
46
|
+
> 也可以手动执行cli 命令
|
47
|
+
>
|
48
|
+
> 仓库地址: https://github.com/olaola-chat/cli-app_permission_statistics
|
49
|
+
|
37
50
|
## 说明
|
38
51
|
|
39
52
|
##### 版本权限统计
|
@@ -102,11 +115,19 @@ remove capabilitys :
|
|
102
115
|
#### 涉及的文件
|
103
116
|
|
104
117
|
* info.plist
|
105
|
-
* Runner.entitlements
|
118
|
+
* Runner.entitlements
|
119
|
+
|
120
|
+
Capabilitys被添加后的,Xcode自动创建plist格式文件,里面包含相关Capability的声明、设置
|
121
|
+
|
106
122
|
* {embedded/xxx-xx-xx}.mobileprovision
|
107
|
-
|
123
|
+
|
124
|
+
embedded.mobileprovision 存在于IPA包中,被发送到Appstore,真正安装的app 却没有这个文件
|
125
|
+
|
126
|
+
xxx-xx-xx.mobileprovision 在打包成IPA前用于工程签名的描述文件
|
127
|
+
两者基本一致,包括里面的Entitlements字段, 保存一些 Capabilitys被添加后的 声明、设置
|
108
128
|
* Runner.xcodeproj
|
109
|
-
|
129
|
+
|
130
|
+
工程文件SystemCapabilities字段包含了一些Capabilitys 的开关字段
|
110
131
|
|
111
132
|
相关文档:
|
112
133
|
|
@@ -3,6 +3,7 @@
|
|
3
3
|
require_relative "helper"
|
4
4
|
require 'fileutils'
|
5
5
|
require 'yaml'
|
6
|
+
require 'terminal-table'
|
6
7
|
|
7
8
|
module AppEntitlementsStatistics
|
8
9
|
|
@@ -13,25 +14,27 @@ module AppEntitlementsStatistics
|
|
13
14
|
attr_reader :report_path
|
14
15
|
attr_reader :identifier
|
15
16
|
|
16
|
-
def initialize(identifier,report_path
|
17
|
+
def initialize(identifier,report_path = nil,store_path = nil)
|
17
18
|
@identifier = identifier
|
18
19
|
@report_path = report_path
|
19
20
|
@store_path = store_path
|
20
21
|
end
|
21
22
|
|
22
|
-
def analyze
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
23
|
+
def analyze(versions=[])
|
24
|
+
versions.sort{|x,y| y<=>x } unless versions.size < 2
|
25
|
+
if versions.length < 2
|
26
|
+
load_version
|
27
|
+
return singleGenerate unless @versions.length > 1
|
28
|
+
else
|
29
|
+
@versions = versions
|
30
|
+
end
|
31
|
+
pre_entitlements = load_entitlements_yaml(@versions[1])
|
32
|
+
cur_entitlements = load_entitlements_yaml(@versions[0])
|
29
33
|
return "" unless pre_entitlements.any?
|
30
34
|
return "" unless cur_entitlements.any?
|
31
35
|
|
32
|
-
capabilities_diff =
|
33
|
-
|
34
|
-
report_path = generate(capabilities_diff,usage_descs_diff)
|
36
|
+
capabilities_diff = analyze_diff(pre_entitlements,cur_entitlements)
|
37
|
+
report_path = generate(capabilities_diff)
|
35
38
|
report_path
|
36
39
|
end
|
37
40
|
|
@@ -48,28 +51,26 @@ module AppEntitlementsStatistics
|
|
48
51
|
report_path
|
49
52
|
end
|
50
53
|
|
51
|
-
|
54
|
+
|
55
|
+
def generate(capabilities_diff)
|
52
56
|
return unless @versions.length > 1
|
53
57
|
cur_version = @versions[0]
|
54
58
|
pre_version = @versions[1]
|
55
|
-
|
56
|
-
output = "\n" + "compared #{cur_version} #{pre_version}"
|
59
|
+
output = ""
|
57
60
|
output += "\n" + capabilities_diff unless capabilities_diff.empty?
|
58
|
-
output += "\n
|
59
|
-
output += "\n\nThere is no difference between the two versions \n\n" unless (!capabilities_diff.empty? && !usage_descs_diff.empty?)
|
61
|
+
output += "\n\nThere is no difference between the two versions 【 #{@versions[0]} vs #{@versions[1]}】\n\n" unless !capabilities_diff.empty?
|
60
62
|
# puts output
|
61
|
-
|
62
63
|
output += "\n\n\n#{cur_version} entitlements list: "
|
63
64
|
output += "\n" + read_each_line(cur_version)
|
64
65
|
output += "\n" + "----------------------------------------"
|
65
66
|
output += "\n\n#{pre_version} entitlements list: "
|
66
67
|
output += "\n" + read_each_line(pre_version)
|
67
|
-
output += "\n" + "----------------------------------------"
|
68
68
|
|
69
69
|
report_path = report_file_name(path: @report_path)
|
70
70
|
File.open(report_path, 'w') { |file|
|
71
71
|
file.write(output)
|
72
72
|
}
|
73
|
+
# puts "detail file: #{File.expand_path(report_path)}"
|
73
74
|
report_path
|
74
75
|
end
|
75
76
|
|
@@ -99,120 +100,97 @@ module AppEntitlementsStatistics
|
|
99
100
|
yaml_content
|
100
101
|
end
|
101
102
|
|
102
|
-
def
|
103
|
+
def analyze_diff(pre,cur)
|
103
104
|
output = ""
|
104
105
|
cur_capabilities_summary = cur['Capabilities_Summary']
|
105
106
|
pre_capabilities_summary = pre['Capabilities_Summary']
|
106
|
-
|
107
|
-
|
108
|
-
|
107
|
+
|
108
|
+
cur_usage_descs_summary = cur['PermissionsUsageDescription_Summary']
|
109
|
+
pre_usage_descs_summary = pre['PermissionsUsageDescription_Summary']
|
110
|
+
|
111
|
+
# cur_capabilities = cur['Capabilities']
|
112
|
+
# pre_capabilities = pre['Capabilities']
|
113
|
+
|
114
|
+
# cur_usage_descs = cur['PermissionsUsageDescription']
|
115
|
+
# pre_usage_descs = pre['PermissionsUsageDescription']
|
116
|
+
|
109
117
|
# 修改
|
110
118
|
comm_capabilities = cur_capabilities_summary.keys & pre_capabilities_summary.keys
|
111
|
-
|
119
|
+
modifyed_rows = []
|
112
120
|
comm_capabilities.each do |key|
|
113
121
|
if cur_capabilities_summary[key] != pre_capabilities_summary[key]
|
114
|
-
|
115
|
-
modifys_pre += "\n" + '- ' + key + ': ' + pre_capabilities[key].to_s
|
122
|
+
modifyed_rows << [ '- ' + key ]
|
116
123
|
end
|
117
124
|
end
|
118
125
|
|
119
|
-
modifys += "\n" + @versions[0] unless modifys_cur.empty?
|
120
|
-
modifys += modifys_cur unless modifys_cur.empty?
|
121
|
-
modifys += "\n" + @versions[1] unless modifys_pre.empty?
|
122
|
-
modifys += modifys_pre unless modifys_pre.empty?
|
123
|
-
|
124
|
-
#新增
|
125
|
-
add_capabilities = cur_capabilities_summary.keys - pre_capabilities_summary.keys
|
126
|
-
adds = ""
|
127
|
-
add_capabilities.each do |key|
|
128
|
-
adds += "\n" + '- ' + key + ': ' + cur_capabilities[key].to_s
|
129
|
-
end
|
130
|
-
|
131
|
-
#移除
|
132
|
-
remove_capabilities = pre_capabilities_summary.keys - cur_capabilities_summary.keys
|
133
|
-
removes = ""
|
134
|
-
remove_capabilities.each do |key|
|
135
|
-
removes += "\n" + '- ' + key + ': ' + pre_capabilities[key].to_s
|
136
|
-
end
|
137
|
-
|
138
|
-
if !modifys.empty?
|
139
|
-
output += "\n" + "modify capabilitys : "
|
140
|
-
output += modifys
|
141
|
-
output += "\n------------------------------"
|
142
|
-
end
|
143
|
-
|
144
|
-
if !adds.empty?
|
145
|
-
output += "\n" + "add capabilitys : "
|
146
|
-
output += adds
|
147
|
-
output += "\n------------------------------"
|
148
|
-
end
|
149
|
-
|
150
|
-
if !removes.empty?
|
151
|
-
output += "\n" + "remove capabilitys : "
|
152
|
-
output += removes
|
153
|
-
output += "\n------------------------------"
|
154
|
-
end
|
155
|
-
|
156
|
-
output
|
157
|
-
end
|
158
|
-
|
159
|
-
def analyze_usage_descs_diff(pre,cur)
|
160
|
-
output = ""
|
161
|
-
cur_usage_descs_summary = cur['PermissionsUsageDescription_Summary']
|
162
|
-
pre_usage_descs_summary = pre['PermissionsUsageDescription_Summary']
|
163
|
-
|
164
|
-
cur_usage_descs = cur['PermissionsUsageDescription']
|
165
|
-
pre_usage_descs = pre['PermissionsUsageDescription']
|
166
|
-
|
167
|
-
# 修改
|
168
126
|
comm_usage_descs = cur_usage_descs_summary.keys & pre_usage_descs_summary.keys
|
169
|
-
modifys = modifys_cur = modifys_pre = ""
|
170
127
|
comm_usage_descs.each do |key|
|
171
128
|
if cur_usage_descs_summary[key] != pre_usage_descs_summary[key]
|
172
|
-
|
173
|
-
modifys_pre += "\n" + '- ' + key + ': ' + pre_usage_descs[key].to_s
|
129
|
+
modifyed_rows << [ '- ' + key ]
|
174
130
|
end
|
175
131
|
end
|
176
132
|
|
177
|
-
modifys += "\n" + @versions[0] unless modifys_cur.empty?
|
178
|
-
modifys += modifys_cur unless modifys_cur.empty?
|
179
|
-
modifys += "\n" + @versions[1] unless modifys_pre.empty?
|
180
|
-
modifys += modifys_pre unless modifys_pre.empty?
|
181
133
|
|
182
134
|
#新增
|
135
|
+
add_capabilities = cur_capabilities_summary.keys - pre_capabilities_summary.keys
|
136
|
+
added_rows = []
|
137
|
+
add_capabilities.each do |key|
|
138
|
+
added_rows << ['- ' + key ] #+ ': ' + cur_capabilities[key].to_s
|
139
|
+
end
|
140
|
+
|
183
141
|
add_usage_descs = cur_usage_descs_summary.keys - pre_usage_descs_summary.keys
|
184
|
-
adds = ""
|
185
142
|
add_usage_descs.each do |key|
|
186
|
-
|
143
|
+
added_rows << [ '- ' + key ] #+ ': ' + cur_usage_descs[key].to_s
|
187
144
|
end
|
188
145
|
|
189
146
|
#移除
|
147
|
+
remove_capabilities = pre_capabilities_summary.keys - cur_capabilities_summary.keys
|
148
|
+
removed_rows = []
|
149
|
+
remove_capabilities.each do |key|
|
150
|
+
removed_rows << ['- ' + key ] #+ ': ' + pre_capabilities[key].to_s
|
151
|
+
end
|
152
|
+
|
190
153
|
remove_usage_descs = pre_usage_descs_summary.keys - cur_usage_descs_summary.keys
|
191
|
-
removes = ""
|
192
154
|
remove_usage_descs.each do |key|
|
193
|
-
|
155
|
+
removed_rows << [ '- ' + key ] #+ ': ' + pre_usage_descs[key].to_s
|
194
156
|
end
|
195
157
|
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
output
|
158
|
+
# Summary
|
159
|
+
max_count = [modifyed_rows.size,added_rows.size,removed_rows.size].max
|
160
|
+
if max_count == 0
|
161
|
+
return output
|
200
162
|
end
|
201
163
|
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
164
|
+
table = Terminal::Table.new do |t|
|
165
|
+
t.title = "Compared #{@versions[0]} to #{@versions[1]} Summary"
|
166
|
+
t.add_row ["Modifyed", modifyed_rows.size ]
|
167
|
+
t.add_row ["New", added_rows.size ]
|
168
|
+
t.add_row ["Remove", removed_rows.size ]
|
206
169
|
end
|
170
|
+
output += table.to_s + "\n\n"
|
207
171
|
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
172
|
+
def get_value(arr,n)
|
173
|
+
return "" unless arr.length > n
|
174
|
+
return arr[n].first unless arr.length == 0
|
175
|
+
return ""
|
212
176
|
end
|
213
177
|
|
178
|
+
detail_table = Terminal::Table.new do |t|
|
179
|
+
t.headings = ['Modifyed', 'New', 'Remove']
|
180
|
+
(0..max_count-1).each do |n|
|
181
|
+
t.add_row [
|
182
|
+
get_value(modifyed_rows,n),
|
183
|
+
get_value(added_rows,n),
|
184
|
+
get_value(removed_rows,n),
|
185
|
+
]
|
186
|
+
end
|
187
|
+
end
|
188
|
+
output += detail_table.to_s + "\n\n"
|
214
189
|
output
|
215
|
-
end
|
190
|
+
end
|
191
|
+
|
216
192
|
end
|
193
|
+
end
|
217
194
|
|
218
|
-
|
195
|
+
obj = AppEntitlementsStatistics::Analyzer.new('com.ola.chat')
|
196
|
+
obj.analyze(["5.3.0","5.2.0"])
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-entitlements-statistics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yaml
|
@@ -106,6 +106,20 @@ dependencies:
|
|
106
106
|
- - ">="
|
107
107
|
- !ruby/object:Gem::Version
|
108
108
|
version: '0'
|
109
|
+
- !ruby/object:Gem::Dependency
|
110
|
+
name: terminal-table
|
111
|
+
requirement: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
116
|
+
type: :development
|
117
|
+
prerelease: false
|
118
|
+
version_requirements: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0'
|
109
123
|
description: A short description of cocoapods-entitlements-statistics.
|
110
124
|
email:
|
111
125
|
- tang.bin@olaola.chat
|
@@ -118,7 +132,6 @@ files:
|
|
118
132
|
- LICENSE.txt
|
119
133
|
- README.md
|
120
134
|
- Rakefile
|
121
|
-
- cocoapods-entitlements-statistics.gemspec
|
122
135
|
- lib/cocoapods-entitlements-statistics.rb
|
123
136
|
- lib/cocoapods-entitlements-statistics/app_entitlements_statistics/analyze.rb
|
124
137
|
- lib/cocoapods-entitlements-statistics/app_entitlements_statistics/core_ext/inflector.rb
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'cocoapods-entitlements-statistics/gem_version.rb'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = 'cocoapods-entitlements-statistics'
|
8
|
-
spec.version = CocoapodsEntitlementsStatistics::VERSION
|
9
|
-
spec.authors = ['bin']
|
10
|
-
spec.email = ['tang.bin@olaola.chat']
|
11
|
-
spec.description = %q{A short description of cocoapods-entitlements-statistics.}
|
12
|
-
spec.summary = %q{A longer description of cocoapods-entitlements-statistics.}
|
13
|
-
spec.homepage = 'https://github.com/EXAMPLE/cocoapods-entitlements-statistics'
|
14
|
-
spec.license = 'MIT'
|
15
|
-
|
16
|
-
spec.files = `git ls-files`.split($/)
|
17
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = ['lib']
|
20
|
-
|
21
|
-
spec.add_runtime_dependency "yaml"
|
22
|
-
spec.add_runtime_dependency "crimp"
|
23
|
-
spec.add_dependency 'CFPropertyList', '< 3.1.0', '>= 2.3.4'
|
24
|
-
spec.add_development_dependency 'bundler', '>= 1.12'
|
25
|
-
spec.add_dependency 'rubyzip', '>= 1.2', '< 3.0'
|
26
|
-
spec.add_development_dependency 'rake'
|
27
|
-
end
|