Permalink
Browse files

Merge pull request #118 from heathd/master

Don't dereference symlinks when deploying via copy.

(allows for absolute symlinks… this commit might cause problems, but there haven't been any comments on the issue request, and it will help at least one person.)
  • Loading branch information...
leehambley committed Dec 11, 2011
2 parents f8f5f27 + 2c286e3 commit 0b7c374b9ed0e03ce5aa187564828e533b1db7bb
Showing with 10 additions and 10 deletions.
  1. +3 −3 lib/capistrano/recipes/deploy/strategy/copy.rb
  2. +7 −7 test/deploy/strategy/copy_test.rb
@@ -217,9 +217,9 @@ def compression
type = configuration[:copy_compression] || :gzip
case type
- when :gzip, :gz then Compression.new("tar.gz", [local_tar, 'chzf'], [remote_tar, 'xzf'])
- when :bzip2, :bz2 then Compression.new("tar.bz2", [local_tar, 'chjf'], [remote_tar, 'xjf'])
- when :zip then Compression.new("zip", %w(zip -qr), %w(unzip -q))
+ when :gzip, :gz then Compression.new("tar.gz", [local_tar, 'czf'], [remote_tar, 'xzf'])
+ when :bzip2, :bz2 then Compression.new("tar.bz2", [local_tar, 'cjf'], [remote_tar, 'xjf'])
+ when :zip then Compression.new("zip", %w(zip -qyr), %w(unzip -q))
else raise ArgumentError, "invalid compression type #{type.inspect}"
end
end
@@ -23,7 +23,7 @@ def test_deploy_with_defaults_should_use_remote_gtar
@strategy.expects(:system).with(:local_checkout)
Dir.expects(:chdir).with("/temp/dir").yields
- @strategy.expects(:system).with("tar chzf 1234567890.tar.gz 1234567890")
+ @strategy.expects(:system).with("tar czf 1234567890.tar.gz 1234567890")
@strategy.expects(:upload).with("/temp/dir/1234567890.tar.gz", "/tmp/1234567890.tar.gz")
@strategy.expects(:run).with("cd /u/apps/test/releases && gtar xzf /tmp/1234567890.tar.gz && rm /tmp/1234567890.tar.gz")
@@ -45,7 +45,7 @@ def test_deploy_with_defaults_should_use_local_gtar
@strategy.expects(:system).with(:local_checkout)
Dir.expects(:chdir).with("/temp/dir").yields
- @strategy.expects(:system).with("gtar chzf 1234567890.tar.gz 1234567890")
+ @strategy.expects(:system).with("gtar czf 1234567890.tar.gz 1234567890")
@strategy.expects(:upload).with("/temp/dir/1234567890.tar.gz", "/tmp/1234567890.tar.gz")
@strategy.expects(:run).with("cd /u/apps/test/releases && tar xzf /tmp/1234567890.tar.gz && rm /tmp/1234567890.tar.gz")
@@ -109,7 +109,7 @@ def test_deploy_with_zip_should_use_zip_and_checkout
@source.expects(:checkout).with("154", "/temp/dir/1234567890").returns(:local_checkout)
@strategy.expects(:system).with(:local_checkout)
- @strategy.expects(:system).with("zip -qr 1234567890.zip 1234567890")
+ @strategy.expects(:system).with("zip -qyr 1234567890.zip 1234567890")
@strategy.expects(:upload).with("/temp/dir/1234567890.zip", "/tmp/1234567890.zip")
@strategy.expects(:run).with("cd /u/apps/test/releases && unzip -q /tmp/1234567890.zip && rm /tmp/1234567890.zip")
@@ -130,7 +130,7 @@ def test_deploy_with_bzip2_should_use_bz2_and_checkout
@source.expects(:checkout).with("154", "/temp/dir/1234567890").returns(:local_checkout)
@strategy.expects(:system).with(:local_checkout)
- @strategy.expects(:system).with("tar chjf 1234567890.tar.bz2 1234567890")
+ @strategy.expects(:system).with("tar cjf 1234567890.tar.bz2 1234567890")
@strategy.expects(:upload).with("/temp/dir/1234567890.tar.bz2", "/tmp/1234567890.tar.bz2")
@strategy.expects(:run).with("cd /u/apps/test/releases && tar xjf /tmp/1234567890.tar.bz2 && rm /tmp/1234567890.tar.bz2")
@@ -161,7 +161,7 @@ def test_deploy_with_custom_copy_dir_should_use_that_as_tmpdir
@source.expects(:checkout).with("154", "/other/path/1234567890").returns(:local_checkout)
@strategy.expects(:system).with(:local_checkout)
- @strategy.expects(:system).with("tar chzf 1234567890.tar.gz 1234567890")
+ @strategy.expects(:system).with("tar czf 1234567890.tar.gz 1234567890")
@strategy.expects(:upload).with("/other/path/1234567890.tar.gz", "/tmp/1234567890.tar.gz")
@strategy.expects(:run).with("cd /u/apps/test/releases && tar xzf /tmp/1234567890.tar.gz && rm /tmp/1234567890.tar.gz")
@@ -182,7 +182,7 @@ def test_deploy_with_copy_remote_dir_should_copy_to_that_dir
@source.expects(:checkout).returns(:local_checkout)
@strategy.expects(:system).with(:local_checkout)
- @strategy.expects(:system).with("tar chzf 1234567890.tar.gz 1234567890")
+ @strategy.expects(:system).with("tar czf 1234567890.tar.gz 1234567890")
@strategy.expects(:upload).with("/temp/dir/1234567890.tar.gz", "/somewhere/else/1234567890.tar.gz")
@strategy.expects(:run).with("cd /u/apps/test/releases && tar xzf /somewhere/else/1234567890.tar.gz && rm /somewhere/else/1234567890.tar.gz")
@@ -321,7 +321,7 @@ def prepare_directory_tree!(cache, exclude=false)
def prepare_standard_compress_and_copy!
Dir.expects(:chdir).with("/temp/dir").yields
- @strategy.expects(:system).with("tar chzf 1234567890.tar.gz 1234567890")
+ @strategy.expects(:system).with("tar czf 1234567890.tar.gz 1234567890")
@strategy.expects(:upload).with("/temp/dir/1234567890.tar.gz", "/tmp/1234567890.tar.gz")
@strategy.expects(:run).with("cd /u/apps/test/releases && tar xzf /tmp/1234567890.tar.gz && rm /tmp/1234567890.tar.gz")

0 comments on commit 0b7c374

Please sign in to comment.