public
Description: Remote multi-server automation tool
Homepage: http://www.capify.org
Clone URL: git://github.com/jamis/capistrano.git
Search Repo:
Added :copy_remote_dir for :copy strategy to indicate where the file 
should be copied to


git-svn-id: http://svn.rubyonrails.org/rails/tools/capistrano@7131 
5ecf4fe2-1ee6-0310-87b1-e25e094e27de
jamis (author)
Tue Jun 26 19:41:26 -0700 2007
commit  ecb325d09e8c5d3134095062157889cc53fe8b93
tree    41066af730bf83ec8a7fc9e50fdf925b610fdaa8
parent  90b390bcc4849848e7166004d574152bac7fb10f
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 *SVN*
0
 
0
+* Add :copy_remote_dir variable for the :copy strategy, to indicate where the archive should be copied to on the remote servers [Jamis Buck]
0
+
0
 * Make the awk use in the dependencies code work with POSIX awk [mcornick]
0
 
0
 * Make variable accesses thread safe [via Adrian Danieli]
...
83
84
85
 
 
 
 
 
 
86
87
88
89
 
90
91
92
...
83
84
85
86
87
88
89
90
91
92
93
94
 
95
96
97
98
0
@@ -83,10 +83,16 @@ module Capistrano
0
             @tmpdir ||= configuration[:copy_dir] || Dir.tmpdir
0
           end
0
 
0
+ # The directory on the remote server to which the archive should be
0
+ # copied
0
+ def remote_dir
0
+ @remote_dir ||= configuration[:copy_remote_dir] || "/tmp"
0
+ end
0
+
0
           # The location on the remote server where the file should be
0
           # temporarily stored.
0
           def remote_filename
0
- @remote_filename ||= "/tmp/#{File.basename(filename)}"
0
+ @remote_filename ||= File.join(remote_dir, File.basename(filename))
0
           end
0
 
0
           # The compression method to use, defaults to :gzip.
...
121
122
123
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
...
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
0
@@ -121,4 +121,26 @@ class DeployStrategyCopyTest < Test::Unit::TestCase
0
 
0
     @strategy.deploy!
0
   end
0
+
0
+ def test_deploy_with_copy_remote_dir_should_copy_to_that_dir
0
+ @config[:copy_remote_dir] = "/somewhere/else"
0
+ Dir.expects(:tmpdir).returns("/temp/dir")
0
+ Dir.expects(:chdir).yields
0
+ @source.expects(:checkout).returns(:local_checkout)
0
+
0
+ @strategy.expects(:system).with(:local_checkout)
0
+ @strategy.expects(:system).with("tar czf 1234567890.tar.gz 1234567890")
0
+ @strategy.expects(:put).with(:mock_file_contents, "/somewhere/else/1234567890.tar.gz")
0
+ @strategy.expects(:run).with("cd /u/apps/test/releases && tar xzf /somewhere/else/1234567890.tar.gz && rm /somewhere/else/1234567890.tar.gz")
0
+
0
+ mock_file = mock("file")
0
+ mock_file.expects(:puts).with("154")
0
+ File.expects(:open).with("/temp/dir/1234567890/REVISION", "w").yields(mock_file)
0
+ File.expects(:read).with("/temp/dir/1234567890.tar.gz").returns(:mock_file_contents)
0
+
0
+ FileUtils.expects(:rm).with("/temp/dir/1234567890.tar.gz")
0
+ FileUtils.expects(:rm_rf).with("/temp/dir/1234567890")
0
+
0
+ @strategy.deploy!
0
+ end
0
 end

Comments

    No one has commented yet.