class Capistrano::Distribution::Distributor::AbstractArchiver
@abstract Subclass and override {#distribute} to create a distributor that
extracts archives found on the local filesystem.
A convenience class for distributors that extract an archive file.
Constants
- EXT_MATCHER
A regexp that matches file extentions typically found on archives used to distribute program binaries and source releases.
Attributes
The path within the archive to extract. May be an empty string.
Public Class Methods
@param context [{#test, execute}] a Capistrano
context used to run
commands.
@param url [URI, String] a URL to be used for fetching the artifact to be
distributed
@param opts [Hash] options to override default settings @option opts [String] :subtree a path within the archive to extract as if
its contents were at the root of the archive
Capistrano::Distribution::Distributor::Abstract::new
# File lib/capistrano/distribution/distributor/abstract_archiver.rb, line 28 def initialize(context, url, opts = {}) super(context, url, opts) @subtree = Pathname.new( opts.fetch(:subtree, File.basename(url).sub(ext_matcher, '')) ) end
Public Instance Methods
Tests whether or not the archive indicated by {#url} is locally available.
@return [Boolean] true
if the archive is available; otherwise, false
.
@see Abstract#check
# File lib/capistrano/distribution/distributor/abstract_archiver.rb, line 41 def check context.test '[', '-f', url.path, ']' end
Private Instance Methods
@return [Regexp] a regexp that matches file extentions.
# File lib/capistrano/distribution/distributor/abstract_archiver.rb, line 53 def ext_matcher EXT_MATCHER end