class BigKeeper::PodfileModuleDetector

Public Class Methods

new(main_path) click to toggle source
# File lib/big_keeper/util/podfile_module.rb, line 11
def initialize(main_path)
  @module_list = BigkeeperParser.module_names
  @main_path = main_path
  @update_modules = {}
  # check_version_list
end

Public Instance Methods

check_version_list() click to toggle source

检查需要更新业务库列表

# File lib/big_keeper/util/podfile_module.rb, line 19
def check_version_list
  if @module_list.empty?
    Logger.highlight('There is not any module should to be check.')
    return
  else
    Logger.highlight('Checking..')
    @module_list.each do |module_name|
      get_pod_search_result(module_name)
    end

    #获得pod信息后
    deal_module_info
  end
end
deal_module_info() click to toggle source
# File lib/big_keeper/util/podfile_module.rb, line 40
def deal_module_info
  podfile_lines = File.readlines("#{@main_path}/bigKeeperPodInfo.tmp")
  Logger.highlight("Analyzing modules info...") unless podfile_lines.size.zero?
    podfile_lines.collect do |sentence|
      if sentence =~(/pod/)
        sentence = sentence.sub('pod','')
        sentence = sentence.delete('\n\'')
        match_result = sentence.split(',')
        pod_name = match_result[0].strip
        latest_version = match_result[1].strip
        @update_modules[pod_name] = latest_version  unless @update_modules.include?(pod_name)
      end
    end
  p @update_modules
  File.delete("#{@main_path}/bigKeeperPodInfo.tmp")
  @update_modules
end
get_module_latest_version(pod_model) click to toggle source
# File lib/big_keeper/util/podfile_module.rb, line 58
def get_module_latest_version(pod_model)

end
get_pod_search_result(pod_name) click to toggle source
# File lib/big_keeper/util/podfile_module.rb, line 35
def get_pod_search_result(pod_name)
  #输入pod Search 结果
  `pod search #{pod_name} --ios --simple >> #{@main_path}/bigKeeperPodInfo.tmp`
end