cocoapods-privacy 0.0.5 → 0.1.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: 9e2c2edb2a21e1dc73f639fab1bd7b78eda9e0caeecd8597378c8f8b4c4f35c2
4
- data.tar.gz: 8f98ddf47a36beebbc8c80b3da3fad5f0cfccfd0a0b491e81af13bf1f156e16f
3
+ metadata.gz: ad82b3ef0ee76d32a2323649deca0e0aade7ac3ce2b4833917b22e99bd4f2842
4
+ data.tar.gz: 5907b1321ca9eb9d496335743bff10cb49e666250eabc829e06c7728cb58b2b3
5
5
  SHA512:
6
- metadata.gz: 407e0cf2c260455f3bfed2232b656317b140759018dae8ce9eb6aa605c3df316d07ef772c23b2aa823a03790088257c5763e5bf73f2e70d0342783df5c953fc6
7
- data.tar.gz: 5c2859958cdfafb1ef978d1ede514595caaaf73a9bd864a84eb7a1522f0d40768a3310b67d7206b68c95f16514a9b22cb014e6b23215cbd70e19d2f861ccd1c2
6
+ metadata.gz: 499e6b195d45c6c87e8717cc0e84e670b8466ca8e8602170dee521af9bcf536a9fd8bc387a2f5097857de43eeb5fe73860030b45431578e629738fa1449af931
7
+ data.tar.gz: d6f72bc25b077147fa7e12489a45ca95401a9d9bef3f40efb7cf04feca3e488f94622fc531115a6b710dd31ef6154f947b37bdf85236024c5371dc7da666bd6d
@@ -1,3 +1,3 @@
1
1
  module CocoapodsPrivacy
2
- VERSION = "0.0.5"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -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 !@privacy_sources.empty?
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 !@privacy_sources.empty?
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.first.content)
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 + 2)
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.0.5
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-26 00:00:00.000000000 Z
11
+ date: 2024-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler