cocoapods-privacy 0.0.4 → 0.1.0

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: 64e41974c11a4cce1a54f6d7de0cc2d414199e0f5ec4c67c81957390b2146bf3
4
- data.tar.gz: d0c27ba90d2b5afe6f3da91840891a530f48f5ee6df28a5d1b68974fb4e83572
3
+ metadata.gz: 169d976a4180a55f5ad139c4db9c1693eeccf2147077d92aa638eaf65ca4314f
4
+ data.tar.gz: 63cc1f7128d7117ecf373408c1309fa21917b3c06588b59b000b10de6eeb65c2
5
5
  SHA512:
6
- metadata.gz: 67a8d37e7962e500accfbda1adfbc6b7ee5c70384d133fe6111fe02ee9e678a44c66aca0636d7617d76874378c6964c081e26cfee5acab871fc8a852090344f9
7
- data.tar.gz: 1787aadcd2206e1ca494f8e77f1cfa1c3a75d02c7b893d2aaadbf38b4160b5d4b95cd9b46ed9d3dda4e8a94a0826d0d6a78224d3a9a4e429b720dbc0e151c3aa
6
+ metadata.gz: 6cff9908e2198aa3068029f9e1b40603bfa279d73933f7099763cd91be76128db9e3b000cdf9182dfe84f11ced41954c63e0524041b8c8e681138fb29416df8b
7
+ data.tar.gz: 564d4fa4e65c300b9009e54e54747728c5cc0f57b25c8e566a9ed0a5323d98044dd53efe22fd1c307fc9ebf38f309f028cdc72f18052123990c4740d0775dd35
@@ -22,6 +22,8 @@ module Pod
22
22
  end
23
23
 
24
24
  def run
25
+ verify_podfile_exists!
26
+
25
27
  installer = installer_for_config
26
28
  installer.repo_update = false
27
29
  installer.update = false
@@ -16,6 +16,13 @@ module Pod
16
16
  @podspec_file = argv.arguments!.first
17
17
  super
18
18
  end
19
+
20
+ def validate!
21
+ @podspec_file = @podspec_file ? @podspec_file : PrivacyUtils.podspec_file_path
22
+ unless @podspec_file && !@podspec_file.empty?
23
+ raise Informative, 'no podspec file were found, please run pod privacy podspec_file_path'
24
+ end
25
+ end
19
26
 
20
27
  def run
21
28
  PrivacyModule.load_module(@podspec_file)
@@ -1,3 +1,3 @@
1
1
  module CocoapodsPrivacy
2
- VERSION = "0.0.4"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -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
@@ -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,7 +71,7 @@ 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新增隐私文件
@@ -80,7 +82,7 @@ class BBSpec
80
82
  end
81
83
 
82
84
  # 把新增的隐私文件 映射给 podspec
83
- def modify_privacy_resource_bundle_if_need
85
+ def modify_privacy_resource_bundle_if_need(source_files_index)
84
86
  if !@privacy_sources.empty?
85
87
  privacy_resource_bundle = { "#{full_name}.privacy" => @privacy_file }
86
88
  if @has_resource_bundle
@@ -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
@@ -149,12 +151,7 @@ module PrivacyModule
149
151
  end
150
152
 
151
153
  # 处理组件
152
- def self.load_module(podspec_file)
153
- podspec_file_path = podspec_file ? podspec_file : PrivacyUtils.podspec_file_path
154
- unless podspec_file_path && !podspec_file_path.empty?
155
- raise Informative, "no podspec file were found, please run `pod privacy podspec_file_path`"
156
- end
157
-
154
+ def self.load_module(podspec_file_path)
158
155
  privacy_hash = PrivacyModule.check(podspec_file_path)
159
156
  privacy_hash.each do |privacy_file_path, source_files|
160
157
  data = PrivacyHunter.search_pricacy_apis(source_files)
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.4
4
+ version: 0.1.0
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-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler