Module: Pod::Podfile::DSL

Defined in:
lib/cocoapods-developing-folder/folder_DSL.rb,
lib/cocoapods-developing-folder/local_pod_DSL.rb

Instance Method Summary collapse

Instance Method Details

#folder(path, *requirements) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/cocoapods-developing-folder/folder_DSL.rb', line 7

def folder(path, *requirements)
    basePath = Pathname.new path
    def import_pod(path, *requirements)
        podspec = path.children.find do |p|
            !p.directory? and p.extname == ".podspec"
        end
        if podspec != nil 
            options = (requirements.last || {}).clone 
            options[:path] = path.to_path
            pod(podspec.basename(".podspec").to_s, options)
        end
        path.children.each do |p|
            if p.directory?
                import_pod(p, *requirements)
            end
        end
    end
    import_pod basePath, *requirements
end

#import_pod(path, *requirements) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/cocoapods-developing-folder/folder_DSL.rb', line 9

def import_pod(path, *requirements)
    podspec = path.children.find do |p|
        !p.directory? and p.extname == ".podspec"
    end
    if podspec != nil 
        options = (requirements.last || {}).clone 
        options[:path] = path.to_path
        pod(podspec.basename(".podspec").to_s, options)
    end
    path.children.each do |p|
        if p.directory?
            import_pod(p, *requirements)
        end
    end
end

#local_pod(name, *requirements) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/cocoapods-developing-folder/local_pod_DSL.rb', line 7

def local_pod(name, *requirements)
    basePath = Pathname.new "./"

    path = nil
    basePath.find do |p|
        if p.basename.to_s == "#{name}.podspec"
            path = p
            break
        end
    end

    if path == nil 
        raise "\ncannot find local pod: #{name}"
        return 
    end
    options = requirements.last
    if options and options.kind_of? Hash
        options[:path] = path.to_s
        pod(name, *requirements)
    else 
        pod(name, *requirements, :path => path.to_s)
    end
end