Class: Pod::Command::InstallFast

Inherits:
Pod::Command show all
Defined in:
lib/cocoapods-wxpodhook/helper.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ InstallFast

Returns a new instance of InstallFast.



298
299
300
301
302
303
# File 'lib/cocoapods-wxpodhook/helper.rb', line 298

def initialize(argv)
  @repo_update = argv.flag?('repo-update')
  @no_repo_update = argv.flag?('no-repo-update', !@repo_update)
  @no_integrate = argv.flag?('no-integrate')
  super
end

Class Method Details

.optionsObject



290
291
292
293
294
295
296
# File 'lib/cocoapods-wxpodhook/helper.rb', line 290

def self.options
  [
    ['--no-repo-update', '不更新spec仓库'],
    ['--no-integrate', '不集成到Xcode项目中'],
    ['--repo-update', '强制更新spec仓库'],
  ].concat(super)
end

Instance Method Details

#runObject



305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# File 'lib/cocoapods-wxpodhook/helper.rb', line 305

def run
  before = Time.new

  put_redMsg("开始使用浅克隆方式安装组件")

  # 设置Git浅克隆环境变量
  ENV['GIT_CLONE_ARGS'] = '--depth=1'
  
  # 构建命令参数
  args = []
  args << '--no-repo-update' if @no_repo_update
  args << '--no-integrate' if @no_integrate
  args << '--repo-update' if @repo_update
  
  # 执行pod install命令
  system("pod install #{args.join(' ')}")

  # 恢复Git克隆环境变量
  ENV.delete('GIT_CLONE_ARGS')

  now = Time.new();
  time = now.to_i - before.to_i;

  put_redMsg("组件安装完毕,共耗时 #{time}秒")
end