<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -24,7 +24,7 @@ module Capistrano
           # Step 2: Update the remote cache.
           logger.trace &quot;copying local cache to remote&quot;
           find_servers(:except =&gt; { :no_release =&gt; true }).each do |server|
-            system(&quot;rsync #{rsync_options} #{local_cache}/ #{rsync_host(server)}:#{repository_cache}/&quot;)
+            system(&quot;rsync #{rsync_options} --rsh='ssh -p #{ssh_port}' #{local_cache}/ #{rsync_host(server)}:#{repository_cache}/&quot;)
           end
 
           # Step 3: Copy the remote cache into place.
@@ -61,6 +61,10 @@ module Capistrano
           configuration[:rsync_options] || &quot;-az --delete&quot;
         end
 
+        def ssh_port
+          ssh_options[:port] || 22
+        end
+
         # Returns the host used in the rsync command, prefixed with user@ if user is specified in Capfile.
         def rsync_host(server)
           if configuration[:user]</diff>
      <filename>lib/capistrano/recipes/deploy/strategy/rsync_with_remote_cache.rb</filename>
    </modified>
    <modified>
      <diff>@@ -9,6 +9,10 @@ class CapistranoRsyncWithRemoteCacheTest &lt; Test::Unit::TestCase
     @rwrc.expects(:configuration).at_least_once.returns(hash)
   end
 
+  def stub_ssh_options(hash)
+    @rwrc.expects(:ssh_options).at_least_once.returns(hash)
+  end
+
   context 'RsyncWithRemoteCache' do
     setup do
       @rwrc = Capistrano::Deploy::Strategy::RsyncWithRemoteCache.new
@@ -19,6 +23,7 @@ class CapistranoRsyncWithRemoteCacheTest &lt; Test::Unit::TestCase
 
     should 'deploy!' do
       stub_configuration(:deploy_to =&gt; 'deploy_to', :release_path =&gt; 'release_path', :scm =&gt; :subversion)
+      stub_ssh_options(:port =&gt; nil)
       @rwrc.stubs(:shared_path).returns('shared')
 
       # Step 1: Update the local cache.
@@ -30,7 +35,7 @@ class CapistranoRsyncWithRemoteCacheTest &lt; Test::Unit::TestCase
 
       # Step 2: Update the remote cache.
       server_stub = stub(:host =&gt; 'host')
-      @rwrc.expects(:system).with(&quot;rsync -az --delete .rsync_cache/ host:shared/cached-copy/&quot;)
+      @rwrc.expects(:system).with(&quot;rsync -az --delete --rsh='ssh -p 22' .rsync_cache/ host:shared/cached-copy/&quot;)
       @rwrc.expects(:find_servers).returns([server_stub])
 
       # Step 3: Copy the remote cache into place.
@@ -91,6 +96,18 @@ class CapistranoRsyncWithRemoteCacheTest &lt; Test::Unit::TestCase
       end
     end
 
+    context 'ssh_port' do
+      should 'return specified port if present in configuration' do
+        stub_ssh_options(:port =&gt; 2222)
+        assert_equal 2222, @rwrc.send(:ssh_port)
+      end
+
+      should 'return default port if not present in configuration' do
+        stub_ssh_options(:port =&gt; nil)
+        assert_equal 22, @rwrc.send(:ssh_port)
+      end
+    end
+
     context 'rsync_host' do
       setup do
         @server_stub = stub(:host =&gt; 'host')</diff>
      <filename>test/capistrano_rsync_with_remote_cache_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>1c31d1a2001c646d7e052e9d9e6920768ee0cafb</id>
    </parent>
  </parents>
  <author>
    <name>Mark Cornick</name>
    <email>mcornick@gmail.com</email>
  </author>
  <url>http://github.com/vigetlabs/capistrano_rsync_with_remote_cache/commit/2bfb0f6f6c8f696fa66f34a1dbe1e324bafa737b</url>
  <id>2bfb0f6f6c8f696fa66f34a1dbe1e324bafa737b</id>
  <committed-date>2009-09-08T07:50:34-07:00</committed-date>
  <authored-date>2009-09-08T07:50:34-07:00</authored-date>
  <message>respect ssh_options[:port] in rsync; closes #2</message>
  <tree>97bea1ab974627fcd563982fb293a3f3c3b97532</tree>
  <committer>
    <name>Mark Cornick</name>
    <email>mcornick@gmail.com</email>
  </committer>
</commit>
