require 'cocoapods-bb-PodAssistant/config/source_manager' module Pod class Command class Stable < Command class Update < Stable self.summary = '[命令同执行`pod update操作`,同步更新stable组件标签版本到最新] Update outdated project dependencies and create new ' \ 'Podfile.lock' self.description = <<-DESC Updates the Pods identified by the specified `POD_NAMES`, which is a space-delimited list of pod names. If no `POD_NAMES` are specified, it updates all the Pods, ignoring the contents of the Podfile.lock. This command is reserved for the update of dependencies; pod install should be used to install changes to the Podfile. DESC self.arguments = [ CLAide::Argument.new('POD_NAMES', false, true), ] def self.options [ ['--force', '强制更新组件,突破stable版本限制'], ].concat(super) end def initialize(argv) @pods = argv.arguments! @sync = argv.flag?('sync', true) @force = argv.flag?('force', true) super end 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? 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 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 end end end end