Class: PodsOrz::PodspecModel

Inherits:
Object
  • Object
show all
Defined in:
lib/podsorz/core/Specs/podspec_model.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(podspec_file_path) ⇒ PodspecModel

Returns a new instance of PodspecModel.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/podsorz/core/Specs/podspec_model.rb', line 7

def initialize(podspec_file_path)
  @dependency_list = []
  @have_resources = false

  totoal_sentences = []
  File.open(podspec_file_path, "r") {|io|
    totoal_sentences = io.readlines
  }

  totoal_sentences.each do |line|
    if /\.(name)(.*) =/ =~ line
      @pod_name = $~.post_match.strip
      @pod_name = pod_name.gsub(/[\'\"]/, "")
    end

    if /\.(resource)(.*) =/ =~ line
      @have_resources = true
    end

    if /\.dependency/ =~ line
      dependency = $~.post_match.strip

      unless @pod_name.nil?
        unless dependency.include? @pod_name
          @dependency_list << dependency  
        end
      end

    end
  end

end

Instance Attribute Details

#dependency_listObject

Returns the value of attribute dependency_list.



5
6
7
# File 'lib/podsorz/core/Specs/podspec_model.rb', line 5

def dependency_list
  @dependency_list
end

#have_resourcesObject

Returns the value of attribute have_resources.



5
6
7
# File 'lib/podsorz/core/Specs/podspec_model.rb', line 5

def have_resources
  @have_resources
end

#pod_nameObject

Returns the value of attribute pod_name.



5
6
7
# File 'lib/podsorz/core/Specs/podspec_model.rb', line 5

def pod_name
  @pod_name
end