Class: TYCiCore::TYPodFileLock

Inherits:
Object
  • Object
show all
Defined in:
lib/tuya/ci/core/dependencies/podfile_lock.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text) ⇒ TYPodFileLock

Returns a new instance of TYPodFileLock.



6
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
# File 'lib/tuya/ci/core/dependencies/podfile_lock.rb', line 6

def initialize(text)
   all_pods_temp = text.scan /^\s+(\w+-*\w+): [0-9a-zA-Z]*$/

   @all_pods = []

   all_pods_temp.each do |pod|
     @all_pods << pod[0]
   end

   @pods = Hash.new
   @all_pods.each do |pod|
     pod_dependencies = []
     pod_scan = text.scan /^\s{2}-\s+#{pod}\s+.*:((\n\s{4}-\s+.*)*)/
     pod_scan.each do |pod_item|
       if pod_item.size > 0
         item = pod_item[0]
         item.gsub!(/\n/, '')
         item.split('    - ').each do |item_content|
           if item_content != ""
             item_content_clean = item_content.gsub!(/\s\(.*\s.*\)/, '')
             if item_content_clean
               pod_dependencies.push item_content_clean
             else
               pod_dependencies.push item_content
             end
           end
         end
       end
     end
     @pods[pod] = pod_dependencies if pod_dependencies.size > 0
   end
end

Instance Attribute Details

#all_podsObject

Returns the value of attribute all_pods.



4
5
6
# File 'lib/tuya/ci/core/dependencies/podfile_lock.rb', line 4

def all_pods
  @all_pods
end

#podsObject

Returns the value of attribute pods.



4
5
6
# File 'lib/tuya/ci/core/dependencies/podfile_lock.rb', line 4

def pods
  @pods
end