Class: Capistrano::Deploy::Strategy::LocalCopy

Inherits:
Base
  • Object
show all
Defined in:
lib/capistrano/recipes/deploy/strategy/local_copy.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#deploy!Object

:nodoc:



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/capistrano/recipes/deploy/strategy/local_copy.rb', line 9

def deploy! # :nodoc:
  logger.debug "compressing local copy to #{filename}"
  local_files.tar_cz filename, '.', :verbose=>false do |item|
    if (item=item[2..-1]) and item.length > 0
      name = File.basename item
      name == "." || name == ".." || copy_prune.include?(name) ||
        copy_exclude.any?{|p| File.fnmatch(p, item, File::FNM_DOTMATCH)} ||
        (! File.directory?(item) && copy_directory_only.any?{|p| item[0,p.length+1]==p+'/'})
    end
  end
  files.upload filename, remote_filename
  begin
    files.mkdir_p configuration[:release_path]
    files.tar_xz remote_filename, :chdir=>configuration[:release_path], :verbose=>true
  ensure
    files.rm_f remote_filename rescue nil
  end
ensure
  FileUtils.rm filename rescue nil
  FileUtils.rm_rf destination rescue nil
end