class Capistrano::Distribution::Distributor::AbstractGit
@abstract Subclass and override {#check} and {#distribute} to create a
distributor that uses Git to distribute code from a Git repository.
An abstract distributor that operates on Git repositories.
Attributes
revision[R]
The identifier for a Git commit that will be distributed.
subtree[R]
A subtree of the repository to distribute.
Public Class Methods
new(context, url, revision, opts = {})
click to toggle source
@param url [URI, String] a URL to be used for fetching the artifact to be
distributed
@param revision [String] a commit identifier (revision SHA or ref) to be
distributed
Calls superclass method
Capistrano::Distribution::Distributor::Abstract::new
# File lib/capistrano/distribution/distributor/abstract_git.rb, line 22 def initialize(context, url, revision, opts = {}) super(context, url, opts) @revision = revision @subtree = opts[:subtree] end
Private Instance Methods
release()
click to toggle source
Extracts the content of the commit at {#revision} from the local mirror of the repository to {#release_path}.
@return [nil]
# File lib/capistrano/distribution/distributor/abstract_git.rb, line 39 def release context.execute 'mkdir', '-p', release_path if subtree path = subtree.slice %r#^/?(.*?)/?$#, 1 components = path.split('/').size context.execute :git, '--git-dir', repo_path, :archive, revision, path, "| tar -x --strip-components #{components} -f - -C", release_path else context.execute :git, '--git-dir', repo_path, :archive, revision, '| tar -x -f - -C', release_path end nil end