class DoraBox::PodFileHelper

Public Class Methods

get_module_dependece(module_name) click to toggle source
# File lib/doraBox/util/pod_file_helper.rb, line 67
def self.get_module_dependece(module_name)
  version = ""

end
handle_pod_file(modules_name,branch_name) click to toggle source
# File lib/doraBox/util/pod_file_helper.rb, line 11
def self.handle_pod_file(modules_name,branch_name)
  version_filter_regex = /'([\d]+)(\.([1-9]\d|\d)*-*\w*)*'/
  version_filter_number_regex = /([\d]+)(\.([1-9]\d|\d)*-*\w*)*/
  podfile_str = ""
  checked_names = []
  module_branch_or_version_dict = {}

  File.open($pod_file, 'r+') do |file|
    file.each_line do |line|
      modules_name.each do |name|
        puts line if line.include?(name)
        checked_names.append(name)
        if version_filter_regex =~ line && /#{name}/ =~ line && /[^#]/ =~ line
          regex_str = line.gsub(version_filter_regex,":path => '../#{name}'")
          podfile_str += regex_str
          match_result = version_filter_number_regex.match(line)
          module_branch_or_version_dict[name] = match_result[0]
        else
          podfile_str += line
        end
      end
    end
  end

  # puts module_branch_or_version_dict

  # 根据公版模块的版本,去创建 ka 定制的分支
  modules_name.each do |module_name|
    module_pod_version = module_branch_or_version_dict[module_name]
    GitOperator.create_module_branch(module_pod_version,module_name,branch_name)
  end


  # 修改 podfile
  File.open($pod_file,'w') do |file|
    file.write podfile_str
  end

  FileOperator.cache_modified_modules(modules_name,branch_name)

  # 执行 pod install
  Logger.log_with_type("正在执行 pod install", HIGHLIGHT_LOG)
  pod_install

end
pod_install() click to toggle source
# File lib/doraBox/util/pod_file_helper.rb, line 57
def self.pod_install
  if Dir.chdir(File.dirname($pod_file))
    IO.popen("pod install") do |io|
      io.each do |line|
        puts Logger.log_with_type(line,HIGHLIGHT_LOG)
      end
    end
  end
end