cocoapods-bb-PodAssistant 0.1.5.1 → 0.1.6

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: 4f28225f78453b91584c65af22176c0a36c55679bc6aa8ce273a6248c18a5602
4
- data.tar.gz: 3e8130c32e18020f89f660a581e50d1d152fd73c41dfa1c37d5cc95d3ffdfa28
3
+ metadata.gz: a4d73bccc2529481814cc586c3d0cb46b863c986741859ac8d399f1a8962ed1c
4
+ data.tar.gz: d96718876d58008ffa7e846cae38e68d46358fe3e88effd7477b669b514ede12
5
5
  SHA512:
6
- metadata.gz: dd13a647bdd0906b30f4d4640614ba33cf8ac014b378bac59a1ba562feb1af73d9ee85c9596c165eee906f010de5b599c41b3fadb5ddf6acfa6a5a5032f8fbf0
7
- data.tar.gz: 5d277674798ae013dec5330a42a282dbcfd2a705238774fb288c54fd75bed95876b7ea2d1d42db1f652522f0765f5fd7c32936f97a69fc56bcdee4a762833175
6
+ metadata.gz: 979d7c8365b57c364e953ebe616d55be2c40c5547a72d42089db504123d9188bfe8920ede679ec412128e41cca44feaec052d32d1163c60b7434d022be2dfba4
7
+ data.tar.gz: c86d930fdd7cc595ea411b235ce98b18e8c105665b178a05938f9f4e942a20530bb83a5ac2dabb6a530022d0f82f2373adf6951d55984d2473b15d52d93e2a0f
@@ -114,7 +114,7 @@ module Pod
114
114
  ll_fetch_stale_git
115
115
  # 数据合并
116
116
  source_manager.merge_stable_data
117
- puts "[PodAssistant] `pod stable` complete!".green
117
+ puts "[PodAssistant] `pod stable` complete! Please execute the [pod install/ pod update] command".green
118
118
  else
119
119
  puts "[PodAssistant] `pod stable` 帮助文档请查看👇".yellow
120
120
  banner!
@@ -29,7 +29,12 @@ module BB
29
29
  # 产品线本地lock数据
30
30
  def fetch_local_stable_datas
31
31
  localSpec = BB::StableSpecs.new()
32
- return localSpec.readData(local_stable_yaml)
32
+ yml = local_stable_yaml
33
+ if !File.file?(yml)
34
+ puts "yml配置文件不存在,执行自动初始化项目yml配置文件".green
35
+ generate_localStable
36
+ end
37
+ return localSpec.readData(yml)
33
38
  end
34
39
 
35
40
  # 远端公共lock数据
@@ -231,51 +236,38 @@ module BB
231
236
  return lockfile
232
237
  end
233
238
 
239
+ # 生成项目stable配置文件
240
+ # 策略:根据podfile.lock dependencies依赖记录pod core标签/分支数据,不存储subspec数据
234
241
  def generate_localStable
235
242
  lockfile = podfile_lock
236
243
  local_specs = {}
237
- # step.1 获取分支指向信息
238
244
  dependencies = lockfile.dependencies
239
245
  dependencies.each do | dependency |
246
+ pod_name = dependency.name
247
+ if has_include_subspec(pod_name)
248
+ podCoreName = subspec_podname(pod_name)
249
+ else
250
+ podCoreName = pod_name
251
+ end
240
252
  if dependency.external_source.is_a? Hash
241
- name = dependency.name
253
+ # 指向分支
242
254
  external_source = dependency.external_source
243
- podCoreName = subspec_podname(name)
244
255
  # checkout_options = lockfile.checkout_options_for_pod_named(podCoreName)
245
256
  # if checkout_options.is_a? Hash
246
257
  # commit = checkout_options[:commit]
247
258
  # external_source[:commit] = commit
248
259
  # puts "name:#{podCoreName} checkout_options:#{checkout_options} commit:#{commit}"
249
260
  # end
250
- if podCoreName != name
251
- # local_specs.delete(podCoreName)
261
+ if !local_specs.has_key?(podCoreName)
252
262
  local_specs[podCoreName] = external_source
253
- if (!has_include_core_subspec(name)) # 过滤core数据
254
- local_specs[name] = external_source
255
- Pod::UI.puts "[分支] #{name} => (#{external_source})"
256
- end
257
- else
258
- local_specs[name] = external_source
259
- Pod::UI.puts "[分支] #{name} => (#{external_source})"
260
- end
261
- end
262
- end
263
- # step.2 获取pods标签信息,如果存在分支优先使用分支信息
264
- lockfile.pod_names.each do |pod_name|
265
- version = lockfile.version(pod_name)
266
- podCoreName = subspec_podname(pod_name)
267
- if local_specs.has_key?(podCoreName)
268
- if podCoreName != pod_name
269
- if (!has_include_core_subspec(pod_name)) # 过滤core数据
270
- # Pod::UI.puts "step.2 #{pod_name} => (#{local_specs[podCoreName]})"
271
- local_specs[pod_name] = local_specs[podCoreName]
272
- end
263
+ # puts "[分支] #{podCoreName} => (#{external_source})".yellow
273
264
  end
