cocoapods-bb-PodAssistant 0.2.2 → 0.2.3
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 +4 -4
- data/lib/cocoapods-bb-PodAssistant/command/stable/push.rb +10 -8
- data/lib/cocoapods-bb-PodAssistant/config/source_manager.rb +8 -2
- data/lib/cocoapods-bb-PodAssistant/gem_version.rb +1 -1
- data/lib/cocoapods-bb-PodAssistant/helpers/pod_module_helper.rb +22 -3
- data/lib/cocoapods-bb-PodAssistant/helpers/stable_env_helper.rb +8 -1
- data/lib/cocoapods-bb-PodAssistant/helpers/stable_manager_helper.rb +12 -3
- data/lib/cocoapods-bb-PodAssistant/source_provider_hook.rb +184 -184
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db18fa9c11519008cc3187769f5aa81c9a8460b7eff538c9b277f3cefdd443c6
|
4
|
+
data.tar.gz: 28d2897172a135d0a74ddeddf4e9cfc9782f3a956b06c1aa546e18240695d2bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0843133052d9eb17e2defc372439be5242c621b13fbe24c98fee6f6cfbb2b93d24abb452f7edf1df91ee8bab3ed5d7658a38ac8da0f187acc58e8f9d1765fd6a'
|
7
|
+
data.tar.gz: dc2656f219568af7fa787ab911683e64a9245d53d213ae628db6aa1e2c04a890d6c10a26ed24e885dda2345f17af1f93056df4f47675673f5e0dcd78cbd3513f
|
@@ -10,11 +10,11 @@ module Pod
|
|
10
10
|
self.description = <<-DESC
|
11
11
|
常用命令如下:\n
|
12
12
|
更新所有公共组件: `pod stable push`\n
|
13
|
-
更新指定公共组件: `pod stable push
|
14
|
-
更新指定公共组件/移除组件: `pod stable push
|
15
|
-
更新指定公共组件/带依赖关系: `pod stable push
|
16
|
-
更新指定公共组件/带依赖关系/移除组件: `pod stable push
|
17
|
-
参数说明:--dependencies 依赖组件 --remove 需要移除组件 --update-matrix 更新矩阵产品公共业务线
|
13
|
+
更新指定公共组件: `pod stable push <组件名称>`\n
|
14
|
+
更新指定公共组件/移除组件: `pod stable push <组件名称> --remove=组件名称` #多个移除名称带`,`\n
|
15
|
+
更新指定公共组件/带依赖关系: `pod stable push <组件名称> --dependencies=组件名称` #多个依赖名称带`,`\n
|
16
|
+
更新指定公共组件/带依赖关系/移除组件: `pod stable push <组件名称> --dependencies=组件名称 --remove=组件名称` #多个依赖名称带`,`\n
|
17
|
+
参数说明:--dependencies 依赖组件 --remove 需要移除组件 --update-matrix 更新矩阵产品公共业务线 --update-common 更新公共组件
|
18
18
|
DESC
|
19
19
|
|
20
20
|
self.arguments = [
|
@@ -25,7 +25,8 @@ module Pod
|
|
25
25
|
[
|
26
26
|
['--dependencies', '依赖组件名称,多个使用`,`隔开'],
|
27
27
|
['--remove', '移除公共组件名称,多个使用`,`隔开'],
|
28
|
-
['--update-matrix', '
|
28
|
+
['--update-matrix', '更新[矩阵]产品公共业务线,默认true'],
|
29
|
+
['--update-common', '更新公共组件,默认false'],
|
29
30
|
].concat(super)
|
30
31
|
end
|
31
32
|
|
@@ -33,13 +34,14 @@ module Pod
|
|
33
34
|
@pods = argv.arguments!
|
34
35
|
@dependencies = argv.option('dependencies', nil)&.split(',')
|
35
36
|
@remove = argv.option('remove', nil)&.split(',')
|
36
|
-
@
|
37
|
+
@is_pub = argv.flag?('update-common', false)
|
38
|
+
@is_matrix = !@is_pub # argv.flag?('update-matrix', true)
|
37
39
|
super
|
38
40
|
end
|
39
41
|
|
40
42
|
def run
|
41
43
|
puts "[PodAssistant] 开始执行 $ pod stable push".yellow
|
42
|
-
source_manager = BB::SourceManager.new(false)
|
44
|
+
source_manager = BB::SourceManager.new(false, @is_matrix)
|
43
45
|
cachePath = source_manager.cache_path
|
44
46
|
puts "stable cache git=>#{cachePath}"
|
45
47
|
Dir.chdir(File.join(cachePath)) {
|
@@ -7,8 +7,8 @@ require 'cocoapods-bb-PodAssistant/helpers/stable_env_helper'
|
|
7
7
|
# 数据源管理
|
8
8
|
module BB
|
9
9
|
class SourceManager
|
10
|
-
def initialize(verify_stable_env=true)
|
11
|
-
@env = BB::StableEnv.new(verify_stable_env)
|
10
|
+
def initialize(verify_stable_env=true, isMatrix=false)
|
11
|
+
@env = BB::StableEnv.new(verify_stable_env, isMatrix)
|
12
12
|
@businessSpecName = @env.business_stable
|
13
13
|
@stableMgr = BB::StableManager.new(@env, verify_stable_env)
|
14
14
|
end
|
@@ -182,6 +182,12 @@ module BB
|
|
182
182
|
stable_specs[YAML_CONFIG_REMOVE_KEY] = removedata
|
183
183
|
stable_specs[YAML_CONFIG_DEPENDENCIES_KEY] = dependenciesdata
|
184
184
|
update_stable_lock(stable_yaml, stable_specs)
|
185
|
+
puts "removedata:#{removedata} len:#{removedata.length}".red
|
186
|
+
puts "dependenciesdata:#{dependenciesdata} count:#{dependenciesdata.length}".red
|
187
|
+
# 提交依赖/移除数据
|
188
|
+
if removedata.length > 0 || dependenciesdata.length > 0
|
189
|
+
@stableMgr.commit_data(stable_yaml, "dependencies:#{dependenciesdata} remove:#{removedata}")
|
190
|
+
end
|
185
191
|
end
|
186
192
|
end
|
187
193
|
def update_common_dependencies_and_remove_data(dependencies_pods, remove_pods)
|
@@ -169,6 +169,23 @@ module BB
|
|
169
169
|
}
|
170
170
|
return podfile_hash
|
171
171
|
end
|
172
|
+
# stable本地数据去除指向本地
|
173
|
+
def convert_local_stable_data(local_stable_data)
|
174
|
+
stable_hash = {}
|
175
|
+
local_stable_data.each do |name,pod|
|
176
|
+
if pod.is_a? Hash
|
177
|
+
path = pod[:path]
|
178
|
+
if path
|
179
|
+
puts "filter local path data:#{name}".red
|
180
|
+
else
|
181
|
+
stable_hash[name] = pod
|
182
|
+
end
|
183
|
+
else
|
184
|
+
stable_hash[name] = pod
|
185
|
+
end
|
186
|
+
end
|
187
|
+
return stable_hash
|
188
|
+
end
|
172
189
|
# 合并组建数据
|
173
190
|
# 策略:本地stable作为基础数据,遍历podfile组件进行替换,变化以本地为主,标签以stable为主
|
174
191
|
def merge_module_data(podfile_specs, local_stable_data)
|
@@ -177,7 +194,8 @@ module BB
|
|
177
194
|
# puts "podfile_hash: #{podfile_hash}".red
|
178
195
|
# puts "local_stable_data: #{local_stable_data}".red
|
179
196
|
need_update_pod_data={}
|
180
|
-
|
197
|
+
# fix 指向本地组件切换到远端组件,本地yml配置不会更新问题
|
198
|
+
stable_hash = convert_local_stable_data(local_stable_data) # stable_hash = local_stable_data
|
181
199
|
podfile_hash.each do |podName,podfile_pod|
|
182
200
|
if podfile_pod.count == 0
|
183
201
|
puts "❌ podfile组件[#{podName}]配置异常,请确认:method => REMOTE_VERSION是否配置\n组件信息如下:\n#{podName} => #{podfile_pod}".red
|
@@ -238,10 +256,11 @@ module BB
|
|
238
256
|
if pod.is_a? (Hash)
|
239
257
|
stable_branch = pod[:branch]
|
240
258
|
stable_git = pod[:git]
|
259
|
+
stable_path = pod[:path]
|
241
260
|
if stable_git.nil?
|
242
261
|
stable_git = pod[:git_format]
|
243
262
|
end
|
244
|
-
if (stable_branch && !stable_branch.empty?) || (stable_git && !stable_git.empty?)
|
263
|
+
if (stable_branch && !stable_branch.empty?) || (stable_git && !stable_git.empty?) || (stable_path && !stable_path.empty?)
|
245
264
|
puts "[PodAssistant] '#{podName}', '#{podfile_pod}' 以podfile配置为主[分支=>标签]."
|
246
265
|
newPod = podfile_pod
|
247
266
|
is_podfile_data = true
|
@@ -249,7 +268,7 @@ module BB
|
|
249
268
|
newPod = pod
|
250
269
|
end
|
251
270
|
elsif pod.is_a? (String)
|
252
|
-
if pod.include?(':branch') || pod.include?(':git') || pod.include?(':git_format')
|
271
|
+
if pod.include?(':branch') || pod.include?(':git') || pod.include?(':git_format') || pod.include?(':path')
|
253
272
|
puts "[PodAssistant] '#{podName}', '#{podfile_pod}' 以podfile配置为主[分支=>标签]."
|
254
273
|
newPod = podfile_pod
|
255
274
|
is_podfile_data = true
|
@@ -2,8 +2,9 @@ require 'cocoapods-bb-PodAssistant/config/stable_source'
|
|
2
2
|
|
3
3
|
module BB
|
4
4
|
class StableEnv
|
5
|
-
def initialize(verify_stable_env=true)
|
5
|
+
def initialize(verify_stable_env=true, isMatrix=false)
|
6
6
|
@cache = BB::Cache.new(nil, verify_stable_env)
|
7
|
+
@isMatrix = isMatrix
|
7
8
|
configGitPath(@cache.cachePath)
|
8
9
|
if verify_stable_env
|
9
10
|
# 自动加载stable环境
|
@@ -101,8 +102,14 @@ module BB
|
|
101
102
|
return @stable_tag
|
102
103
|
end
|
103
104
|
def business_stable
|
105
|
+
if @businessSpec.nil? && @isMatrix
|
106
|
+
return default_matrix_business_stable
|
107
|
+
end
|
104
108
|
return @businessSpec
|
105
109
|
end
|
110
|
+
def default_matrix_business_stable
|
111
|
+
return "global_stable_specs"
|
112
|
+
end
|
106
113
|
# 验证stable环境是否存在
|
107
114
|
def verify_stable_env_exists
|
108
115
|
return @stable_source.empty? ? false : true
|
@@ -25,8 +25,14 @@ module BB
|
|
25
25
|
puts "没有配置业务线公共源,请确认!!!".yellow
|
26
26
|
end
|
27
27
|
end
|
28
|
-
|
29
|
-
|
28
|
+
# 提交数据
|
29
|
+
def commit_data(yml_path, commit_msg="")
|
30
|
+
puts "commit_stable_lock commit_msg:#{commit_msg}".red
|
31
|
+
commit_stable_lock_data(yml_path, commit_msg)
|
32
|
+
end
|
33
|
+
|
34
|
+
# podfile 更新配置文件使用(项目)
|
35
|
+
def update_product_stable_lock(pod_targets)
|
30
36
|
update_local_stable_lock(local_stable_yaml, pod_targets)
|
31
37
|
end
|
32
38
|
|
@@ -61,9 +67,12 @@ module BB
|
|
61
67
|
stableSpec = BB::StableSpecs.new()
|
62
68
|
stableSpec.update_stable_lock(yml_path, pod_targets)
|
63
69
|
# step.2 提交修改后代码
|
70
|
+
commit_stable_lock_data(yml_path)
|
71
|
+
end
|
72
|
+
private def commit_stable_lock_data(yml_path, commit_msg="")
|
64
73
|
yml_name = File.basename(yml_path)
|
65
74
|
# `cd #{cachePath}; git pull --all; git add #{yml_name}; git commit -m "[update] 更新stable配置文件#{yml_name}"; git push; git pull --all;`
|
66
|
-
`cd #{cachePath}; git pull --all; git add * ; git commit -m "[update] 更新stable配置文件#{yml_name}"; git push; git pull --all;`
|
75
|
+
`cd #{cachePath}; git pull --all; git add * ; git commit -m "[update] 更新stable配置文件#{yml_name} #{commit_msg}"; git push; git pull --all;`
|
67
76
|
end
|
68
77
|
private def update_local_stable_lock(yml_path, pod_targets)
|
69
78
|
# step.1 更新yaml配置文件
|
@@ -72,12 +72,12 @@ module BB
|
|
72
72
|
$source_manager.generate_localStable
|
73
73
|
$podEndTime = Time.new
|
74
74
|
puts "[PodAssistant] plugin hook post_install".yellow
|
75
|
-
puts "[PodAssistant] pod库下载耗时 GitCloneAllSize: #{$gitAllSize} M GitCloneAllTime: #{$cloneAllTime} S CDNDownloadAllSize: #{$pluginCurrentZipAllSize} M CDNAllTime: #{$downloadAllTime} S CDNDownloadAllTime: #{$cdnDownloadAllTime} S CDNUnzipAllTime: #{$cdnUnZipAllTime} S"
|
76
|
-
# 如果是--verbose模式且$gitAllSize与$cloneAllTime(不为0表示有下载pod)
|
77
|
-
if $pluginIsVerbose == true && $gitAllSize != 0 && $cloneAllTime != 0 && $pluginCurrentZipAllSize != 0 && $downloadAllTime != 0
|
78
|
-
|
79
|
-
|
80
|
-
end
|
75
|
+
# puts "[PodAssistant] pod库下载耗时 GitCloneAllSize: #{$gitAllSize} M GitCloneAllTime: #{$cloneAllTime} S CDNDownloadAllSize: #{$pluginCurrentZipAllSize} M CDNAllTime: #{$downloadAllTime} S CDNDownloadAllTime: #{$cdnDownloadAllTime} S CDNUnzipAllTime: #{$cdnUnZipAllTime} S"
|
76
|
+
# # 如果是--verbose模式且$gitAllSize与$cloneAllTime(不为0表示有下载pod)
|
77
|
+
# if $pluginIsVerbose == true && $gitAllSize != 0 && $cloneAllTime != 0 && $pluginCurrentZipAllSize != 0 && $downloadAllTime != 0
|
78
|
+
# File.rename "#{Dir.home}/.AllPodsTimeAndSize.csv", "#{installer.sandbox_root}/AllPodsTimeAndSize.csv"
|
79
|
+
# puts "具体的统计数据请在#{installer.sandbox_root}/AllPodsTimeAndSize.csv中查看"
|
80
|
+
# end
|
81
81
|
# 获取时间差
|
82
82
|
time = $podEndTime - $podStartTime
|
83
83
|
puts "[PodAssistant] pod操作总耗时【#{time.to_s.send(:red)}秒】start:#{$podStartTime} end:#{$podEndTime}".green
|
@@ -87,202 +87,202 @@ module BB
|
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
90
|
-
class Pod::Downloader::Cache
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
90
|
+
# class Pod::Downloader::Cache
|
91
|
+
# # 使用方法别名hook copy_and_clean方法
|
92
|
+
# alias :origin_copy_and_clean :copy_and_clean
|
93
|
+
# def copy_and_clean(source, destination, spec)
|
94
|
+
# # 执行之前的拷贝到cache并且清除git clone临时目录的方法
|
95
|
+
# origin_copy_and_clean(source, destination, spec)
|
96
|
+
# # 如果是--verbose,则输出详细信息,生成csv
|
97
|
+
# if $pluginIsVerbose == true
|
98
|
+
# verboseCopy_and_clean(source, destination, spec)
|
99
|
+
# end
|
100
|
+
# end
|
101
101
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
102
|
+
# # --verbose输出详细信息,生成在home路径下.AllPodsTimeAndSize.csv的隐藏文件
|
103
|
+
# def verboseCopy_and_clean(source, destination, spec)
|
104
|
+
# begin
|
105
|
+
# # 计算拷贝到的目录下所有文件总大小,单位为M
|
106
|
+
# dirSum = Dir.size(destination.to_s)/1000.0/1000.0
|
107
|
+
# # 标红输出cache文件大小,单位为M
|
108
|
+
# puts "[PodAssistant] cachesize #{spec.name}: "+"#{dirSum}"+" M"
|
109
|
+
# # 如果相等则为CDN的下载方式
|
110
|
+
# if $gitSize == 0
|
111
|
+
# # CDN的下载方式
|
112
|
+
# CSV.open("#{Dir.home}/.AllPodsTimeAndSize.csv", "a+") do |csv|
|
113
|
+
# csv << [spec.name, $downloadTime, $pluginCurrentZipSize, dirSum, "CDN不统计此项", "CDN", $cdnDownloadTime, $cdnUnZipTime]
|
114
|
+
# end
|
115
|
+
# else
|
116
|
+
# # git的下载方式
|
117
|
+
# # 计算git clone大小和cache文件大小的差值,如果差值过大,则有优化空间
|
118
|
+
# diffSize = $gitSize - dirSum
|
119
|
+
# # 标红输出差值
|
120
|
+
# puts "[PodAssistant] diffSize = #{diffSize}"+"M "
|
121
|
+
# CSV.open("#{Dir.home}/.AllPodsTimeAndSize.csv", "a+") do |csv|
|
122
|
+
# csv << [spec.name, $cloneTime, $gitSize, dirSum, diffSize, "Git", "Git不统计此项", "Git不统计此项"]
|
123
|
+
# end
|
124
|
+
# end
|
125
125
|
|
126
|
-
|
127
|
-
|
126
|
+
# # 换行
|
127
|
+
# puts
|
128
128
|
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
end
|
129
|
+
# rescue => exception
|
130
|
+
# # 输出拷贝清除方法异常
|
131
|
+
# puts "[PodAssistant] verboseCopy_and_clean error(已捕获): #{exception}".red
|
132
|
+
# end
|
133
|
+
# $gitSize = 0
|
134
|
+
# end
|
135
|
+
# end
|
136
136
|
|
137
137
|
|
138
|
-
class Pod::Downloader::Cache
|
138
|
+
# class Pod::Downloader::Cache
|
139
139
|
|
140
|
-
|
140
|
+
# alias :origin_download :download
|
141
141
|
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
142
|
+
# def download(request, target)
|
143
|
+
# # 获取downloader下载的文件路径
|
144
|
+
# source = target.to_s
|
145
|
+
# # 赋值当前正在下载的文件路径给全局变量,为了解压zip的时候做判断
|
146
|
+
# $pluginCurrentTarget = source
|
147
|
+
# # 赋值当前正在下载的pod名称给全局变量,为了解压zip的时候做输出
|
148
|
+
# $pluginCurrentPodName = request.name.to_s
|
149
|
+
# # 获取clone执行前时间点
|
150
|
+
# time1 = Time.new
|
151
|
+
# # 执行之前的download_source方法,接收该方法的返回值
|
152
|
+
# result, podspecs = origin_download(request, target)
|
153
153
|
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
154
|
+
# # 如果不是--verbose,只输出总耗时,总下载大小
|
155
|
+
# # 捕获一下异常,不会因为plugin的原因导致pod失败
|
156
|
+
# begin
|
157
|
+
# # 获取clone执行后时间点
|
158
|
+
# time2 = Time.new
|
159
|
+
# # 获取时间差
|
160
|
+
# time = time2 - time1
|
161
|
+
# if request.params["git".to_sym]
|
162
|
+
# # 说明是git方式
|
163
|
+
# # 赋值一个给全局变量,之后时间统计要用到
|
164
|
+
# $cloneTime = time
|
165
|
+
# # 赋值一个给全局变量,之后时间统计要用到
|
166
|
+
# $cloneAllTime = $cloneAllTime + time
|
167
|
+
# # 计算downloader下载的文件大小,单位为M
|
168
|
+
# dirSum = Dir.size(source)/1000.0/1000.0
|
169
|
+
# # 赋值给一个全局变量,之后输出会用到
|
170
|
+
# $gitAllSize = $gitAllSize + dirSum
|
171
|
+
# else
|
172
|
+
# # 说明是CDN方式
|
173
|
+
# # 赋值一个给全局变量,之后时间统计要用到
|
174
|
+
# $downloadTime = time
|
175
|
+
# # 赋值一个给全局变量,之后时间统计要用到
|
176
|
+
# $downloadAllTime = $downloadAllTime + time
|
177
|
+
# # 赋值给一个全局变量,之后输出会用到
|
178
|
+
# $cdnDownloadAllTime = $cdnDownloadAllTime + $cdnDownloadTime
|
179
|
+
# # 赋值给一个全局变量,之后输出会用到
|
180
|
+
# $cdnUnZipAllTime = $cdnUnZipAllTime + $cdnUnZipTime
|
181
|
+
# # 赋值给一个全局变量,之后输出会用到
|
182
|
+
# $pluginCurrentZipAllSize = $pluginCurrentZipAllSize + $pluginCurrentZipSize
|
183
|
+
# end
|
184
184
|
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
185
|
+
# # 如果是--verbose,则输出详细信息,生成csv
|
186
|
+
# if $pluginIsVerbose == true
|
187
|
+
# verboseDownload(request, time, dirSum)
|
188
|
+
# end
|
189
|
+
# # 返回值
|
190
|
+
# [result, podspecs]
|
191
|
+
# rescue => exception
|
192
|
+
# # 标红输出git clone hook异常
|
193
|
+
# puts "[PodAssistant] download error(已捕获): #{exception}"
|
194
|
+
# end
|
195
|
+
# end
|
196
196
|
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
197
|
+
# def verboseDownload(request, time, dirSum)
|
198
|
+
# if request.params["git".to_sym]
|
199
|
+
# # 说明是git方式
|
200
|
+
# # 标红输出git clone耗时
|
201
|
+
# puts "[PodAssistant] #{request.name.to_s} clone time: #{time}"+" S"
|
202
|
+
# # 赋值给一个全局变量,之后输出会用到
|
203
|
+
# $gitSize = dirSum
|
204
|
+
# # 标红输出git clone下载文件大小
|
205
|
+
# puts "[PodAssistant] #{request.name.to_s} clone allsize: "+"#{dirSum}"+" M"
|
206
|
+
# else
|
207
|
+
# # 说明是CDN方式
|
208
|
+
# # 标红输出CDN 下载耗时
|
209
|
+
# puts "[PodAssistant] #{request.name.to_s} CDN download time: #{$cdnDownloadTime}"+" S"
|
210
|
+
# # 标红输出CDN 解压耗时
|
211
|
+
# puts "[PodAssistant] #{request.name.to_s} CDN unzip time: #{$cdnUnZipTime}"+" S"
|
212
|
+
# # 标红输出CDN 总耗时
|
213
|
+
# puts "[PodAssistant] #{request.name.to_s} CDN All time: #{$downloadTime}"+" S"
|
214
|
+
# # 标红输出CDN clone下载文件大小
|
215
|
+
# puts "[PodAssistant] #{request.name.to_s} CDN zipSize: "+"#{$pluginCurrentZipSize}"+" M"
|
216
|
+
# end
|
217
217
|
|
218
|
-
|
218
|
+
# end
|
219
219
|
|
220
|
-
end
|
220
|
+
# end
|
221
221
|
|
222
|
-
class Pod::Downloader::Http
|
223
|
-
|
224
|
-
|
225
|
-
|
222
|
+
# class Pod::Downloader::Http
|
223
|
+
# # 使用方法别名hook解压方法,获取解压之前的文件大小
|
224
|
+
# alias :origin_download_file :download_file
|
225
|
+
# alias :origin_extract_with_type :extract_with_type
|
226
226
|
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
227
|
+
# def download_file(_full_filename)
|
228
|
+
# # 捕获一下异常,不会因为plugin的原因导致pod失败
|
229
|
+
# begin
|
230
|
+
# if _full_filename.to_s.include?($pluginCurrentTarget)
|
231
|
+
# # 说明是之前被赋值的开始下载了
|
232
232
|
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
233
|
+
# # 获取CDN下载执行前时间点
|
234
|
+
# time1 = Time.new
|
235
|
+
# # 执行原来的CDN下载方法
|
236
|
+
# origin_download_file(_full_filename)
|
237
|
+
# # 获取CDN下载执行后时间点
|
238
|
+
# time2 = Time.new
|
239
|
+
# # 赋值CDN下载耗时给全局变量,用于之后输出以及写在csv中
|
240
|
+
# $cdnDownloadTime = time2 - time1
|
241
|
+
# else
|
242
|
+
# # 说明不是之前被赋值的开始下载了,输出一下,然后清空
|
243
|
+
# puts "[PodAssistant] unzip warning: #{$pluginCurrentTarget} target error"
|
244
|
+
# puts "[PodAssistant] unzip warning: #{$pluginCurrentPodName} name error"
|
245
|
+
# $pluginCurrentTarget = ""
|
246
|
+
# $pluginCurrentPodName = ""
|
247
|
+
# end
|
248
|
+
# rescue => exception
|
249
|
+
# # 输出CDM下载方法异常
|
250
|
+
# puts "[PodAssistant] download_file error(已捕获): #{exception}"
|
251
|
+
# end
|
252
252
|
|
253
|
-
|
253
|
+
# end
|
254
254
|
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
255
|
+
# def extract_with_type(full_filename, type = :zip)
|
256
|
+
# # 捕获一下异常,不会因为plugin的原因导致pod失败
|
257
|
+
# begin
|
258
|
+
# if full_filename.to_s.include?($pluginCurrentTarget)
|
259
|
+
# # 说明是之前被赋值的下载完成了,开始进行解压了
|
260
260
|
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
end
|
261
|
+
# # 计算拷贝到的目录下所有文件总大小,单位为M
|
262
|
+
# dirSum = File.size(full_filename.to_s)/1000.0/1000.0
|
263
|
+
# # 赋值给当前正在解压的zip大小,之后输出到csv要用
|
264
|
+
# $pluginCurrentZipSize = dirSum
|
265
|
+
# else
|
266
|
+
# # 说明不是之前被赋值的下载完成了,输出一下,然后清空
|
267
|
+
# puts "[PodAssistant] unzip warning: #{$pluginCurrentTarget} target error"
|
268
|
+
# puts "[PodAssistant] unzip warning: #{$pluginCurrentPodName} name error"
|
269
|
+
# $pluginCurrentTarget = ""
|
270
|
+
# $pluginCurrentPodName = ""
|
271
|
+
# end
|
272
|
+
# rescue => exception
|
273
|
+
# # 输出CDN解压方法异常
|
274
|
+
# puts "[PodAssistant] extract_with_type error(已捕获): #{exception}"
|
275
|
+
# end
|
276
|
+
# # 获取CDN解压前时间点
|
277
|
+
# time1 = Time.new
|
278
|
+
# # 执行之前的解压方法
|
279
|
+
# origin_extract_with_type(full_filename, type)
|
280
|
+
# # 获取CDN解压后时间点
|
281
|
+
# time2 = Time.new
|
282
|
+
# # 赋值CDN解压耗时给全局变量,用于之后输出以及写在csv中
|
283
|
+
# $cdnUnZipTime = time2 - time1
|
284
|
+
# end
|
285
|
+
# end
|
286
286
|
|
287
287
|
# class Pod::Downloader::Git
|
288
288
|
# # 使用方法别名hook clone方法
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-bb-PodAssistant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- humin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cocoapods-core
|
@@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
142
|
- !ruby/object:Gem::Version
|
143
143
|
version: '0'
|
144
144
|
requirements: []
|
145
|
-
rubygems_version: 3.4.
|
145
|
+
rubygems_version: 3.4.22
|
146
146
|
signing_key:
|
147
147
|
specification_version: 4
|
148
148
|
summary: A longer description of cocoapods-bb-PodAssistant.
|