Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

move copy of cache to server to its own method

  • Loading branch information...
commit 8586954510ba2e7d3e07b0c6027c0ce831b51931 1 parent 6e17f9f
@despo authored
Showing with 26 additions and 23 deletions.
  1. +26 −23 lib/capistrano/recipes/deploy/strategy/copy.rb
View
49 lib/capistrano/recipes/deploy/strategy/copy.rb
@@ -64,29 +64,7 @@ def deploy!
rollback_changes if last_command_failed?
build(copy_cache)
-
- FileUtils.mkdir_p(destination)
-
- logger.debug "copying cache to deployment staging area #{destination}"
- Dir.chdir(copy_cache) do
- queue = Dir.glob("*", File::FNM_DOTMATCH)
- while queue.any?
- item = queue.shift
- name = File.basename(item)
-
- next if name == "." || name == ".."
- next if copy_exclude.any? { |pattern| File.fnmatch(pattern, item) }
-
- if File.symlink?(item)
- FileUtils.ln_s(File.readlink(item), File.join(destination, item))
- elsif File.directory?(item)
- queue += Dir.glob("#{item}/*", File::FNM_DOTMATCH)
- FileUtils.mkdir(File.join(destination, item))
- else
- FileUtils.ln(item, File.join(destination, item))
- end
- end
- end
+ copy_cache_to_server
else
logger.debug "getting (via #{copy_strategy}) revision #{revision} to #{destination}"
system(command)
@@ -164,6 +142,31 @@ def last_command_failed?
$? != 0
end
+ def copy_cache_to_server
+ FileUtils.mkdir_p(destination)
+
+ logger.debug "copying cache to deployment staging area #{destination}"
+ Dir.chdir(copy_cache) do
+ queue = Dir.glob("*", File::FNM_DOTMATCH)
+ while queue.any?
+ item = queue.shift
+ name = File.basename(item)
+
+ next if name == "." || name == ".."
+ next if copy_exclude.any? { |pattern| File.fnmatch(pattern, item) }
+
+ if File.symlink?(item)
+ FileUtils.ln_s(File.readlink(item), File.join(destination, item))
+ elsif File.directory?(item)
+ queue += Dir.glob("#{item}/*", File::FNM_DOTMATCH)
+ FileUtils.mkdir(File.join(destination, item))
+ else
+ FileUtils.ln(item, File.join(destination, item))
+ end
+ end
+ end
+ end
+
# Specify patterns to exclude from the copy. This is only valid
# when using a local cache.
def copy_exclude
Please sign in to comment.
Something went wrong with that request. Please try again.