class Pod::Project

Public Instance Methods

add_pod_group(pod_name, path, development = false, absolute = false) click to toggle source

—- modified methods —-

# 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) click to toggle source
# 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
getGroup(pathArray, rootGroup) click to toggle source
# 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
get_parent_development_pod_group(pod_name, path) click to toggle source
# 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
pod_file_path() click to toggle source

return the absolute path of podfile

# File lib/cocoapods-developing-folder/preserve_folder.rb, line 36
def pod_file_path
    File.expand_path("../..", path)
end
pod_groups() click to toggle source
# 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