Class: Capistrano::Distribution::Distributor::CurlZip

Inherits:
AbstractCurl show all
Defined in:
lib/capistrano/distribution/distributor/curl_zip.rb

Overview

Deploys ZIP files downloadable using the curl command.

Constant Summary

Constants inherited from AbstractArchiver

AbstractArchiver::EXT_MATCHER

Instance Attribute Summary

Attributes inherited from AbstractArchiver

#subtree

Attributes inherited from Abstract

#context, #repo_id, #target, #url

Instance Method Summary collapse

Methods inherited from AbstractCurl

#check

Methods inherited from AbstractArchiver

#check, #ext_matcher, #initialize

Methods inherited from Abstract

#check, #initialize, #release_path, #repo_path

Constructor Details

This class inherits a constructor from Capistrano::Distribution::Distributor::AbstractArchiver

Instance Method Details

#distributenil

Extracts the content rooted under AbstractArchiver#subtree within the ZIP file indicated by Abstract#url to the location indicated by Abstract#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.

See Also:

  • Archiver#distribute


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# 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