cocoapods-privacy 0.0.5 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cocoapods-privacy/gem_version.rb +1 -1
- data/lib/cocoapods-privacy/privacy/PrivacyModule.rb +12 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad82b3ef0ee76d32a2323649deca0e0aade7ac3ce2b4833917b22e99bd4f2842
|
4
|
+
data.tar.gz: 5907b1321ca9eb9d496335743bff10cb49e666250eabc829e06c7728cb58b2b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 499e6b195d45c6c87e8717cc0e84e670b8466ca8e8602170dee521af9bcf536a9fd8bc387a2f5097857de43eeb5fe73860030b45431578e629738fa1449af931
|
7
|
+
data.tar.gz: d6f72bc25b077147fa7e12489a45ca95401a9d9bef3f40efb7cf04feca3e488f94622fc531115a6b710dd31ef6154f947b37bdf85236024c5371dc7da666bd6d
|
@@ -33,7 +33,7 @@ class BBSpec
|
|
33
33
|
|
34
34
|
def initialize(name,alias_name,full_name)
|
35
35
|
@rows = []
|
36
|
-
@privacy_sources =
|
36
|
+
@privacy_sources = nil
|
37
37
|
@name = name
|
38
38
|
@alias_name = alias_name
|
39
39
|
@full_name = full_name
|
@@ -41,6 +41,7 @@ class BBSpec
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def privacy_handle(podspec_file_path)
|
44
|
+
source_files_index = 1
|
44
45
|
@rows.each_with_index do |line, index|
|
45
46
|
if !line || line.is_a?(BBSpec) || !line.key || line.key.empty?
|
46
47
|
next
|
@@ -52,7 +53,7 @@ class BBSpec
|
|
52
53
|
spec = eval("Pod::Spec.new do |s|; s.source_files = #{line.value}; end;")
|
53
54
|
if spec && !spec.attributes_hash['source_files'].nil?
|
54
55
|
source_files_value = spec.attributes_hash['source_files']
|
55
|
-
if source_files_value.is_a?(String)
|
56
|
+
if source_files_value.is_a?(String) && !source_files_value.empty?
|
56
57
|
source_files_array = [source_files_value]
|
57
58
|
elsif source_files_value.is_a?(Array)
|
58
59
|
# 如果已经是数组,直接使用
|
@@ -62,6 +63,7 @@ class BBSpec
|
|
62
63
|
source_files_array = []
|
63
64
|
end
|
64
65
|
|
66
|
+
source_files_index = index
|
65
67
|
@privacy_sources = source_files_array.map do |file_path|
|
66
68
|
File.join(File.dirname(podspec_file_path), file_path.strip)
|
67
69
|
end
|
@@ -69,19 +71,19 @@ class BBSpec
|
|
69
71
|
end
|
70
72
|
end
|
71
73
|
create_privacy_file_if_need(podspec_file_path)
|
72
|
-
modify_privacy_resource_bundle_if_need()
|
74
|
+
modify_privacy_resource_bundle_if_need(source_files_index)
|
73
75
|
end
|
74
76
|
|
75
77
|
# 对应Spec新增隐私文件
|
76
78
|
def create_privacy_file_if_need(podspec_file_path)
|
77
|
-
if
|
79
|
+
if @privacy_sources
|
78
80
|
PrivacyUtils.create_privacy_if_empty(File.join(File.dirname(podspec_file_path), @privacy_file))
|
79
81
|
end
|
80
82
|
end
|
81
83
|
|
82
84
|
# 把新增的隐私文件 映射给 podspec
|
83
|
-
def modify_privacy_resource_bundle_if_need
|
84
|
-
if
|
85
|
+
def modify_privacy_resource_bundle_if_need(source_files_index)
|
86
|
+
if @privacy_sources
|
85
87
|
privacy_resource_bundle = { "#{full_name}.privacy" => @privacy_file }
|
86
88
|
if @has_resource_bundle
|
87
89
|
@rows.each_with_index do |line, index|
|
@@ -99,11 +101,11 @@ class BBSpec
|
|
99
101
|
end
|
100
102
|
end
|
101
103
|
else
|
102
|
-
space = PrivacyUtils.count_spaces_before_first_character(rows.
|
104
|
+
space = PrivacyUtils.count_spaces_before_first_character(rows[source_files_index].content)
|
103
105
|
line = "#{alias_name}.resource_bundle = #{privacy_resource_bundle}"
|
104
|
-
line = PrivacyUtils.add_spaces_to_string(line,space
|
106
|
+
line = PrivacyUtils.add_spaces_to_string(line,space)
|
105
107
|
row = BBRow.new(line)
|
106
|
-
@rows.insert(1, row)
|
108
|
+
@rows.insert(source_files_index+1, row)
|
107
109
|
end
|
108
110
|
end
|
109
111
|
end
|
@@ -182,7 +184,7 @@ module PrivacyModule
|
|
182
184
|
|
183
185
|
|
184
186
|
# Step 6: 获取privacy 相关信息,传递给后续处理
|
185
|
-
privacy_hash = fetch_privacy_hash(combin_sepcs_and_rows,podspec_file_path)
|
187
|
+
privacy_hash = fetch_privacy_hash(combin_sepcs_and_rows,podspec_file_path).compact
|
186
188
|
filtered_privacy_hash = privacy_hash.reject { |_, value| value.empty? }
|
187
189
|
filtered_privacy_hash
|
188
190
|
end
|
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.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- youhui
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01-
|
11
|
+
date: 2024-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|