class BigKeeper::PodspecOperator

Operator for podspec file

Attributes

main_path[RW]
module_list[RW]
pod_list[RW]

Public Class Methods

new() click to toggle source
# File lib/big_keeper/util/podspec_operator.rb, line 14
def initialize
  @module_list = BigkeeperParser.module_names
  @pod_list = []
end

Public Instance Methods

deal_podfile_line(sentence) click to toggle source
# File lib/big_keeper/util/podspec_operator.rb, line 38
def deal_podfile_line(sentence)
  pod_name = ''
  if sentence.strip.include?('dependency ')
    pod_dep = sentence.split('dependency ')
    if pod_dep.size > 1
      pod_names = pod_dep[1].split(',')
      if pod_names.size > 1
        pod_name = pod_names[0]
      else
        pod_name = pod_dep[1]
      end
    end
    pod_name
  end
end
get_pod_name(sentence) click to toggle source
# File lib/big_keeper/util/podspec_operator.rb, line 31
def get_pod_name(sentence)
  pod_model = deal_podfile_line(sentence)
  if pod_model != nil
    return pod_model.chomp.gsub("'", "")
  end
end
parse(path, module_name) click to toggle source
# File lib/big_keeper/util/podspec_operator.rb, line 19
def parse(path, module_name)
  @main_path = path
  podspec_lines = File.readlines("#{@main_path}/#{module_name}.podspec", :encoding => 'UTF-8')
  Logger.highlight("Analyzing Podspec...") unless podspec_lines.size.zero?
  podspec_lines.collect do |sentence|
    if /dependency / =~ sentence
      pod_name = get_pod_name(sentence)
      @pod_list << pod_name
    end
  end
end