Skip to content
Browse files

Moved rsync exclude in cook command to sep method. Test for test_rsyn…

…c_exclude_sources_chefignore.
  • Loading branch information...
1 parent b696231 commit c25c102e931f4a6e358e152d438132e49bde97df @amoslanka amoslanka committed Apr 12, 2012
Showing with 16 additions and 5 deletions.
  1. +5 −2 lib/chef/knife/cook.rb
  2. +11 −3 test/cook_test.rb
View
7 lib/chef/knife/cook.rb
@@ -84,9 +84,12 @@ def patch_path
Array(Chef::Config.cookbook_path).first + "/chef_solo_patches/libraries"
end
+ def rsync_exclude
+ (%w{revision-deploys tmp '.*'} + chefignore.ignores).uniq
+ end
+
def rsync_kitchen
- excludes = (%w{revision-deploys tmp '.*'} + chefignore.ignores).uniq.collect{ |ignore| "--exclude #{ignore} " }.join
- system! %Q{rsync -rl --rsh="ssh #{ssh_args}" --delete #{excludes} ./ :#{adjust_rsync_path(chef_path)}}
+ system! %Q{rsync -rl --rsh="ssh #{ssh_args}" --delete #{rsync_exclude.collect{ |ignore| "--exclude #{ignore} " }.join} ./ :#{adjust_rsync_path(chef_path)}}
end
def add_patches
View
14 test/cook_test.rb
@@ -25,7 +25,6 @@ def test_chefignore_is_valid_object
end
def test_check_syntax_ignores_files_in_chefignore
-
Dir.chdir("/tmp/cook_kitchen_test") do
assert File.exist?("syntax_error.rb")
assert !check_syntax('syntax_error.rb')
@@ -37,10 +36,19 @@ def test_check_syntax_ignores_files_in_chefignore
File.open("chefignore", 'w') do |f|
f << "syntax_error.rb"
end
-
+
command.check_syntax
end
-
+ end
+
+ def test_rsync_exclude_sources_chefignore
+ Dir.chdir("/tmp/cook_kitchen_test") do
+ assert File.exist?("syntax_error.rb")
+ File.open("chefignore", 'w') do |f|
+ f << "syntax_error.rb"
+ end
+ assert command.rsync_exclude.include?("syntax_error.rb")
+ end
end
def setup

0 comments on commit c25c102

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