Skip to content
Browse files

extract to remove_excluded_files method

  • Loading branch information...
1 parent 7897b46 commit b534177c1356ff35bd810b4db70cf438b9d3b376 @despo committed
Showing with 12 additions and 10 deletions.
  1. +12 −10 lib/capistrano/recipes/deploy/strategy/copy.rb
View
22 lib/capistrano/recipes/deploy/strategy/copy.rb
@@ -70,16 +70,7 @@ def deploy!
build(destination)
- if copy_exclude.any?
- logger.debug "processing exclusions..."
-
- copy_exclude.each do |pattern|
- delete_list = Dir.glob(File.join(destination, pattern), File::FNM_DOTMATCH)
- # avoid the /.. trap that deletes the parent directories
- delete_list.delete_if { |dir| dir =~ /\/\.\.$/ }
- FileUtils.rm_rf(delete_list.compact)
- end
- end
+ remove_excluded_files if copy_exclude.any?
end
File.open(File.join(destination, "REVISION"), "w") { |f| f.puts(revision) }
@@ -171,6 +162,17 @@ def copy_repository_to_server
system(command)
end
+ def remove_excluded_files
+ logger.debug "processing exclusions..."
+
+ copy_exclude.each do |pattern|
+ delete_list = Dir.glob(File.join(destination, pattern), File::FNM_DOTMATCH)
+ # avoid the /.. trap that deletes the parent directories
+ delete_list.delete_if { |dir| dir =~ /\/\.\.$/ }
+ FileUtils.rm_rf(delete_list.compact)
+ end
+ end
+
# Specify patterns to exclude from the copy. This is only valid
# when using a local cache.
def copy_exclude

0 comments on commit b534177

Please sign in to comment.
Something went wrong with that request. Please try again.