Skip to content
Browse files

Allow filename globbing in copy_exclude for the copy strategy [#15 ta…

…gged:committed state:resolved]
  • Loading branch information...
1 parent aff9514 commit 7cf110452c7a60867a5a74bd4257d8bb0f5c9665 @jamis jamis committed Aug 19, 2008
Showing with 16 additions and 1 deletion.
  1. +2 −0 CHANGELOG.rdoc
  2. +1 −1 lib/capistrano/recipes/deploy/strategy/copy.rb
  3. +13 −0 test/deploy/strategy/copy_test.rb
View
2 CHANGELOG.rdoc
@@ -1,5 +1,7 @@
== (unreleased)
+* Allow filename globbing in copy_exclude setting for the copy strategy [Sharebear]
+
* Allow remote_cache strategy to use copy_exclude settings (requires rsync) [Lewis Mackenzie]
* Make None SCM module work in Windows [Carlos Kozuszko]
View
2 lib/capistrano/recipes/deploy/strategy/copy.rb
@@ -80,7 +80,7 @@ def deploy!
if copy_exclude.any?
logger.debug "processing exclusions..."
- copy_exclude.each { |pattern| FileUtils.rm_rf(File.join(destination, pattern)) }
+ copy_exclude.each { |pattern| FileUtils.rm_rf(Dir.glob(File.join(destination, pattern), File::FNM_DOTMATCH)) }
end
end
View
13 test/deploy/strategy/copy_test.rb
@@ -29,6 +29,19 @@ def test_deploy_with_exclusions_should_remove_patterns_from_destination
Dir.expects(:tmpdir).returns("/temp/dir")
@source.expects(:checkout).with("154", "/temp/dir/1234567890").returns(:local_checkout)
@strategy.expects(:system).with(:local_checkout)
+ Dir.expects(:glob).with("/temp/dir/1234567890/.git", File::FNM_DOTMATCH).returns("/temp/dir/1234567890/.git")
+
+ FileUtils.expects(:rm_rf).with("/temp/dir/1234567890/.git")
+ prepare_standard_compress_and_copy!
+ @strategy.deploy!
+ end
+
+ def test_deploy_with_exclusions_should_remove_glob_patterns_from_destination
+ @config[:copy_exclude] = ".gi*"
+ Dir.expects(:tmpdir).returns("/temp/dir")
+ @source.expects(:checkout).with("154", "/temp/dir/1234567890").returns(:local_checkout)
+ @strategy.expects(:system).with(:local_checkout)
+ Dir.expects(:glob).with("/temp/dir/1234567890/.gi*", File::FNM_DOTMATCH).returns("/temp/dir/1234567890/.git")
FileUtils.expects(:rm_rf).with("/temp/dir/1234567890/.git")
prepare_standard_compress_and_copy!

0 comments on commit 7cf1104

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