whiskey_disk 0.6.15 → 0.6.16

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,4 +1,13 @@
1
1
 
2
+ 0.6.16 / 2011-03-08
3
+ ==================
4
+
5
+ * Turning off shallow clones for 'wd setup'
6
+ * minor refactoring of new checkout functionality
7
+ * check out the specified branch on setup
8
+ * adding integration specs to test setup + deploy at once
9
+ * tweaking a couple of old path specs
10
+
2
11
  0.6.15 / 2011-03-07
3
12
  ==================
4
13
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.15
1
+ 0.6.16
data/lib/whiskey_disk.rb CHANGED
@@ -190,10 +190,14 @@ class WhiskeyDisk
190
190
  %Q(rakep=`#{env_vars} rake -P` && if [[ `echo "${rakep}" | grep #{task}` != "" ]]; then #{cmd}; fi )
191
191
  end
192
192
 
193
- def clone_repository(repo, path)
193
+ def safe_branch_checkout(path, my_branch)
194
+ %Q(cd #{path} && git checkout -b #{my_branch} origin/#{my_branch} || git checkout #{my_branch})
195
+ end
196
+
197
+ def clone_repository(repo, path, my_branch)
194
198
  enqueue "cd #{parent_path(path)}"
195
199
  enqueue("if [ -e #{path} ]; then echo 'Repository already cloned to [#{path}]. Skipping.'; " +
196
- "else git clone --depth 1 #{repo} #{tail_path(path)} ; fi")
200
+ "else git clone #{repo} #{tail_path(path)} && #{safe_branch_checkout(path, my_branch)}; fi")
197
201
  end
198
202
 
199
203
  def refresh_checkout(path, repo_branch)
@@ -231,12 +235,12 @@ class WhiskeyDisk
231
235
 
232
236
  def checkout_main_repository
233
237
  needs(:deploy_to, :repository)
234
- clone_repository(self[:repository], self[:deploy_to])
238
+ clone_repository(self[:repository], self[:deploy_to], branch)
235
239
  end
236
240
 
237
241
  def checkout_configuration_repository
238
242
  needs(:deploy_config_to, :config_repository)
239
- clone_repository(self[:config_repository], self[:deploy_config_to])
243
+ clone_repository(self[:config_repository], self[:deploy_config_to], config_branch)
240
244
  end
241
245
 
242
246
  def update_main_repository_checkout
@@ -202,19 +202,45 @@ describe 'WhiskeyDisk' do
202
202
 
203
203
  it 'should work from the main repository checkout parent path' do
204
204
  WhiskeyDisk.checkout_main_repository
205
- WhiskeyDisk.buffer.join(' ').should.match(%r{cd /path/to/main})
206
- WhiskeyDisk.buffer.join(' ').should.not.match(%r{cd /path/to/main/repo})
205
+ WhiskeyDisk.buffer.join(' ').should.match(%r{cd /path/to/main[^/]})
207
206
  end
208
207
 
209
- it 'should attempt to shallow clone the main repository to the repository checkout path' do
208
+ it 'should attempt to clone the main repository to the repository checkout path' do
210
209
  WhiskeyDisk.checkout_main_repository
211
- WhiskeyDisk.buffer.join(' ').should.match(%r{clone --depth 1 #{@parameters['repository']} repo})
210
+ WhiskeyDisk.buffer.join(' ').should.match(%r{clone #{@parameters['repository']} repo})
212
211
  end
213
212
 
214
213
  it 'should make the main repository clone conditional on the lack of a main repository checkout' do
215
214
  WhiskeyDisk.checkout_main_repository
216
215
  WhiskeyDisk.buffer.join(' ').should.match(%r{if \[ -e #{@parameters['deploy_to']} \]; then .*; fi})
217
216
  end
217
+
218
+ it 'should do a branch creation checkout of the master branch when no branch is specified' do
219
+ WhiskeyDisk.checkout_main_repository
220
+ WhiskeyDisk.buffer.join(' ').should.match(%r{git checkout -b master origin/master})
221
+ end
222
+
223
+ it 'should fall back to a regular checkout of the master branch when no branch is specified' do
224
+ WhiskeyDisk.checkout_main_repository
225
+ WhiskeyDisk.buffer.join(' ').should.match(%r{\|\| git checkout master})
226
+ end
227
+
228
+ it 'should do a branch creation checkout of the specified branch when a branch is specified' do
229
+ WhiskeyDisk.configuration = @parameters.merge({'branch' => 'production'})
230
+ WhiskeyDisk.checkout_main_repository
231
+ WhiskeyDisk.buffer.join(' ').should.match(%r{git checkout -b production origin/production})
232
+ end
233
+
234
+ it 'should fall back to a regular checkout of the specified branch when a branch is specified' do
235
+ WhiskeyDisk.configuration = @parameters.merge({'branch' => 'production'})
236
+ WhiskeyDisk.checkout_main_repository
237
+ WhiskeyDisk.buffer.join(' ').should.match(%r{\|\| git checkout production})
238
+ end
239
+
240
+ it 'should do branch checkouts from the repository path' do
241
+ WhiskeyDisk.checkout_main_repository
242
+ WhiskeyDisk.buffer.join(' ').should.match(%r{cd /path/to/main/repo && git checkout})
243
+ end
218
244
  end
219
245
 
220
246
  describe 'checking out the configuration repository' do
@@ -235,19 +261,29 @@ describe 'WhiskeyDisk' do
235
261
 
236
262
  it 'should work from the configuration repository checkout parent path' do
237
263
  WhiskeyDisk.checkout_configuration_repository
238
- WhiskeyDisk.buffer.join(' ').should.match(%r{cd /path/to/config})
239
- WhiskeyDisk.buffer.join(' ').should.not.match(%r{cd /path/to/config/repo})
264
+ WhiskeyDisk.buffer.join(' ').should.match(%r{cd /path/to/config[^/]})
240
265
  end
241
266
 
242
- it 'should attempt to shallow clone the configuration repository to the repository checkout path' do
267
+ it 'should attempt to clone the configuration repository to the repository checkout path' do
243
268
  WhiskeyDisk.checkout_configuration_repository
244
- WhiskeyDisk.buffer.join(' ').should.match(%r{clone --depth 1 #{@parameters['config_repository']} repo})
269
+ WhiskeyDisk.buffer.join(' ').should.match(%r{clone #{@parameters['config_repository']} repo})
245
270
  end
246
271
 
247
272
  it 'should make the configuration repository clone conditional on the lack of a main repository checkout' do
248
273
  WhiskeyDisk.checkout_configuration_repository
249
274
  WhiskeyDisk.buffer.join(' ').should.match(%r{if \[ -e #{@parameters['deploy_config_to']} \]; then .*; fi})
250
275
  end
276
+
277
+ it 'should do a branch creation checkout of the master branch when no branch is specified' do
278
+ WhiskeyDisk.checkout_configuration_repository
279
+ WhiskeyDisk.buffer.join(' ').should.match(%r{git checkout -b master origin/master})
280
+ end
281
+
282
+ it 'should do a branch creation checkout of the specified branch when a branch is specified' do
283
+ WhiskeyDisk.configuration = @parameters.merge({'config_branch' => 'production'})
284
+ WhiskeyDisk.checkout_configuration_repository
285
+ WhiskeyDisk.buffer.join(' ').should.match(%r{git checkout -b production origin/production})
286
+ end
251
287
  end
252
288
 
253
289
  describe 'updating the main repository checkout' do
data/whiskey_disk.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{whiskey_disk}
8
- s.version = "0.6.15"
8
+ s.version = "0.6.16"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Rick Bradley"]
12
- s.date = %q{2011-03-07}
12
+ s.date = %q{2011-03-08}
13
13
  s.description = %q{Opinionated gem for doing fast git-based server deployments.}
14
14
  s.email = %q{rick@rickbradley.com}
15
15
  s.executables = ["wd_role", "wd"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whiskey_disk
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 39
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 15
10
- version: 0.6.15
9
+ - 16
10
+ version: 0.6.16
11
11
  platform: ruby
12
12
  authors:
13
13
  - Rick Bradley
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-07 00:00:00 -06:00
18
+ date: 2011-03-08 00:00:00 -06:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency