cocoapods-privacy 0.2.2 → 0.2.4

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: aca165884812e22b5b99ff4220a5a87129f9b56f5940b95f32cea856418e8c32
4
- data.tar.gz: fcfbee202add9d50cff29d74c5bf8b1558855daca7278905a25922d9674c40c0
3
+ metadata.gz: 84dcd18a25274964eb58ec048e74aeb77fa9560563a1c089aa1b5eb37a7f4786
4
+ data.tar.gz: b11fdb0841dd2027f12ec1c4c922316cef4cfb90ac0c4dc9e925de065268df1c
5
5
  SHA512:
6
- metadata.gz: 3c61d2467300415d231fab11762e54c8a5e17ec7fb91f47af5f3aff9db72c85b30353d505354642e420513059bd7227bcb88a31f921d44929a9ba66150e626c7
7
- data.tar.gz: 90718eb044f351c618a7a7c9490f156e010053083668aad75f31f6b5b7b95fca4142785193286b8b92008a3b7cc954b7724a7c1bc04a05786929ec290016aabb
6
+ metadata.gz: 264a9de9c49a2a6966059b1f96034fc1921c0b39b14113cb2c328411b0b2ca4bf1f41da83793fa54c4d900706c6e711999444722a9fabfc508c41693d2381b47
7
+ data.tar.gz: a1c20c1255a0d1b5761a8d9c2e6ef9498329ffeee2ce7fe6a9efcdc25fc3996190334034858c552af616089bcfb31de0b960530b5ee12de2ae91e8352b2f15a5
@@ -10,4 +10,6 @@ require 'cocoapods-privacy/privacy/PrivacyUtils'
10
10
  require 'cocoapods-privacy/privacy/PrivacyModule'
11
11
  require 'cocoapods-privacy/privacy/PrivacyHunter'
12
12
  require 'cocoapods-privacy/privacy/PrivacyConfig'
13
+ require 'cocoapods-privacy/privacy/PrivacyLog'
14
+
13
15
 
@@ -1,3 +1,3 @@
1
1
  module CocoapodsPrivacy
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.4"
3
3
  end
@@ -198,9 +198,6 @@ module PrivacyHunter
198
198
 
199
199
  #搜索所有子文件夹
200
200
  def self.search_files(folder_paths, apis)
201
- #清除上一次log
202
- clean_log()
203
-
204
201
  # 获取文件夹下所有文件(包括子文件夹)
205
202
  all_files = []
206
203
  folder_paths.each do |folder|
@@ -223,28 +220,11 @@ module PrivacyHunter
223
220
 
224
221
  unless api_contains.empty?
225
222
  log = "File #{file_path} contains the keyword '#{api_contains.keys}'.\n"
226
- write_log(log)
223
+ PrivacyLog.write_to_result_log(log)
227
224
  end
228
225
  end
229
- puts "详细log请查看 #{PrivacyUtils.cache_log_file} 文件"
226
+ PrivacyLog.write_to_result_log("\n") if !apis_found.empty?
230
227
  apis_found
231
228
  end
232
-
233
- def self.write_log(log)
234
- log_file_path = PrivacyUtils.cache_log_file
235
- is_create = PrivacyUtils.create_file_and_fold_if_no_exit(log_file_path,log)
236
- unless is_create
237
- File.open(log_file_path, "a") do |file|
238
- file << log
239
- end
240
- end
241
- end
242
-
243
- def self.clean_log()
244
- File.open(PrivacyUtils.cache_log_file, "w") do |file|
245
- # 写入空字符串,清空文件内容
246
- file.write("")
247
- end
248
- end
249
229
  end
250
230
 
@@ -0,0 +1,28 @@
1
+ require 'cocoapods-privacy/command'
2
+
3
+ module PrivacyLog
4
+
5
+ # 提示log 存放地址
6
+ def self.result_log_tip()
7
+ puts "详细log请查看 #{PrivacyUtils.cache_log_file} 文件"
8
+ end
9
+
10
+ # 写入结果log 文件
11
+ def self.write_to_result_log(log)
12
+ log_file_path = PrivacyUtils.cache_log_file
13
+ is_create = PrivacyUtils.create_file_and_fold_if_no_exit(log_file_path,log)
14
+ unless is_create
15
+ File.open(log_file_path, "a") do |file|
16
+ file << log
17
+ end
18
+ end
19
+ end
20
+
21
+ # 清除结果log文件
22
+ def self.clean_result_log()
23
+ File.open(PrivacyUtils.cache_log_file, "w") do |file|
24
+ # 写入空字符串,清空文件内容
25
+ file.write("")
26
+ end
27
+ end
28
+ end
@@ -190,20 +190,25 @@ module PrivacyModule
190
190
  project.save
191
191
 
192
192
  # 开始检索api,并返回json 字符串数据
193
+ PrivacyLog.clean_result_log()
193
194
  json_data = PrivacyHunter.search_pricacy_apis(folds)
194
195
 
195
196
  # 将数据写入隐私清单文件
196
197
  PrivacyHunter.write_to_privacy(json_data,privacy_file_path)
198
+ PrivacyLog.result_log_tip()
197
199
  end
198
200
 
199
201
  # 处理组件
200
202
  def self.load_module(podspec_file_path)
201
203
  puts "👇👇👇👇👇👇 Start analysis component privacy 👇👇👇👇👇👇"
204
+ PrivacyLog.clean_result_log()
202
205
  privacy_hash = PrivacyModule.check(podspec_file_path)
203
206
  privacy_hash.each do |privacy_file_path, source_files|
207
+ PrivacyLog.write_to_result_log("#{privacy_file_path}: \n")
204
208
  data = PrivacyHunter.search_pricacy_apis(source_files)
205
209
  PrivacyHunter.write_to_privacy(data,privacy_file_path) unless data.empty?
206
210
  end
211
+ PrivacyLog.result_log_tip()
207
212
  puts "👆👆👆👆👆👆 End analysis component privacy 👆👆👆👆👆👆"
208
213
  end
209
214
 
@@ -131,7 +131,7 @@ module Pod
131
131
  def validate_development_pods(name)
132
132
  result = nil
133
133
  development_pods = @sandbox.development_pods
134
- if name && !name.empty? development_pods && !development_pods.empty?
134
+ if name && !name.empty? && development_pods && !development_pods.empty?
135
135
  podspec_file_path = development_pods[name]
136
136
  if podspec_file_path && !podspec_file_path.empty?
137
137
  result = podspec_file_path
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-privacy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - youhui
@@ -57,6 +57,7 @@ files:
57
57
  - lib/cocoapods-privacy/gem_version.rb
58
58
  - lib/cocoapods-privacy/privacy/PrivacyConfig.rb
59
59
  - lib/cocoapods-privacy/privacy/PrivacyHunter.rb
60
+ - lib/cocoapods-privacy/privacy/PrivacyLog.rb
60
61
  - lib/cocoapods-privacy/privacy/PrivacyModule.rb
61
62
  - lib/cocoapods-privacy/privacy/PrivacyUtils.rb
62
63
  - lib/cocoapods-privacy/privacy/privacy_installer_hook.rb