Method: Fig::OperatingSystem#download

Defined in:
lib/fig/operating_system.rb

#download(url, path, prompt_for_login) ⇒ Object

Returns whether the file was not downloaded because the file already exists and is already up-to-date.



131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/fig/operating_system.rb', line 131

def download(url, path, )
  Fig::VerboseLogging.time_operation("downloading #{File.basename(url)}") do
    protocol, uri = decode_protocol url

    FileUtils.mkdir_p(File.dirname path)

    result = protocol.download uri, path, 
    if File.exist?(path)
      size = File.size(path)
      log_asset_operation("downloaded", path, size)
    end
    result
  end
end