cocoapods-vipers 0.0.2 → 0.0.4

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: 86b30e5d6e15ed51aaebf0a319486a94530134f1663c68feda794775bb729902
4
- data.tar.gz: e63128f12a5d242607c43d5ca5b94f671cf17ab4ea62633d06da9b68bb66d9a7
3
+ metadata.gz: 955f762815a084b35b851037fc3b3a82be44f13ce49cef0f496cf70f32bde70d
4
+ data.tar.gz: 208b7100f16ac29a91797b282d7344c89931e60acd6202f0a17184b37818a7e2
5
5
  SHA512:
6
- metadata.gz: a9a743d62ebebc9917ad3526a2293029d3c3d9b140fdd30f3c9bf8a91e32070193f537fa8842654d6c2f1a0c546fa0b17b30ebb218a4996c80952840364c5133
7
- data.tar.gz: a9d221391e997d9cd4d4b007359b4098ae54b229b2e5e7b85853f5b8a8d03915d0905a18a4c6a2248ad0f0ee4fb425319b1f69df6952d2859beece030849a80d
6
+ metadata.gz: 64e2b36364468a508cd87c9f7c9b711c66aa661acd7f9f6b509d92aeaa9a8d0f3d08a348621f518393d077143d3927a5020a9b682af2697c8cae22f87e558d3c
7
+ data.tar.gz: 904ca06ed03e28b425574535cccc87660fe05526505c8bf07996e4e75cb46adbe088ccdc2ac02b2dd152f9ea083426a81f30b1df2010ff6fc714bdf60b6b1c74
@@ -1,3 +1,3 @@
1
1
  module CocoapodsVipers
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -47,7 +47,7 @@ def handleClsAndMethod(viper, vipers_params_class, vipers_ext_func)
47
47
  #{assign_lines_text}
48
48
  }
49
49
  required public init() {
50
- fatalError("init() has not been implemented")
50
+ print("default init")
51
51
  }
52
52
  }
53
53
  RUBY
@@ -128,7 +128,7 @@ end
128
128
 
129
129
  module CocoapodsVipers
130
130
  class Vipers
131
- def sync(paths)
131
+ def sync(paths, pods)
132
132
  Pod::UI.puts "Synchronizing Vipers yml"
133
133
 
134
134
  if !File.exists?("vipers_config.yml")
@@ -143,6 +143,7 @@ module CocoapodsVipers
143
143
  extension_template_path = json['extension_template_path']
144
144
  prorocols_template_path = json['prorocols_template_path']
145
145
  protocols_path = json['hycan_service_injects_protocols_path']
146
+ pod_frameworks_all_path = json['pod_frameworks_all_path']
146
147
 
147
148
  flag = check_duplicate_viper(paths, main_project_vipers_json_path, vipers_json_path)
148
149
 
@@ -150,6 +151,22 @@ module CocoapodsVipers
150
151
  raise "viper脚本执行失败,出现重复定义的viper: #{flag['viper']}"
151
152
  end
152
153
 
154
+ check_unused_pods = false
155
+
156
+ if json['check_unused_pods'] == 'true'
157
+ check_unused_pods = true
158
+ end
159
+
160
+ framework_array = pods
161
+
162
+ if pod_frameworks_all_path
163
+ if File.exists?(pod_frameworks_all_path)
164
+ fileData = File.read(pod_frameworks_all_path)
165
+ all_framework = JSON.parse(fileData)
166
+ framework_array = all_framework
167
+ end
168
+ end
169
+
153
170
  should_check = false
154
171
  if json['check_json'] == 'true'
155
172
  should_check = true
@@ -218,12 +235,51 @@ module CocoapodsVipers
218
235
  vipers_case.push("\n")
219
236
  vipers_create_binder.push(" }\n")
220
237
 
238
+ # 检测模块内未使用的Pods-framework
239
+ if check_unused_pods
240
+ # Pod::UI.puts "检测模块内未使用的Pods-framework"
241
+ dir_path = spec_path + '/' + data_hash["moduleName"]
242
+ if spec['spec_name'] == main_project_vipers_json_path
243
+ dir_path = '.' + '/HycanCommunity/Swift'
244
+ end
245
+
246
+ traverse_dir(dir_path) { |f|
247
+ if f.to_s() =~ /\.swift$/ || f.to_s() =~ /\.h$/ || f.to_s() =~ /\.m$/
248
+ lineNumber = 0
249
+ IO.readlines(f).each { |line|
250
+ framework_array.each do |framew|
251
+ if line =~ /^[\/\/]/
252
+ else
253
+ if line.index("#import <#{framew}")
254
+ # Pod::UI.puts "in file: #{f} - line in #{data_hash["moduleName"]}"
255
+ # Pod::UI.puts line
256
+ framework_array.delete(framew)
257
+ break
258
+ end
259
+
260
+ if line.index("import #{framew}")
261
+ # Pod::UI.puts "in file: #{f} - line in #{data_hash["moduleName"]}"
262
+ # Pod::UI.puts line
263
+ framework_array.delete(framew)
264
+ break
265
+ end
266
+ end
267
+ end
268
+ if lineNumber > 200
269
+ break
270
+ end
271
+ lineNumber += 1
272
+ }
273
+ end
274
+ }
275
+ end
276
+
221
277
  # 检测模块内是否有未定义的 class
222
278
  if should_check
223
- # --check
279
+ # Pod::UI.puts "检测模块内是否有未定义的 class"
224
280
  dir_path = spec_path + '/' + data_hash["moduleName"]
225
281
  if spec['spec_name'] == main_project_vipers_json_path
226
- dir_path = '.' + '/HycanCommunity/Swift'
282
+ dir_path = '.' + '/HycanCommunity/Swift'
227
283
  end
228
284
  traverse_dir(dir_path) { |f|
229
285
  if f.to_s() =~ /\.swift$/
@@ -250,6 +306,11 @@ module CocoapodsVipers
250
306
  end
251
307
  end
252
308
 
309
+ if check_unused_pods
310
+ Pod::UI.puts "以下 Pod 的 Framework 在主工程+Pod工程都没找到定义"
311
+ Pod::UI.puts framework_array.to_s()
312
+ end
313
+
253
314
  injection_vipers_case = vipers_case.join("\n")
254
315
  injection_vipers_params_class = vipers_params_class.join("\n")
255
316
  injection_vipers_ext_func = vipers_ext_func.join("\n")
@@ -5,6 +5,7 @@ module CocoapodsVipers
5
5
 
6
6
  Pod::HooksManager.register('cocoapods-vipers', :pre_install) do |_context, _|
7
7
  paths = []
8
+ pods = []
8
9
  puts 'vipers hook pre_install'
9
10
  dependencies = _context.podfile.dependencies
10
11
  dependencies.each do |d|
@@ -17,8 +18,9 @@ module CocoapodsVipers
17
18
  # puts d.external_source[:path]
18
19
  paths.push({ 'spec_path' => d.external_source[:path], 'spec_name' => d.name })
19
20
  end
21
+ pods.push(d.name)
20
22
  end
21
- CocoapodsVipers::Vipers.new.sync(paths)
23
+ CocoapodsVipers::Vipers.new.sync(paths, pods)
22
24
  end
23
25
 
24
26
  Pod::HooksManager.register('cocoapods-vipers', :post_install) do |context|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-vipers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - fengjx
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-13 00:00:00.000000000 Z
11
+ date: 2022-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -53,7 +53,7 @@ files:
53
53
  - lib/cocoapods-vipers/template/Vipers+Extension.swift
54
54
  - lib/cocoapods-vipers/vipers-sync.rb
55
55
  - lib/cocoapods_plugin.rb
56
- homepage: https://github.com/EXAMPLE/cocoapods-vipers
56
+ homepage: https://github.com/Cellphoness/cocoapods-vipers/
57
57
  licenses:
58
58
  - MIT
59
59
  metadata: {}
@@ -72,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
72
  - !ruby/object:Gem::Version
73
73
  version: '0'
74
74
  requirements: []
75
- rubygems_version: 3.1.4
75
+ rubygems_version: 3.3.11
76
76
  signing_key:
77
77
  specification_version: 4
78
78
  summary: cocoapods-vipers generate VIPER enum and medthod for Router which is in HycanServices