Module: Buildr::Transports

Defined in:
lib/core/transports.rb

Defined Under Namespace

Classes: HTTP, NotFound, SFTP, Transport

Class Method Summary collapse

Class Method Details

.download(url, target, options = nil) ⇒ Object

Convenience method for downloading a single file from the specified URL to the target file.



43
44
45
46
47
48
49
# File 'lib/core/transports.rb', line 43

def self.download(url, target, options = nil)
  uri = URI.parse(url.to_s)
  path, uri.path = uri.path, ""
  const_get(uri.scheme.upcase).perform(uri, options) do |transport|
    transport.download(path, target)
  end
end

.perform(url, options = nil, &block) ⇒ Object

Perform one or more operations using an open connection to the specified URL. For examples, see Transport#download and Transport#upload.



36
37
38
39
# File 'lib/core/transports.rb', line 36

def self.perform(url, options = nil, &block)
  uri = URI.parse(url.to_s)
  const_get(uri.scheme.upcase).perform(uri, options, &block)
end