Class: BigKeeper::PodfileModuleDetector

Inherits:
Object
  • Object
show all
Defined in:
lib/big_keeper/util/podfile_module.rb

Instance Method Summary collapse

Constructor Details

#initialize(main_path) ⇒ PodfileModuleDetector

Returns a new instance of PodfileModuleDetector.



11
12
13
14
15
16
# 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

Instance Method Details

#check_version_listObject

检查需要更新业务库列表



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# 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_infoObject



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# 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) ⇒ Object



58
59
60
# File 'lib/big_keeper/util/podfile_module.rb', line 58

def get_module_latest_version(pod_model)

end

#get_pod_search_result(pod_name) ⇒ Object



35
36
37
38
# 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