capistrano_rsync_with_remote_cache 2.3.8 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,16 +3,16 @@
3
3
  == Description
4
4
 
5
5
  This gem provides a deployment strategy for Capistrano which combines the
6
- <tt>rsync</tt> command with a remote cache, allowing fast deployments from SCM
6
+ <tt>rsync</tt> command with a remote cache, allowing fast deployments from SCM
7
7
  repositories behind firewalls.
8
8
 
9
9
  == Requirements
10
10
 
11
11
  This gem supports Subversion, Git, Mercurial and Bazaar. Only Subversion and
12
- Git have been extensively tested. This gem is unlikely to be supported for
12
+ Git have been extensively tested. This gem is unlikely to be supported for
13
13
  other SCM systems.
14
14
 
15
- This gem requires the <tt>rsync</tt> command-line utilities on the local and
15
+ This gem requires the <tt>rsync</tt> command-line utilities on the local and
16
16
  remote hosts. It also requires either <tt>svn</tt>, <tt>git</tt>, <tt>hg</tt>
17
17
  or <tt>bzr</tt> on the local host, but not the remote host.
18
18
 
@@ -32,41 +32,47 @@ To use this deployment strategy, add this line to your <tt>deploy.rb</tt> file:
32
32
 
33
33
  This strategy maintains two cache directories:
34
34
 
35
- * The local cache directory is a checkout from the SCM repository. The local
36
- cache directory is specified with the <tt>:local_cache</tt> variable in the
37
- configuration. If not specified, it will default to <tt>.rsync_cache</tt>
35
+ * The local cache directory is a checkout from the SCM repository. The local
36
+ cache directory is specified with the <tt>:local_cache</tt> variable in the
37
+ configuration. If not specified, it will default to <tt>.rsync_cache</tt>
38
38
  in the same directory as the Capfile.
39
-
40
- * The remote cache directory is an <tt>rsync</tt> copy of the local cache directory.
39
+
40
+ * The remote cache directory is an <tt>rsync</tt> copy of the local cache directory.
41
41
  The remote cache directory is specified with the <tt>:repository_cache</tt> variable
