class PodsOrz::PodfileModel

Attributes

branch[RW]
configurations[RW]
git[RW]
modular_headers[RW]
name[RW]
path[RW]
podspec[RW]
subspecs[RW]
tag[RW]
version[RW]

Public Class Methods

new(sentence) click to toggle source
# File lib/podsorz/core/PodFile/podfile_model.rb, line 23
def initialize(sentence)
  sentence_slip_list = sentence.split(',')
  return if sentence_slip_list.size.zero?

  for piece in sentence_slip_list do
      if /:git =>/ =~ piece
        @git = $~.post_match.strip
      elsif /:path =>/ =~ piece
        @path = $~.post_match.strip
      elsif /:configurations =>/ =~ piece
        @configurations = $~.post_match.strip
      elsif /:modular_headers =>/ =~ piece
        @modular_headers = $~.post_match.strip
      elsif /:branch =>/ =~ piece
        @branch = $~.post_match.strip
      elsif /:tag =>/ =~ piece
        @tag = $~.post_match.strip
      elsif /pod /=~ piece
        @name = $~.post_match.delete("'\n ")
      elsif /:subspecs =>/ =~ piece
        @subspecs = $~.post_match.strip
      else
        mt = /\'\d{1,}\..*\d{1,}\'/.match(piece)
        @version = mt[0].gsub(/[\'\"]/, "") unless mt.nil?
          
      end
  end 

  # puts %Q{model name:#{@name},git:#{@git},path:#{@path},config:#{@configurations},branch:#{@branch},tag:#{@tag}}
   
end
validate_podfile_sentence_instance(sentence) click to toggle source
# File lib/podsorz/core/PodFile/podfile_model.rb, line 8
def self.validate_podfile_sentence_instance(sentence)
  result_model = nil
  
  sentence = sentence.strip.chomp
  unless sentence.empty? || sentence.size.zero?
    unless sentence.start_with?("#")
      if sentence.start_with?("pod ")
        result_model = PodsOrz::PodfileModel.new(sentence)
      end
    end 
  end

  result_model
end