Class: Pod::Installer::Analyzer

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods_plugin.rb

Constant Summary collapse

@@_was_using_cocoapods_cache_printed =
false

Instance Method Summary collapse

Instance Method Details

#orig_sourcesObject



23
# File 'lib/cocoapods_plugin.rb', line 23

alias_method :orig_sources, :sources

#sourcesObject

add our own source to the list of sources



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/cocoapods_plugin.rb', line 26

def sources
  if NEXUS_COCOAPODS_REPO_URL
    puts "Using CocoaPods cache: #{NEXUS_COCOAPODS_REPO_URL}" unless @@_was_using_cocoapods_cache_printed
    @@_was_using_cocoapods_cache_printed = true

    sources = podfile.sources

    if sources.include?(Pod::TrunkSource::TRUNK_REPO_URL)
      sources[sources.index(Pod::TrunkSource::TRUNK_REPO_URL)] = NEXUS_COCOAPODS_REPO_URL
    else
      sources = [NEXUS_COCOAPODS_REPO_URL].concat(sources)
    end

    # Fragment below comes from the original sources method located https://github.com/CocoaPods/CocoaPods/blob/master/lib/cocoapods/installer/analyzer.rb

    #################################################################
    plugin_sources = @plugin_sources || []

    # Add any sources specified using the :source flag on individual dependencies.
    dependency_sources = podfile_dependencies.map(&:podspec_repo).compact

    sources += dependency_sources

    result = sources.uniq.map do |source_url|
      sources_manager.find_or_create_source_with_url(source_url)
    end
    unless plugin_sources.empty?
      result.insert(0, *plugin_sources)
      plugin_sources.each do |source|
        sources_manager.add_source(source)
      end
    end
    result
    #################################################################
  else
    orig_sources
  end
end