cocoapods-privacy 0.2.0 → 0.2.1

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: 764dcd8e0be43bcb5ca3309ba79d166d19a3ac25ea641c397cc6cc66b9622f61
4
- data.tar.gz: 1a4724dcc2a679182539db7f04901311b520c3e4dd2fee94f23b6aad6521ad43
3
+ metadata.gz: 11b2bf9e6e9cd3c863067c2e4e4bcf9db70d734b2d3786dfba8c881dcdc58a16
4
+ data.tar.gz: 4bf64cdce7e18acfef794f43a92371a2633bdcfae75d593a60c7c0e481975235
5
5
  SHA512:
6
- metadata.gz: 29d51dce9a7bafb95aab4e5c0afd66357c66f540a30c031cdaece060b2eb7e7f2bb2b8ce80bc20315a4b2aac9ce7f639f742551167e6cdf8fc0e2160ae87a22f
7
- data.tar.gz: 94fad012858ccbdd2080ae9ae3c2c9ea7b964c8d2c3bdda980f902fa2c47c78a4646e5a0eaff754c86e01c95d2e11f6c0725e5a4db380c7aed4a7931b85469c9
6
+ metadata.gz: 228886b2f261e7850e7531ceecdd282fe483589f8abf014c3e27fa933cb652c941c7e50276d7d13f50487cd5e5d97d9c04c47bbc62bb110502e0f573ac59f410
7
+ data.tar.gz: f2b7d99c39f6cd2e15f1943ac49fa6285595632fdef523504d973cb5e0f652daee9ace8bed17dc1652ae87a8b776c93b920272aae131796718004953aef2c6ee
@@ -1,3 +1,3 @@
1
1
  module CocoapodsPrivacy
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -108,13 +108,11 @@ module PrivacyHunter
108
108
 
109
109
  # 删除临时文件
110
110
  File.delete(temp_plist)
111
-
112
111
  end
113
112
 
114
113
 
115
114
  private
116
115
 
117
-
118
116
  def self.fetch_template_plist_file
119
117
 
120
118
  unless File.exist?(PrivacyUtils.cache_config_file)
@@ -200,6 +198,8 @@ module PrivacyHunter
200
198
 
201
199
  #搜索所有子文件夹
202
200
  def self.search_files(folder_paths, apis)
201
+ #清除上一次log
202
+ clean_log()
203
203
 
204
204
  # 获取文件夹下所有文件(包括子文件夹)
205
205
  all_files = []
@@ -218,10 +218,33 @@ module PrivacyHunter
218
218
  # 遍历文件进行检索
219
219
  apis_found = {}
220
220
  all_files.uniq.each_with_index do |file_path, index|
221
- apis_found = apis_found.merge(contains_apis?(file_path, apis))
222
- puts "File #{file_path} contains the keyword '#{apis_found.keys}'." unless apis_found.empty?
221
+ api_contains = contains_apis?(file_path, apis)
222
+ apis_found = apis_found.merge(api_contains)
223
+
224
+ unless api_contains.empty?
225
+ log = "File #{file_path} contains the keyword '#{api_contains.keys}'.\n"
226
+ write_log(log)
227
+ end
223
228
  end
229
+ puts "详细log请查看 #{PrivacyUtils.cache_log_file} 文件"
224
230
  apis_found
225
231
  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
226
249
  end
227
250
 
@@ -71,6 +71,11 @@ module PrivacyUtils
71
71
  config_file = File.join(cache_privacy_fold, 'config.json')
72
72
  end
73
73
 
74
+ # config.json 文件
75
+ def self.cache_log_file
76
+ config_file = File.join(cache_privacy_fold, 'privacy.log')
77
+ end
78
+
74
79
  # 创建默认隐私协议文件
75
80
  def self.create_privacy_if_empty(file_path)
76
81
  # 文件内容
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.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - youhui