capistrano_rsync_with_remote_cache 2.3.2 → 2.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 2
3
3
  :minor: 3
4
- :patch: 2
4
+ :patch: 3
@@ -75,9 +75,9 @@ module Capistrano
75
75
  def command
76
76
  if configuration[:scm] == :subversion
77
77
  svn_info = IO.popen("svn info #{local_cache} | sed -n 's/URL: //p'")
78
- svn_url = svn_info.gets.chomp
78
+ svn_url = svn_info.gets
79
79
  svn_info.close
80
- if svn_url != configuration[:repository]
80
+ if svn_url && svn_url.chomp != configuration[:repository]
81
81
  logger.trace "repository has changed; removing old local cache"
82
82
  FileUtils.rm_rf local_cache
83
83
  end
@@ -117,7 +117,7 @@ class CapistranoRsyncWithRemoteCacheTest < Test::Unit::TestCase
117
117
  end
118
118
 
119
119
  context 'command' do
120
- should 'recreate local cache if it detects subversion info has changed' do
120
+ should 'purge and recreate local cache if it detects subversion info has changed' do
121
121
  stub_configuration(:scm => :subversion, :repository => 'repository')
122
122
 
123
123
  svn_info_stub = stub()
@@ -132,6 +132,32 @@ class CapistranoRsyncWithRemoteCacheTest < Test::Unit::TestCase
132
132
  @rwrc.send(:command)
133
133
  end
134
134
 
135
+ should 'not attempt to purge and recreate local cache that does not exist' do
136
+ stub_configuration(:scm => :subversion, :repository => 'repository')
137
+
138
+ svn_info_stub = stub()
139
+ svn_info_stub.expects(:gets).returns(nil)
140
+ svn_info_stub.expects(:close)
141
+ IO.expects(:popen).with("svn info .rsync_cache | sed -n 's/URL: //p'").returns(svn_info_stub)
142
+
143
+ FileUtils.expects(:rm_rf).with('.rsync_cache').never
144
+
145
+ stub_creation_of_new_local_cache
146
+
147
+ @rwrc.send(:command)
148
+ end
149
+
150
+ should 'not attempt to purge and recreate local cache if the scm is not subversion' do
151
+ stub_configuration(:scm => :git, :repository => 'repository')
152
+
153
+ IO.expects(:popen).with("svn info .rsync_cache | sed -n 's/URL: //p'").never
154
+ FileUtils.expects(:rm_rf).with('.rsync_cache').never
155
+
156
+ stub_creation_of_new_local_cache
157
+
158
+ @rwrc.send(:command)
159
+ end
160
+
135
161
  should 'update local cache if it exists' do
136
162
  File.expects(:exists?).with('.rsync_cache').returns(true)
137
163
  File.expects(:directory?).with('.rsync_cache').returns(true)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano_rsync_with_remote_cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.2
4
+ version: 2.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Cornick
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-15 00:00:00 -04:00
12
+ date: 2009-05-18 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency