cocoapods-privacy 0.1.7 → 0.1.9
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: 3002f15cfb7bff2a3872ddceff7124881501695300162e37d9b0b4da6d197c55
|
4
|
+
data.tar.gz: 0cec2084e455bef224bb7d08174c5e3b0df86d08285dc6564239594c0a01d93e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d514b38b91b5bd46947cba044beaea0269b56a6e0154e913ade8b91a6fb625e456f5f077dd9de005b2d00d6ecdcac48caf4c767d3b3a03bb8d931cced5af5973
|
7
|
+
data.tar.gz: 69295dbcee5061ba3cc413b54da60d22870f1849d1dc5f2b8daaf9c4149ad830f1b25fdd63b23b99746c1b612c38071a08753a46daa4b2fabfbabe35ecd13021
|
@@ -182,9 +182,15 @@ module PrivacyHunter
|
|
182
182
|
# 获取文件夹下所有文件(包括子文件夹)
|
183
183
|
all_files = []
|
184
184
|
folder_paths.each do |folder|
|
185
|
-
allowed_extensions = ['m', 'c', 'swift', 'mm', 'hap', 'cpp']
|
186
|
-
pattern = File.join(folder, '**', '*.{'+allowed_extensions.join(',')+'}')
|
187
|
-
all_files += Dir.glob(pattern, File::FNM_DOTMATCH).reject { |file| File.directory?(file) }
|
185
|
+
# allowed_extensions = ['m', 'c', 'swift', 'mm', 'hap', 'cpp']
|
186
|
+
# pattern = File.join(folder, '**', '*.{'+allowed_extensions.join(',')+'}')
|
187
|
+
# all_files += Dir.glob(pattern, File::FNM_DOTMATCH).reject { |file| File.directory?(file) }
|
188
|
+
|
189
|
+
# 使用 Dir.glob 方法直接获取符合条件的文件路径
|
190
|
+
files_in_folder = Dir.glob(folder, File::FNM_DOTMATCH)
|
191
|
+
|
192
|
+
# 过滤掉目录路径,只保留文件路径,并将其添加到 all_files 数组中
|
193
|
+
all_files += files_in_folder.reject { |file| File.directory?(file) }
|
188
194
|
end
|
189
195
|
# 遍历文件进行检索
|
190
196
|
all_files.uniq.each_with_index do |file_path, index|
|
@@ -103,18 +103,42 @@ class BBSpec
|
|
103
103
|
if @privacy_sources
|
104
104
|
privacy_resource_bundle = { "#{full_name}.privacy" => @privacy_file }
|
105
105
|
if @has_resource_bundle
|
106
|
+
line_incomplete = nil
|
106
107
|
@rows.each_with_index do |line, index|
|
107
|
-
if !line || line.is_a?(BBSpec)
|
108
|
+
if !line || line.is_a?(BBSpec)
|
108
109
|
next
|
109
110
|
end
|
110
111
|
|
111
|
-
|
112
|
-
|
113
|
-
|
112
|
+
is_resource_bundle_line = line.key && line.key.include?(".resource_bundle")
|
113
|
+
if !line.is_comment && (is_resource_bundle_line || line_incomplete)
|
114
|
+
begin
|
115
|
+
if line_incomplete
|
116
|
+
code = "#{line_incomplete.value}#{line.content}"
|
117
|
+
else
|
118
|
+
code = "#{line.value}"
|
119
|
+
end
|
120
|
+
|
121
|
+
# 清除 content 和 value, 后面会把所有的resource_bundle 组装起来,多余的内容要清除,避免重复
|
122
|
+
line.content = ''
|
123
|
+
line.value = nil
|
124
|
+
|
125
|
+
RubyVM::InstructionSequence.compile(code)
|
126
|
+
origin_resource_bundle = eval(code)
|
127
|
+
rescue SyntaxError, StandardError => e
|
128
|
+
unless line_incomplete
|
129
|
+
line_incomplete = line
|
130
|
+
end
|
131
|
+
line_incomplete.value = code if line_incomplete #存储当前残缺的value,和后面完整的进行拼接
|
132
|
+
next
|
133
|
+
end
|
134
|
+
|
135
|
+
final_line = (line_incomplete ? line_incomplete : line)
|
114
136
|
|
137
|
+
merged_resource_bundle = origin_resource_bundle.merge(privacy_resource_bundle)
|
115
138
|
@resource_bundle = merged_resource_bundle
|
116
|
-
|
117
|
-
|
139
|
+
final_line.value = merged_resource_bundle
|
140
|
+
final_line.content = "#{final_line.key}= #{final_line.value}"
|
141
|
+
break
|
118
142
|
end
|
119
143
|
end
|
120
144
|
else
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-privacy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- youhui
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-02-
|
11
|
+
date: 2024-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|