Skip to content
Browse files

Only mark revision once; Rename method to better indicate intent

  • Loading branch information...
1 parent 96b1bbe commit 5a5272e73af01eba0739beabe3a5e58213ab15e2 @reagent reagent committed Mar 31, 2010
View
6 lib/capistrano/recipes/deploy/strategy/rsync_with_remote_cache.rb
@@ -31,7 +31,7 @@ def deploy!
def update_local_cache
system(command)
- tag_local_cache
+ mark_local_cache
end
def update_remote_cache
@@ -40,14 +40,14 @@ def update_remote_cache
end
def copy_remote_cache
- run("rsync -a --delete #{repository_cache_path}/ #{configuration[:release_path]}/ && #{mark}")
+ run("rsync -a --delete #{repository_cache_path}/ #{configuration[:release_path]}/")
end
def rsync_command_for(server)
"rsync #{rsync_options} --rsh='ssh -p #{ssh_port}' #{local_cache_path}/ #{rsync_host(server)}:#{repository_cache_path}/"
end
- def tag_local_cache
+ def mark_local_cache
File.open(File.join(local_cache_path, 'REVISION'), 'w') {|f| f << revision }
end
View
9 test/capistrano_rsync_with_remote_cache_test.rb
@@ -212,15 +212,15 @@ class CapistranoRsyncWithRemoteCacheTest < Test::Unit::TestCase
@strategy.stubs(:revision).with().returns('1')
@strategy.stubs(:local_cache_path).with().returns(local_cache_path)
- @strategy.tag_local_cache
+ @strategy.mark_local_cache
File.read(File.join(local_cache_path, 'REVISION')).should == '1'
end
should "be able to update the local cache" do
@strategy.stubs(:command).with().returns('scm_command')
@strategy.expects(:system).with('scm_command')
- @strategy.expects(:tag_local_cache).with()
+ @strategy.expects(:mark_local_cache).with()
@strategy.update_local_cache
end
@@ -258,11 +258,10 @@ class CapistranoRsyncWithRemoteCacheTest < Test::Unit::TestCase
should "be able copy the remote cache into place" do
@strategy.stubs(
:repository_cache_path => 'repository_cache_path',
- :configuration => {:release_path => 'release_path'},
- :mark => 'mark_command'
+ :configuration => {:release_path => 'release_path'}
)
- command = "rsync -a --delete repository_cache_path/ release_path/ && mark_command"
+ command = "rsync -a --delete repository_cache_path/ release_path/"
@strategy.expects(:run).with(command)
@strategy.copy_remote_cache

0 comments on commit 5a5272e

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