Class: Source::Aggregate

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-sources/native/aggregate.rb

Instance Method Summary collapse

Instance Method Details

#cocoapods_sources_search(dependency, podfile) ⇒ Object



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

def cocoapods_sources_search(dependency, podfile)
    pod_with_source = podfile.get_options[:pod_with_source]
    if pod_with_source.blank?
        search(dependency)
    else
        specific_source = pod_with_source[dependency.to_s]
        if specific_source.blank?
            search(dependency)
        else
            found_sources = sources.select do |s|
                if specific_source == s.url
                    s.search(dependency)
                end 
            end
            unless found_sources.empty?
                title = "Changing #{dependency} (to #{specific_source})"
                UI.titled_section(title.green, { :verbose_prefix => '-> '.green }) do
                    Specification::Set.new(dependency.root_name, found_sources)
                end
            end
        end
    end
end