cocoapods-privacy 0.1.6 → 0.1.8

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: 84dea61fc2bc984ef88adabe1aa4de41f27b05dbea00a570ae1dc2e2a43966e3
4
- data.tar.gz: 61ba57f0692ca5c5034379f0c1abc02c7dd6b69048c3fe033981115b2f729c63
3
+ metadata.gz: 9b4a00e9abc854afbf658a6361ed8934fd35fa2c08acf7cc17e8a05ffa9f515d
4
+ data.tar.gz: 70c3102a4c9b371f4c1eb38317dcc4e1f568c19a95349b146902126029742a08
5
5
  SHA512:
6
- metadata.gz: f5c68b15d9089e1cd43732c1f33e302748e4d8bbb6abf6c74394d5ce3bdd4bf57e5fe1a26dfba9ce6530b9f12e9b1deda38fc73e3089f8f0778b746a94d75867
7
- data.tar.gz: 76a55bb3e4486e640ff20a909863f49cdf3e19b120c06e28346e6898a9cc9d745a8568b197d230abc925b240660cf3c11de18fd8b7756fdf8346c23805f4dc27
6
+ metadata.gz: 0d8074f3e754caa905a5452b9e232599654e626f0a119ec1dedf7c5c960c85826ed084a6d52f1f5d32afa81024a68782e4391bda61ca9114857f563722d58d6c
7
+ data.tar.gz: 13248a72deadcf1117be0c135e1b2724a5106d99654f499081cbbfb53c50bf6c443bf9fe8e81d1ab0894a5e31168c98ea5a722c554ae9b41ad9d26c2ee54c3c5
data/README.md CHANGED
@@ -4,8 +4,9 @@ Apple 2024 will review the App's privacy list in the spring, and any apps that d
4
4
  [Click to view details on Apple](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files)
5
5
 
6
6
  ## Installation
7
-
8
- $ gem install cocoapods-privacy
7
+ ```
8
+ $ gem install cocoapods-privacy
9
+ ```
9
10
 
10
11
  ## Usage
11
12
  #### init
@@ -26,7 +27,7 @@ There has 3 keys in defalut config, you should custom it!
26
27
 
27
28
  #### To Component
28
29
  ```
29
- $ pod privacy spec [podspec_file_path]
30
+ $ pod privacy spec [podspec_file_path]
30
31
  ```
31
32
  This command will auto create privacy file, and search the path of podspec' source_files' define relate to NSPrivacyAccessedAPITypes, finaly, write to PrivacyInfo.xcprivacy file.
32
33
  if your component has much subspec, all subspec that define ‘source_files’ will create PrivacyInfo.xcprivacy, and auto modify .podspec link .xcprivacy to 'resource_bundle' key.
@@ -68,9 +69,9 @@ end
68
69
 
69
70
  #### To Project
70
71
  ```
71
- $ pod install --privacy
72
- or
73
- $ pod privacy install
72
+ $ pod install --privacy
73
+ or
74
+ $ pod privacy install
74
75
  ```
75
76
  <img width="298" alt="截屏2024-02-02 10 59 59" src="https://github.com/ymoyao/cocoapods-privacy/assets/13619221/c6f10e36-0f62-497a-93d4-f8b336dc8df4">
76
77
 
@@ -1,3 +1,3 @@
1
1
  module CocoapodsPrivacy
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.8"
3
3
  end
@@ -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) || !line.key || line.key.empty?
108
+ if !line || line.is_a?(BBSpec)
108
109
  next
109
110
  end
110
111
 
111
- if !line.is_comment && line.key.include?(".resource_bundle")
112
- origin_resource_bundle = eval(line.value)
113
- merged_resource_bundle = origin_resource_bundle.merge(privacy_resource_bundle)
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
- line.value = merged_resource_bundle
117
- line.content = "#{line.key}= #{line.value}"
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
@@ -98,8 +98,12 @@ module Pod
98
98
  podspec_fold_path = File.dirname(podspec_file_path)
99
99
  source_files = spec.attributes_hash['source_files']
100
100
  if source_files && !source_files.empty?
101
- source_files.each do |file|
102
- development_folds << File.join(podspec_fold_path,file)
101
+ if source_files.is_a?(String) && !source_files.empty?
102
+ development_folds << File.join(podspec_fold_path,source_files)
103
+ elsif source_files.is_a?(Array)
104
+ source_files.each do |file|
105
+ development_folds << File.join(podspec_fold_path,file)
106
+ end
103
107
  end
104
108
  end
105
109
  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.1.6
4
+ version: 0.1.8
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-02 00:00:00.000000000 Z
11
+ date: 2024-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler