class Pod::Downloader::NexusHttp

Public Class Methods

options() click to toggle source
# File lib/cocoapods-nexus/downloader.rb, line 6
def self.options
  [:type, :name]
end

Private Instance Methods

download!() click to toggle source
# File lib/cocoapods-nexus/downloader.rb, line 14
def download!
  @filename = "#{options[:name]}.#{options[:type]}"
  @download_path = @target_path + @filename
  download_file(@download_path)
end
download_file(full_filename) click to toggle source
# File lib/cocoapods-nexus/downloader.rb, line 20
def download_file(full_filename)
  parameters = ['-f', '-L', '-o', full_filename, url, '--create-dirs', '--netrc-optional', '--retry', '2']
  parameters << user_agent_argument if headers.nil? ||
      headers.none? { |header| header.casecmp(USER_AGENT_HEADER).zero? }
  unless headers.nil?
    headers.each do |h|
      parameters << '-H'
      parameters << h
    end
  end
  # 通过curl下载文件
  curl! parameters
end
user_agent_argument() click to toggle source
# File lib/cocoapods-nexus/downloader.rb, line 34
def user_agent_argument
  "-A cocoapods-nexus"
end