Sha256: 3e7404ae5aa41d1014da3f822e1762147eb3715261143e617c406148271d5f02

Contents?: true

Size: 1.95 KB

Versions: 1

Compression:

Stored size: 1.95 KB

Contents

require 'pathname'
require_relative 'utiltiy'

module Pod

    class_attr_accessor :local_pod_DSL_root_paths

    class Podfile

        def local_pod_searching_root(path)
            if path.kind_of? Array
                Pod.local_pod_DSL_root_paths = path
            elsif path.kind_of? String
                Pod.local_pod_DSL_root_paths = [path]
            else
                raise "[Error] wrong type for `local_pod_searching_root`"
            end
        end
    end
end



module Pod
    class Podfile
        module DSL

            def local_pod(name, *requirements)
                options = requirements.last

                rootPaths = Pod.local_pod_DSL_root_paths || ["./"]
                if options and options.kind_of? Hash and options[:root_path] != nil
                    rootPaths = [ options[:root_path] ]
                end

                rootPodName = Specification.root_name name
                found = false

                rootPaths.each do |rootPath|
                    basePath = Pathname.new rootPath
    
                    path = nil
                    basePath.find do |p|
                        if p.basename.to_s == "#{rootPodName}.podspec"
                            path = p
                            break
                        end
                    end
                    next if path.nil?
    
                    path = unify_path(path.parent)
                    path = path.to_s
                    
                    if options and options.kind_of? Hash
                        options[:path] = path
                        pod(name, *requirements)
                    else 
                        pod(name, *requirements, :path => path)
                    end
                    found = true
                    break
                end
                if not found
                    raise "\ncannot find local pod: #{name}. Searching roots: #{rootPaths}"
                end
            end

        end
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cocoapods-developing-folder-0.5.3 lib/cocoapods-developing-folder/local_pod_DSL.rb