Class: Pod::Command::UpdateFast
- Inherits:
-
Pod::Command
- Object
- Pod::Command
- Pod::Command::UpdateFast
- Defined in:
- lib/cocoapods-wxpodhook/helper.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ UpdateFast
constructor
A new instance of UpdateFast.
- #run ⇒ Object
Constructor Details
#initialize(argv) ⇒ UpdateFast
Returns a new instance of UpdateFast.
240 241 242 243 244 |
# File 'lib/cocoapods-wxpodhook/helper.rb', line 240 def initialize(argv) @pod_names = argv.arguments! @repo_update = argv.flag?('repo-update', true) super end |
Class Method Details
.options ⇒ Object
234 235 236 237 238 |
# File 'lib/cocoapods-wxpodhook/helper.rb', line 234 def self. [ ['--no-repo-update', '不更新spec仓库'], ].concat(super) end |
Instance Method Details
#run ⇒ Object
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
# File 'lib/cocoapods-wxpodhook/helper.rb', line 246 def run before = Time.new put_redMsg("开始使用浅克隆方式更新组件") # 设置Git浅克隆环境变量 ENV['GIT_CLONE_ARGS'] = '--depth=1' # 执行pod update命令 repo_update_flag = @repo_update ? '' : '--no-repo-update' if @pod_names.empty? # 如果没有指定pod名称,则更新所有pod system("pod update #{repo_update_flag}") else # 如果指定了pod名称,则只更新指定的pod pod_names_str = @pod_names.join(" ") system("pod update #{pod_names_str} #{repo_update_flag}") end # 恢复Git克隆环境变量 ENV.delete('GIT_CLONE_ARGS') now = Time.new(); time = now.to_i - before.to_i; put_redMsg("组件更新完毕,共耗时 #{time}秒") end |