class Capistrano::Distribution::Distributor::CurlZip

Deploys ZIP files downloadable using the curl command.

Public Instance Methods

distribute() click to toggle source

Extracts the content rooted under {#subtree} within the ZIP file indicated by {#url} to the location indicated by {#release_path}. Because the unzip utility is unable to extract a ZIP file over a pipe, a local copy of the entire ZIP file is made during the extraction process and then removed.

@return [nil]

@see Archiver#distribute

# File lib/capistrano/distribution/distributor/curl_zip.rb, line 19
def distribute
  zip_path = repo_path.to_s + '.zip'

  context.execute 'mkdir', '-p', repo_path
  context.execute 'curl', '--fail', '--location', '--silent',
                  '--output', zip_path, url
  context.execute 'unzip', '-q',
                  '-d', repo_path,
                  zip_path,
                  subtree.join('\\*')
  context.execute 'mv', repo_path.join(subtree), release_path

  context.execute 'rm', '-rf', zip_path, repo_path

  nil
end