274
265
  else
275
- if (!has_include_core_subspec(pod_name)) # 过滤core数据
276
- ver = version.to_s
277
- local_specs[pod_name] = ver
278
- Pod::UI.puts "[标签] #{pod_name} => (#{ver})"
266
+ # 指向标签版本
267
+ version = lockfile.version(pod_name).to_s
268
+ if !version.empty? && !local_specs.has_key?(podCoreName)
269
+ local_specs[podCoreName] = version
270
+ # puts "[标签] #{podCoreName} => (#{version})".yellow
279
271
  end
280
272
  end
281
273
  end
@@ -1,3 +1,3 @@
1
1
  module CocoapodsBbPodassistant
2
- VERSION = "0.1.5.1"
2
+ VERSION = "0.1.6"
3
3
  end
@@ -14,7 +14,14 @@ module BB
14
14
  @@member_configs = [
15
15
  ]
16
16
 
17
- def initialize(all_modules, member_modules, member_configs, ignore_local_stable = false, skip_stable_check = false)
17
+ # pod组件合并
18
+ # 参数说明
19
+ # all_modules 业务使用组件
20
+ # member_modules 项目成员模块,一般用于切本地开发使用
21
+ # member_configs 项目成员工程配置
22
+ # ignore_local_stable 是否忽略本地stable配置,true 适合pod子组件
23
+ # skip_stable_check 是否跳过stable检测,true 采用标准pod合并操作
24
+ def initialize(all_modules, member_modules = {}, member_configs = [], ignore_local_stable = false, skip_stable_check = false)
18
25
  @source_manager = BB::SourceManager.new()
19
26
  #加载远程稳定仓库 和本地podfile 指定的仓库进行合并
20
27
  if skip_stable_check == true
@@ -24,7 +31,6 @@ module BB
24
31
  end
25
32
  @@member_modules = member_modules
26
33
  @@member_configs = member_configs
27
- # puts "member_modules:#{member_modules}"
28
34
  end
29
35
 
30
36
  def current_member
@@ -142,39 +148,69 @@ module BB
142
148
  }
143
149
  return podfile_hash
144
150
  end
151
+ # 合并组建数据
152
+ # 策略:本地stable作为基础数据,遍历podfile组件进行替换,变化以本地为主,标签以stable为主
145
153
  def merge_module_data(podfile_specs, local_stable_data)
146
154
  # puts "podfile_specs: #{podfile_specs}".green
147
155
  podfile_hash = convert_podfile_specs_data(podfile_specs)
148
156
  # puts "podfile_hash: #{podfile_hash}".red
149
157
  # puts "local_stable_data: #{local_stable_data}".red
150
158
  need_update_pod_data={}
151
- podfile_hash.each do |podName,pod|
152
- local_pod_data = local_stable_data[podName]
153
- if pod != local_pod_data
154
- branch = pod[:branch]
155
- git_format = pod[:git_format]
156
- version = pod[:version]
157
- podCoreName = @source_manager.subspec_podname(podName)
158
- # puts "podName:#{podName} pod:#{pod} branch:#{branch} git_format:#{git_format} version:#{version} local_pod_data:#{local_pod_data}".green
159
- if (branch && !branch.empty?) || (git_format && !git_format.empty?)
160
- # 项目配置指向分支数据,以本项目为主
161
- puts "[PodAssistant] #{podName} 指向分支数据 => #{pod}"
162
- need_update_pod_data[podCoreName] = pod
163
- end
164
- # succ = (version && !version.empty? && (local_pod_data.is_a? String) && (version != local_pod_data) && !version.include?(local_pod_data))
165
- # puts "podName:#{podName} version:#{version} succ=#{succ}".red
166
- if (version && !version.empty? && (local_pod_data.is_a? String) && (version != local_pod_data) && !version.include?(local_pod_data))
167
- version = version.lstrip # 去除首字母空格
168
- initial_str = version[0..0] # 第一个字母
169
- # 项目配置固定版本,以本项目为主
170
- is_fixed_version = initial_str.include?('=') ? true : false # 固定版本 pod 'A','= x.x.x'
171
- is_lessthan_version = version.include?('<') ? true : false # 限制《最高》组件版本 pod 'A','< x.x.x' 或者 pod 'A','<= x.x.x'
172
- is_greaterthan_version = version.include?('>') ? true : false # 限制《最低》组件版本 pod 'A','> x.x.x' 或者 pod 'A','>= x.x.x'
173
- is_fuzzy_version = version.include?('~>') ? true : false # 固定版本 pod 'A','~> x.x.x'
174
- is_fuzzy_versionV2 = (!is_fixed_version && !is_lessthan_version && !is_greaterthan_version && !is_fuzzy_version) ? true : false # 固定版本 pod 'A','x.x.x'
175
- if (is_fixed_version == true) || (is_lessthan_version == true) || (is_fuzzy_version == true) || (is_fuzzy_versionV2 == true)
176
- puts "[PodAssistant] ⚠️ 限制组件版本 '#{podName}', '#{version}' 以项目配置为主. (最新版本=> #{local_pod_data.send(:red)})"
177
- need_update_pod_data[podCoreName] = version
159
+ stable_hash = local_stable_data
160
+ podfile_hash.each do |podName,podfile_pod|
161
+ podCoreName = @source_manager.subspec_podname(podName)
162
+ if (podName == podCoreName) || @source_manager.has_pod_subspec(podName, podCoreName)
163
+ pod = stable_hash[podCoreName]
164
+ if pod.nil? # stbale没有受版本控制
165
+ need_update_pod_data[podName] = podfile_pod
166
+ else
167
+ # puts "[stable]podCoreName:#{podCoreName}(#{pod}) VS [podfile] podName:#{podName}(#{podfile_pod})".yellow
168
+ if podName == "BBWriteReview/World"
169
+ puts "[stable]podCoreName:#{podCoreName}(#{pod}) VS [podfile] podName:#{podName}(#{podfile_pod})".yellow
170
+ end
171
+ if pod == podfile_pod
172
+ if podName != podCoreName
173
+ need_update_pod_data[podName] = podfile_pod
174
+ end
175
+ else
176
+ branch = podfile_pod[:branch]
177
+ git = podfile_pod[:git]
178
+ if git.nil?
179
+ git = podfile_pod[:git_format]
180
+ end
181
+ version = podfile_pod[:version]
182
+ if (branch && !branch.empty?) || (git && !git.empty?)
183
+ # 项目配置指向分支数据,以本项目为主
184
+ puts "[PodAssistant] #{podName} 指向分支数据 => #{podfile_pod}"
185
+ stable_hash[podCoreName] = podfile_pod
186
+ if podName != podCoreName
187
+ need_update_pod_data[podName] = podfile_pod
188
+ end
189
+ elsif (version && !version.empty? && (pod.is_a? String) && (version != pod))
190
+ version = version.lstrip # 去除首字母空格
191
+ initial_str = version[0..0] # 第一个字母
192
+ # 项目配置固定版本,以本项目为主
193
+ is_fixed_version = initial_str.include?('=') ? true : false # 固定版本 pod 'A','= x.x.x'
194
+ is_lessthan_version = version.include?('<') ? true : false # 限制《最高》组件版本 pod 'A','< x.x.x' 或者 pod 'A','<= x.x.x'
195
+ is_greaterthan_version = version.include?('>') ? true : false # 限制《最低》组件版本 pod 'A','> x.x.x' 或者 pod 'A','>= x.x.x'
196
+ is_fuzzy_version = version.include?('~>') ? true : false # 固定版本 pod 'A','~> x.x.x'
197
+ is_fuzzy_versionV2 = (!is_fixed_version && !is_lessthan_version && !is_greaterthan_version && !is_fuzzy_version) ? true : false # 固定版本 pod 'A','x.x.x'
198
+ if (is_fixed_version == true) || (is_lessthan_version == true) || (is_fuzzy_versionV2 == true)
199
+ puts "[PodAssistant] ⚠️ 限制组件版本 '#{podName}', '#{version}' 以项目配置为主. (最新版本=> #{pod.send(:red)})"
200
+ stable_hash[podCoreName] = version
201
+ if podName != podCoreName
202
+ need_update_pod_data[podName] = version
203
+ end
204
+ elsif (is_greaterthan_version == true) || (is_fuzzy_version == true)
205
+ # puts "[PodAssistant] '#{podName}', '#{pod.send(:red)}' 以stable配置为主."
206
+ need_update_pod_data[podName] = pod
207
+ end
208
+ else
209
+ if podName != podCoreName
210
+ # puts "[PodAssistant] '#{podName}', '#{pod.send(:red)}' 以stable配置为主."
211
+ need_update_pod_data[podName] = pod
212
+ end
213
+ end
178
214
  end
179
215
  end
180
216
  end
@@ -182,22 +218,16 @@ module BB
182
218
  if need_update_pod_data.count > 0
183
219
  # puts "need_update_pod_data:#{need_update_pod_data}".green
184
220
  # 规避指向分支/远端版本替换yml配置所有组件,避免pod指向指向多个源