42
- in the configuration (this name comes from the <tt>:remote_cache</tt> strategy that
43
- ships with Capistrano, and has been maintained for compatibility.) If not
44
- specified, it will default to <tt>shared/cached-copy</tt> (again, for compatibility
42
+ in the configuration (this name comes from the <tt>:remote_cache</tt> strategy that
43
+ ships with Capistrano, and has been maintained for compatibility.) If not
44
+ specified, it will default to <tt>shared/cached-copy</tt> (again, for compatibility
45
45
  with remote_cache.)
46
46
 
47
- Deployment happens in three major steps. First, the local cache directory is
47
+ Deployment happens in three major steps. First, the local cache directory is
48
48
  processed. There are three possibilities:
49
49
 
50
- * If the local cache does not exist, it is created with a checkout of the
50
+ * If the local cache does not exist, it is created with a checkout of the
51
51
  revision to be deployed.
52
- * If the local cache exists and matches the <tt>:repository</tt> variable, it is
52
+ * If the local cache exists and matches the <tt>:repository</tt> variable, it is
53
53
  updated to the revision to be deployed.
54
- * If the local cache exists and does not match the <p>:repository</p> variable,
55
- the local cache is purged and recreated with a checkout of the revision
54
+ * If the local cache exists and does not match the <p>:repository</p> variable,
55
+ the local cache is purged and recreated with a checkout of the revision
56
56
  to be deployed.
57
57
  * If the local cache exists but is not a directory, an exception is raised
58
58
 
59
- Second, <tt>rsync</tt> runs on the local side to sync the remote cache to the local
60
- cache. When the <tt>rsync</tt> is complete, the remote cache should be an exact
59
+ Second, <tt>rsync</tt> runs on the local side to sync the remote cache to the local
60
+ cache. When the <tt>rsync</tt> is complete, the remote cache should be an exact
61
61
  replica of the local cache.
62
62
 
63
- Finally, a copy of the remote cache is made in the appropriate release
64
- directory. The end result is the same as if the code had been checked out
63
+ Finally, a copy of the remote cache is made in the appropriate release
64
+ directory. The end result is the same as if the code had been checked out
65
65
  directly on the remote server, as in the default strategy.
66
66
 
67
+ == Contributors
68
+
69
+ Thanks to the people who submitted patches:
70
+
71
+ * {S. Brent Faulkner}[http://github.com/sbfaulkner]
72
+
67
73
  == License
68
74
 
69
- Copyright (c) 2007 - 2010 Patrick Reagan (patrick.reagan@viget.com) & Mark Cornick
75
+ Copyright (c) 2007 - 2010 Patrick Reagan (patrick.reagan@viget.com) & Mark Cornick
70
76
 
71
77
  Permission is hereby granted, free of charge, to any person
72
78
  obtaining a copy of this software and associated documentation
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ require 'rake/testtask'
4
4
 
5
5
  spec = Gem::Specification.new do |s|
6
6
  s.name = 'capistrano_rsync_with_remote_cache'
7
- s.version = '2.3.8'
7
+ s.version = '2.4.0'
8
8
  s.has_rdoc = true
9
9
  s.extra_rdoc_files = %w(README.rdoc)
10
10
  s.rdoc_options = %w(--main README.rdoc)
@@ -13,7 +13,7 @@ spec = Gem::Specification.new do |s|
13
13
  s.email = 'patrick.reagan@viget.com'
14
14
  s.homepage = 'http://www.viget.com/extend/'
15
15
  s.files = %w(README.rdoc Rakefile) + Dir.glob("{lib,test}/**/*")
16
-
16
+
17
17
  s.add_dependency('capistrano', '>=2.1.0')
18
18
  end
19
19
 
@@ -44,15 +44,15 @@ module Capistrano
44
44
  end
45
45
 
46
46
  def rsync_command_for(server)
47
- "rsync #{rsync_options} --rsh='ssh -p #{ssh_port}' #{local_cache_path}/ #{rsync_host(server)}:#{repository_cache_path}/"
47
+ "rsync #{rsync_options} --rsh='ssh -p #{ssh_port(server)}' #{local_cache_path}/ #{rsync_host(server)}:#{repository_cache_path}/"
48
48
  end
49
49
 
50
50
  def mark_local_cache
51
51
  File.open(File.join(local_cache_path, 'REVISION'), 'w') {|f| f << revision }
52
52
  end
53
53
 
54
- def ssh_port
55
- ssh_options[:port] || 22
54
+ def ssh_port(server)
55
+ server.port || ssh_options[:port] || 22
56
56
  end
57
57
 
58
58
  def local_cache_path
@@ -103,12 +103,20 @@ class CapistranoRsyncWithRemoteCacheTest < Test::Unit::TestCase
103
103
 
104
104
  should "know the default SSH port" do
105
105
  @strategy.stubs(:ssh_options).with().returns({})
106
- @strategy.ssh_port.should == 22
106
+ server = stub(:port => nil)
107
+ @strategy.ssh_port(server).should == 22
107
108
  end
108
109
 
109
110
  should "be able to override the default SSH port" do
110
111
  @strategy.stubs(:ssh_options).with().returns({:port => 95})
111
- @strategy.ssh_port.should == 95
112
+ server = stub(:port => nil)
113
+ @strategy.ssh_port(server).should == 95
114
+ end
115
+
116
+ should "be able to override the default SSH port for each server" do
117
+ @strategy.stubs(:ssh_options).with().returns({:port => 95})
118
+ server = stub(:port => 123)
119
+ @strategy.ssh_port(server).should == 123
112
120
  end
113
121
 
114
122
  should "know the default repository cache" do
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 2
7
- - 3
8
- - 8
9
- version: 2.3.8
7
+ - 4
8
+ - 0
9
+ version: 2.4.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Patrick Reagan
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-04-08 00:00:00 -04:00
18
+ date: 2010-06-29 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency