Class: Pod::Project
- Inherits:
-
Object
- Object
- Pod::Project
- Defined in:
- lib/cocoapods-developing-folder/preserve_folder.rb
Instance Method Summary collapse
-
#add_pod_group(pod_name, path, development = false, absolute = false) ⇒ Object
—- modified methods —-.
- #children(podGroup) ⇒ Object
- #get_parent_development_pod_group(pod_name, path) ⇒ Object
- #getGroup(pathArray, rootGroup) ⇒ Object
-
#pod_file_path ⇒ Object
return the absolute path of podfile.
- #pod_groups ⇒ Object
Instance Method Details
#add_pod_group(pod_name, path, development = false, absolute = false) ⇒ Object
—- modified methods —-
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/cocoapods-developing-folder/preserve_folder.rb', line 74 def add_pod_group(pod_name, path, development = false, absolute = false) # copy from original raise '[BUG]' if pod_group(pod_name) parent_group = development ? development_pods : pods # end of copy from original if development parent_group = get_parent_development_pod_group(pod_name, path) end # copy from original source_tree = absolute ? :absolute : :group group = parent_group.new_group(pod_name, path, source_tree) group.setIsPodGroup true group # end of copy from original end |
#children(podGroup) ⇒ Object
93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/cocoapods-developing-folder/preserve_folder.rb', line 93 def children(podGroup) realGroups = podGroup.children.objects.select do |object| object.isPodGroup end folders = podGroup.children.objects.select do |object| !object.isPodGroup end folders.each do |folder| realGroups.concat(children(folder)) end return realGroups end |
#get_parent_development_pod_group(pod_name, path) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/cocoapods-developing-folder/preserve_folder.rb', line 40 def get_parent_development_pod_group(pod_name, path) basePath = Pathname.new pod_file_path targetPath = Pathname.new path relativePath = targetPath.relative_path_from basePath parentPath = relativePath.dirname.to_s def getGroup(pathArray, rootGroup) if pathArray.empty? return rootGroup end headName = pathArray[0] g = rootGroup.children.objects.find do |group| group.name == headName and !group.isPodGroup end if g == nil g = rootGroup.new_group(headName, nil, :group) g.setIsPodGroup false end return getGroup(pathArray[1..-1], g) end pathArray = parentPath.split("/").select {|component| component.length > 0} if parentPath == "." pathArray = [] end if pathArray.first != nil and Pod.skipped_top_level_folder_names.include? pathArray.first pathArray = pathArray.drop(1) end getGroup(pathArray, development_pods) end |
#getGroup(pathArray, rootGroup) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/cocoapods-developing-folder/preserve_folder.rb', line 47 def getGroup(pathArray, rootGroup) if pathArray.empty? return rootGroup end headName = pathArray[0] g = rootGroup.children.objects.find do |group| group.name == headName and !group.isPodGroup end if g == nil g = rootGroup.new_group(headName, nil, :group) g.setIsPodGroup false end return getGroup(pathArray[1..-1], g) end |
#pod_file_path ⇒ Object
return the absolute path of podfile
36 37 38 |
# File 'lib/cocoapods-developing-folder/preserve_folder.rb', line 36 def pod_file_path File.("../..", path) end |
#pod_groups ⇒ Object
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/cocoapods-developing-folder/preserve_folder.rb', line 92 def pod_groups def children(podGroup) realGroups = podGroup.children.objects.select do |object| object.isPodGroup end folders = podGroup.children.objects.select do |object| !object.isPodGroup end folders.each do |folder| realGroups.concat(children(folder)) end return realGroups end pods.children.objects + children(development_pods) end |