Class: Capistrano::Distribution::Distributor::AbstractArchiver Abstract
- Defined in:
- lib/capistrano/distribution/distributor/abstract_archiver.rb
Overview
Subclass and override Capistrano::Distribution::Distributor::Abstract#distribute to create a distributor that extracts archives found on the local filesystem.
A convenience class for distributors that extract an archive file.
Direct Known Subclasses
Constant Summary collapse
- EXT_MATCHER =
A regexp that matches file extentions typically found on archives used to distribute program binaries and source releases.
%r{(\.[^\d.]+[^.]*)+$}
Instance Attribute Summary collapse
-
#subtree ⇒ Object
readonly
private
The path within the archive to extract.
Attributes inherited from Abstract
#context, #repo_id, #target, #url
Instance Method Summary collapse
-
#check ⇒ Boolean
Tests whether or not the archive indicated by Capistrano::Distribution::Distributor::Abstract#url is locally available.
-
#ext_matcher ⇒ Regexp
private
A regexp that matches file extentions.
-
#initialize(context, url, opts = {}) ⇒ AbstractArchiver
constructor
A new instance of AbstractArchiver.
Methods inherited from Abstract
#distribute, #release_path, #repo_path
Constructor Details
#initialize(context, url, opts = {}) ⇒ AbstractArchiver
Returns a new instance of AbstractArchiver.
28 29 30 31 32 33 |
# 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 |
Instance Attribute Details
#subtree ⇒ Object (readonly, private)
The path within the archive to extract. May be an empty string.
49 50 51 |
# File 'lib/capistrano/distribution/distributor/abstract_archiver.rb', line 49 def subtree @subtree end |
Instance Method Details
#check ⇒ Boolean
Tests whether or not the archive indicated by Capistrano::Distribution::Distributor::Abstract#url is locally available.
41 42 43 |
# File 'lib/capistrano/distribution/distributor/abstract_archiver.rb', line 41 def check context.test '[', '-f', url.path, ']' end |
#ext_matcher ⇒ Regexp (private)
Returns a regexp that matches file extentions.
53 54 55 |
# File 'lib/capistrano/distribution/distributor/abstract_archiver.rb', line 53 def ext_matcher EXT_MATCHER end |