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

Constructor Details

#initialize(argv) ⇒ Update

Returns a new instance of Update.



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

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

Class Method Details

.optionsObject



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

def self.options
  [
    ['--force', '强制更新组件,突破stable版本限制'],
  ].concat(super)
end

Instance Method Details

#runObject



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

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, @force)
  end
  podStartTime = Time.new
  update_spec
  if @pods.any?
    if !File.exist?(File.join(Dir.pwd,"Podfile.lock"))
      puts "工程第一次先执行pod 初始化 pod install"
      system "pod install"
    end
    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

#update_specObject



65
66
67
68
69
# File 'lib/cocoapods-bb-PodAssistant/command/stable/update.rb', line 65

def update_spec
  system "pod repo update babybus-babybus-ios-specs-babybus-specs"
  system "pod repo update babybus-babybus-ios-specs-sourcev2-specs"
  system "pod repo update babybus-babybus-ios-specs-dylib-specs"
end