Module: Capistrano::Distribution::Distributor::TarHelper
Overview
A mixin containing methods useful for distributors that extract Tar files.
Instance Method Summary collapse
-
#compression_opt ⇒ String
private
The tar compression option to use based on the Abstract#url attribute.
-
#strip_components_opt ⇒ String
private
The component stripping option based on the number of path elements in the AbstractArchiver#subtree attribute.
Instance Method Details
#compression_opt ⇒ String (private)
Returns the tar compression option to use based on the Abstract#url attribute.
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/capistrano/distribution/distributor/tar_helper.rb', line 15 def compression_opt case url.path when %r{\.(tar\.gz|tgz)$} '-z' when %r{\.(tar\.bz2|tbz2)$} '-j' when %r{\.tar$} '' else raise "Unable to guess decompression option for URL: #{url}" end end |
#strip_components_opt ⇒ String (private)
31 32 33 34 35 |
# File 'lib/capistrano/distribution/distributor/tar_helper.rb', line 31 def strip_components_opt path = subtree.to_s.slice %r#^/?(.*?)/?$#, 1 components = path.split('/').size "--strip-components #{components}" end |