Class: Pod::Command::Stable::Update

Inherits:
Pod::Command::Stable show all
Defined in:
lib/cocoapods-bb-PodAssistant/command/stable/update.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Pod::Command::Stable

#validate!

Constructor Details

#initialize(argv) ⇒ Update

Returns a new instance of Update.



28
29
30
31
32
# File 'lib/cocoapods-bb-PodAssistant/command/stable/update.rb', line 28

def initialize(argv)
  @pods = argv.arguments!
  @sync = argv.flag?('sync')
  super
end

Class Method Details

.optionsObject



22
23
24
25
26
# File 'lib/cocoapods-bb-PodAssistant/command/stable/update.rb', line 22

def self.options
  [
    ['--sync', '立即同步远端yml配置,更新组件信息'],
  ].concat(super)
end

Instance Method Details

#runObject



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/cocoapods-bb-PodAssistant/command/stable/update.rb', line 34

def run
  puts "[PodAssistant] 开始执行 $ pod stable update".yellow
  # system "git checkout Podfile.lock"
  source_manager = BB::SourceManager.new()
  # verify_podfile_exists! # 系统提供api验证podfile是否ok
  if @sync
    puts "[PodAssistant] 需要同步组件信息#{@pods}".green
    source_manager.merge_stable_data(@pods)
  end
  podStartTime = Time.new
  if @pods.any?
    pods_str = @pods.join(" ")
    system "pod update #{pods_str}"
  else
    system "pod update"
  end
  podEndTime = Time.new
  # 获取时间差
  time = podEndTime - podStartTime
  puts "[PodAssistant] pod update操作总耗时【#{time.to_s.send(:red)}秒】start:#{podStartTime} end:#{podEndTime}".green
  
  source_manager.update_local_stable_from_podmodules(@pods)
  puts "[PodAssistant] `pod stable update` complete!".green
end