class Capistrano::Distribution::Distributor::Abstract
@abstract Subclass and override {#check} and {#distribute} to create a
distributor.
An abstract distributor upon which all distributors should ultimately be based.
See the existing concrete distributor definitions for examples.
Attributes
The Capistrano
context in which the distributor will operate.
A unique identifier for the distributor for use under {#repo_path}.
A path relative to the release location in which to distribute the artifact.
The source URL for the artifact to be distributed.
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] :target ('') a path within the release area to be the
root of the distribution.
# File lib/capistrano/distribution/distributor/abstract.rb, line 22 def initialize(context, url, opts = {}) @context = context @url = URI === url ? url : URI.parse(url) @target = opts.fetch(:target, '') @repo_id = Digest::SHA1.hexdigest(url.to_s) end
Public Instance Methods
@abstract Override to provide a meaningful check for prerequisites during
deployment.
@return [Boolean] true
when prerequisites are met and false
otherwise.
# File lib/capistrano/distribution/distributor/abstract.rb, line 36 def check false end
@abstract Override to provide meaningful distribution logic during
deployment.
@return [nil]
@raise [exception] when distribution fails.
# File lib/capistrano/distribution/distributor/abstract.rb, line 47 def distribute end
Private Instance Methods
@return [Pathname] a path to the release location in which to distribute the
artifact based on {#target}
# File lib/capistrano/distribution/distributor/abstract.rb, line 71 def release_path context.release_path.join(target) end
@return [Pathname] a path under the repo location to a unique workspace for
the distributor
# File lib/capistrano/distribution/distributor/abstract.rb, line 78 def repo_path context.repo_path.join(repo_id) end