185
- need_update_pod_data.each do |podCoreName,pod|
186
- local_stable_data.keys.each do |podName|
187
- if (podName == podCoreName) || @source_manager.has_pod_subspec(podName, podCoreName)
188
- local_stable_data[podName] = pod
189
- puts "[PodAssistant] 合并组件 #{podName} #{pod} 以项目为主".yellow
190
- end
191
- end
221
+ need_update_pod_data.each do |podName,pod|
222
+ stable_hash[podName] = pod
223
+ puts "[PodAssistant] merge pod #{podName} #{pod}"
192
224
  end
193
- puts "[PodAssistant] 重新保存本地stable数据".yellow
194
- @source_manager.update_localstable_datas(local_stable_data)
195
225
  else
196
226
  puts "[PodAssistant] 本地stable数据无变化<===完成".yellow
197
227
  end
198
- # puts "local_stable_data: #{local_stable_data}".red
228
+ # puts "[PodAssistant] stable_hash:#{stable_hash}".red
199
229
  stable_specs = []
200
- local_stable_data.each do |name,pod|
230
+ stable_hash.each do |name,pod|
201
231
  if pod.is_a? Hash
202
232
  branch = pod[:branch]
203
233
  git = pod[:git]
@@ -239,7 +269,7 @@ module BB
239
269
  elsif pod.is_a? String
240
270
  stable_specs.push({ names: [name], version: pod, method: REMOTE_TAG })
241
271
  else
242
- puts "unknow type data:#{pod}".red
272
+ puts "unknow type [#{name}] data:#{pod}".red
243
273
  end
244
274
  end
245
275
  return stable_specs
@@ -47,13 +47,25 @@ module Pod
47
47
  class Podfile
48
48
  # @!group DSL support
49
49
  include Pod::Podfile::DSL
50
-
51
- # pod组件合并操作
52
- def pod_module_run(pod_modules, member_modules = {}, member_configs = [], ignore_local_stable = false, skip_stable_check = false)
50
+ # pod组件合并操作(项目)
51
+ def project_pod_module_run(pod_modules, member_modules = {}, member_configs = [], skip_stable_check = false)
52
+ # Pod::UI.puts "Pod Module:#{pod_modules}"
53
+ time1 = Time.new
54
+ puts "[PodAssistant]项目pod组件组装开始操作时间:#{time1}".green
55
+ source = BB::PodModule.new(pod_modules, member_modules, member_configs, false, skip_stable_check)
56
+ pod_box_module_run(source)
57
+ time2 = Time.new
58
+ puts "[PodAssistant]项目pod组件组装结束时间:#{time2}".green
59
+ # 获取时间差
60
+ time = time2 - time1
61
+ puts "项目pod组件组装操作耗时:#{time.to_s.send(:red)}秒".green
62
+ end
63
+ # pod组件合并操作(单组件)
64
+ def pod_module_run(pod_modules, member_modules = {}, member_configs = [])
53
65
  # Pod::UI.puts "Pod Module:#{pod_modules}"
54
66
  time1 = Time.new
55
67
  puts "[PodAssistant]pod组件组装开始操作时间:#{time1}".green
56
- source = BB::PodModule.new(pod_modules, member_modules, member_configs, ignore_local_stable, skip_stable_check)
68
+ source = BB::PodModule.new(pod_modules, member_modules, member_configs, true, true)
57
69
  pod_box_module_run(source)
58
70
  time2 = Time.new
59
71
  puts "[PodAssistant]pod组件组装结束时间:#{time2}".green
@@ -1,6 +1,7 @@
1
1
  require 'cocoapods-bb-PodAssistant/command'
2
2
  require 'csv'
3
3
  require 'xcodeproj'
4
+ require 'cocoapods-bb-PodAssistant/config/source_manager'
4
5
 
5
6
  class Dir
6
7
  def self.size(dir)
@@ -67,6 +68,9 @@ module BB
67
68
  end
68
69
  Pod::HooksManager.register("cocoapods-bb-PodAssistant", :post_install) do |installer|
69
70
  begin
71
+ source_manager = BB::SourceManager.new(@businessSpec)
72
+ # 生成本地yml配置
73
+ source_manager.generate_localStable
70
74
  $podEndTime = Time.new
71
75
  puts "[PodAssistant] plugin hook post_install".yellow
72
76
  puts "[PodAssistant] pod库下载耗时 GitCloneAllSize: #{$gitAllSize} M GitCloneAllTime: #{$cloneAllTime} S CDNDownloadAllSize: #{$pluginCurrentZipAllSize} M CDNAllTime: #{$downloadAllTime} S CDNDownloadAllTime: #{$cdnDownloadAllTime} S CDNUnzipAllTime: #{$cdnUnZipAllTime} S"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-bb-PodAssistant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5.1
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - humin