class Pod::DeployDownloader

Attributes

dependency[RW]

Public Class Methods

new(dependency) click to toggle source
# File lib/cocoapods-deploy/deploy_downloader.rb, line 6
def initialize(dependency)
  @dependency = dependency
end

Public Instance Methods

dependencies_for_sources(config) click to toggle source
# File lib/cocoapods-deploy/deploy_downloader.rb, line 43
def dependencies_for_sources(config)
  podfile_sources(config).map do |source|
    filename = File.basename(source, ".*")
    raw_url = File.join( File.dirname(source), filename )
    root_urls = [
      "#{raw_url}/raw/master/Specs",
      "#{raw_url}/raw/master"
    ]

    root_urls.map do |url|
      source = @dependency.external_source[:podspec].gsub('{root-url}', url)
      dependencies_for_url(source)
    end
  end.flatten
end
dependencies_for_url(url) click to toggle source
# File lib/cocoapods-deploy/deploy_downloader.rb, line 59
def dependencies_for_url(url)
  [
    Dependency.new(@dependency.name, {:podspec => "#{url}.podspec"}),
    Dependency.new(@dependency.name, {:podspec => "#{url}.podspec.json"})
  ]
end
download(config) click to toggle source
# File lib/cocoapods-deploy/deploy_downloader.rb, line 10
def download(config)
  if @dependency.external_source.key?(:podspec)
    download_podspec(config)
  else
    download_source(config)
  end
end
download_podspec(config) click to toggle source
# File lib/cocoapods-deploy/deploy_downloader.rb, line 23
def download_podspec(config)
  dependencies_for_sources(config).each do |dep|
    source = ExternalSources.from_dependency(dep, config.podfile.defined_in_file)
    source.no_validate = true
    
    begin
      return source.fetch(config.sandbox)
    rescue Exception
      puts "Not Found"
    end
  end

  raise Informative, "Failed to deploy podspec for `#{@dependency.name}`."
end
download_source(config) click to toggle source
# File lib/cocoapods-deploy/deploy_downloader.rb, line 18
def download_source(config)
  source = ExternalSources.from_dependency(dependency, config.podfile.defined_in_file)
  source.fetch(config.sandbox)
end
podfile_sources(config) click to toggle source
# File lib/cocoapods-deploy/deploy_downloader.rb, line 38
def podfile_sources(config)
  return ["https://github.com/CocoaPods/Specs.git"] if config.podfile.sources.empty?
  return config.podfile.sources
end