Class: Capistrano::Deploy::SCM::Git

Inherits:
Object
  • Object
show all
Defined in:
lib/railscluster/capistrano/capistrano_extensions.rb

Instance Method Summary collapse

Instance Method Details

#export(revision, destination) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/railscluster/capistrano/capistrano_extensions.rb', line 16

def export(revision, destination)
  if variable(:git_enable_submodules) || !variable(:repository).include?('git.nedforce.nl')
    checkout(revision, destination) << " && rm -Rf #{destination}/.git"
  else
    git    = command
    remote = origin

    args = []

    args << "--verbose" if verbose.nil?
    args << "--prefix=#{destination[1..-1]}/"
    args << "--remote #{variable(:repository)}"
    
    execute = []
    execute << "#{git} archive #{args.join(' ')} #{revision} | (tar -x -C / -f -)"

    execute.compact.join(" && ").gsub(/\s+/, ' ')
  end
end