module Capistrano::Distribution::Distributor::TarHelper
A mixin containing methods useful for distributors that extract Tar
files.
Private Instance Methods
compression_opt()
click to toggle source
@return [String] the tar compression option to use based on the
{Abstract#url} attribute
@raise [RuntimeError] if the compression option cannot be guessed.
# 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()
click to toggle source
@return [String] the component stripping option based on the number of path
elements in the {AbstractArchiver#subtree} attribute
# 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