Class: Capistrano::Deploy::Strategy::CopyWorkingDir

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

Overview

This strategy behaves exactly as the regular :copy strategy, but it it uses the current working directory as source for deployment. So you need to make sure that all your gems are already bundled correctly.

Not every server has access to rubygems or other repository sources, so this is a try to make life easier for those who want to deploy a complete package without having to run extra tasks on the remote machines.

Instance Method Summary collapse

Instance Method Details

#deploy!Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/capistrano/recipes/deploy/strategy/copy_working_dir.rb', line 17

def deploy!
  FileUtils.mkdir_p(destination)
  
  logger.trace "copying working directory"
  FileUtils.cp_r( File.join(working_dir, '.'), destination )
  
  File.open( File.join(destination, "REVISION"), "w" ) { |f| f.puts(revision) }
  
  logger.trace "compressing #{destination} to #{filename}"
  Dir.chdir(copy_dir) { system(compress(File.basename(destination), File.basename(filename)).join(" ")) }
  
  distribute!
ensure
  FileUtils.rm filename rescue nil
  FileUtils.rm_rf destination rescue nil
end