class Artifactory::Resource::Artifact
def download(target = Dir.mktmpdir, options = {})
-
(String)
-
Options Hash:
(**options)
-
filename
(String
) --
Parameters:
-
options
(Hash
) -- -
target
(String
) --
Other tags:
- Example: Download a remote artifact into a specific target -
Example: Download an artifact -
def download(target = Dir.mktmpdir, options = {}) target = File.expand_path(target) # Make the directory if it doesn't yet exist FileUtils.mkdir_p(target) unless File.exists?(target) # Use the server artifact's filename if one wasn't given filename = options[:filename] || File.basename(download_uri) # Construct the full path for the file destination = File.join(target, filename) File.open(destination, 'wb') do |file| file.write(client.get(download_uri)) end destination end