whiskey_disk 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  A very opinionated deployment tool, designed to be as fast as technologically possible. (For more background, read the [WHY.txt](http://github.com/flogic/whiskey_disk/raw/master/WHY.txt) file) Should work with any project which is git hosted, not just Ruby / Ruby on Rails projects. Allows for local deploys as well as remote.
5
5
 
6
- Right-arrow through a short whiskey_disk presentation at [http://wd2010.rickbradley.com/](http://wd2010.rickbradley.com) (slide source available [here](http://github.com/rick/whiskey_disk_presentation).)
6
+ Right-arrow through a short whiskey_disk presentation at [http://wd2010.rickbradley.com/](http://wd2010.rickbradley.com) (slide source available [here](http://github.com/rick/whiskey_disk_presentation).), covering the 0.2.*-era functionality.
7
7
 
8
8
  ### Selling points ###
9
9
 
@@ -41,6 +41,13 @@ works.
41
41
  - There's no before\_after\_before_after hooks. You've got plenty of
42
42
  flexibility with just a handful of rake hook points to grab onto.
43
43
 
44
+ - You can enable "staleness checks" so that deployments only happen if
45
+ either the main repo, or the config repo (if you're using one) has
46
+ changes that are newer than what is currently deployed.
47
+
48
+ - Put whiskey\_disk in a cron, with staleness checks enabled, and you can
49
+ do hands-free automated deployments whenever code is pushed to your
50
+ deployment branch of choice!
44
51
 
45
52
  #### Dependencies ####
46
53
 
@@ -138,6 +145,29 @@ The --path argument can take either a file or a directory. When given a file it
138
145
  All this means you can manage a large number of project deployments (local or remote) and have a single scripted deployment manager that keeps them up to date. Configurations can live in a centralized location, and developers don't have to be actively involved in ensuring code gets shipped up to a server. Win.
139
146
 
140
147
 
148
+ ### A note about post\__{setup,deploy} Rake tasks
149
+
150
+ If you want actions to run on the deployment target after you do a whiskey\_disk setup or whiskey\_disk deploy,
151
+ you will need to make sure that whiskey\_disk is available on the target system (either by gem installation,
152
+ as a rails plugin in the Rails application to be deployed, or as a vendored library in the application to be
153
+ deployed). Whiskey\_disk provides the basic deploy:post\_setup and deploy:post\_deploy hooks which get called.
154
+ You can also define these tasks yourself if you want to eliminate the dependency on whiskey\_disk on the
155
+ deployment target system.
156
+
157
+ ### Staleness checks ###
158
+
159
+ Enabling staleness checking will cause whiskey\_disk to check whether the deployed checkout of the repository
160
+ is out of date ("stale") with respect to the upstream version in git. If there is a configuration repository
161
+ in use, whiskey\_disk will check the deployed checkout of the configuration repository for staleness as well.
162
+ If the checkouts are already up-to-date the deployment process will print an up-to-date message and stop rather
163
+ than proceeding with any of the deployment actions. This makes it easy to simply run whiskey\_disk out of cron
164
+ so that it will automatically perform a deployment whenever changes are pushed to the upstream git repositories.
165
+
166
+ To turn on staleness checking, simply set the 'check' environment variable:
167
+
168
+ check='yes' wd deploy --to=foobar:production
169
+
170
+
141
171
  ### Configuration Repository ###
142
172
 
143
173
  #### What's all this about a second repository for configuration stuff? ####
data/TODO.txt CHANGED
@@ -1,14 +1,4 @@
1
- - would be nice to have the ability to say if a project is out of date (meaning that, based upon this config file, either the checked out project repo or the checked out config repo is older than the upstream) so we can do some sort of automated / conditional deployments. We could implement this as a config file option (check for out of date before deploying), but questions about how to "force" if necessary. Could also be done as a flag.
2
- by default, the behavior should be *not* to check if in-sync, make it so that ENV['check'] =~ /^(?:t(?:rue)?|1|y(?:es))/i will trigger the check
3
- similarly wd --check will set the variable
4
-
5
- - the thinking is that a metadata file for multiple projects would specify values for this, with a meta-app using check=true by default
6
1
 
7
- ml=`cat .git/refs/heads/master`; mr=`git ls-remote git@ogtastic.com:whiskey_disk.git refs/heads/master`; if [[ $ml != ${mr%% *} ]]; then { echo "out-of-date"; } else { echo "up-to-date"; } fi
8
-
9
- - note that we actually want to check both the main repository and the configuration repository for changes
10
- - this is only relevant for deploy:now, obviously
11
-
12
2
  - do git-deploy style change detection: get the current branch ref, then do the fetch/reset, get the current branch ref; find the differences, make them available to the rake task(s)
13
3
  - some sort of simple API to access the detected changes
14
4
  require 'whiskey_disk/rake'
@@ -33,13 +23,10 @@
33
23
  - config: /path/to/config
34
24
  project: larry
35
25
  target: production
26
+ cache: no
36
27
 
37
- - [Q] what about per-environment rake tasks, do we just store these in the config repo? does this work?
38
-
39
- - [Q] ditto, maintenance pages(?) (i.e., a pre-deploy hook)
40
-
28
+ - [Q] what about maintenance pages(?) (i.e., do we need a pre-deploy hook?; also are these per-target config stuffs?; fun managing changes to a maintenance page ;-)
41
29
  - [Q] do we want a mechanism to manage the config repo? (add a repo, add a project, add an environment, put a file into the config repo for an environment?)
42
-
30
+ - [Q] what about per-target rake tasks, do we just store these in the config repo? does this work?
43
31
  - [Q] do we need actual support for "rollbacks"?
44
-
45
32
  - [Q] do we want to support multi-system deployments (i.e., deploy and rollback on 4 simultaneous app servers, other bullshit running on the db server, etc.)? If we get into this, we have the original :role problem that cap faced -- i.e., we only want to run the database operations on certain hosts.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.4.0
@@ -17,6 +17,7 @@ namespace :deploy do
17
17
 
18
18
  desc "Deploy now."
19
19
  task :now do
20
+ WhiskeyDisk.enable_staleness_checks
20
21
  WhiskeyDisk.update_main_repository_checkout
21
22
  WhiskeyDisk.update_configuration_repository_checkout if WhiskeyDisk.has_config_repo?
22
23
  WhiskeyDisk.refresh_configuration if WhiskeyDisk.has_config_repo?
data/lib/whiskey_disk.rb CHANGED
@@ -5,6 +5,7 @@ class WhiskeyDisk
5
5
  def reset
6
6
  @configuration = nil
7
7
  @buffer = nil
8
+ @staleness_checks = nil
8
9
  end
9
10
 
10
11
  def buffer
@@ -19,6 +20,18 @@ class WhiskeyDisk
19
20
  configuration[key.to_s]
20
21
  end
21
22
 
23
+ def check_staleness?
24
+ WhiskeyDisk::Config.check_staleness?
25
+ end
26
+
27
+ def enable_staleness_checks
28
+ @staleness_checks = true
29
+ end
30
+
31
+ def staleness_checks_enabled?
32
+ !!@staleness_checks
33
+ end
34
+
22
35
  def enqueue(command)
23
36
  buffer << command
24
37
  end
@@ -31,6 +44,10 @@ class WhiskeyDisk
31
44
  ! (self[:config_repository].nil? or self[:config_repository] == '')
32
45
  end
33
46
 
47
+ def project_name_specified?
48
+ self[:project] != 'unnamed_project'
49
+ end
50
+
34
51
  def branch
35
52
  (self[:branch] and self[:branch] != '') ? self[:branch] : 'master'
36
53
  end
@@ -60,10 +77,32 @@ class WhiskeyDisk
60
77
  raise "No value for '#{key}' declared in configuration files [#{WhiskeyDisk::Config.configuration_file}]" unless self[key]
61
78
  end
62
79
  end
80
+
81
+ def apply_staleness_check(commands)
82
+ needs(:deploy_to, :repository)
83
+
84
+ check = "cd #{self[:deploy_to]}; " +
85
+ "ml=\`cat .git/refs/heads/#{branch}\`; " +
86
+ "mr=\`git ls-remote #{self[:repository]} refs/heads/#{branch}\`; "
87
+
88
+ if self[:deploy_config_to]
89
+ check += "cd #{self[:deploy_config_to]}; " +
90
+ "cl=\`cat .git/refs/heads/#{config_branch}\`; " +
91
+ "cr=\`git ls-remote #{self[:config_repository]} refs/heads/#{config_branch}\`; "
92
+ end
93
+
94
+ check += "if [[ $ml != ${mr%%\t*} ]] " +
95
+ (self[:deploy_config_to] ? "|| [[ $cl != ${cr%%\t*} ]]" : '') +
96
+ "; then #{commands}; else echo \"No changes to deploy.\"; fi"
97
+ end
98
+
99
+ def join_commands
100
+ buffer.collect {|c| "{ #{c} ; }"}.join(' && ')
101
+ end
63
102
 
64
103
  def bundle
65
104
  return '' if buffer.empty?
66
- buffer.collect {|c| "{ #{c} ; }"}.join(' && ')
105
+ (staleness_checks_enabled? and check_staleness?) ? apply_staleness_check(join_commands) : join_commands
67
106
  end
68
107
 
69
108
  def run(cmd)
@@ -78,7 +117,7 @@ class WhiskeyDisk
78
117
  def if_file_present(path, cmd)
79
118
  "if [ -e #{path} ]; then #{cmd}; fi"
80
119
  end
81
-
120
+
82
121
  def ensure_main_parent_path_is_present
83
122
  needs(:deploy_to)
84
123
  enqueue "mkdir -p #{parent_path(self[:deploy_to])}"
@@ -117,8 +156,8 @@ class WhiskeyDisk
117
156
 
118
157
  def refresh_configuration
119
158
  needs(:deploy_to, :deploy_config_to)
120
- raise "Must specify project name when using a configuration repository." if self[:project] == 'unnamed_project'
121
- enqueue "rsync -av --progress #{self[:deploy_config_to]}/#{self[:project]}/#{self[:environment]}/ #{self[:deploy_to]}/"
159
+ raise "Must specify project name when using a configuration repository." unless project_name_specified?
160
+ enqueue("rsync -av --progress #{self[:deploy_config_to]}/#{self[:project]}/#{self[:environment]}/ #{self[:deploy_to]}/")
122
161
  end
123
162
 
124
163
  def run_post_setup_hooks
@@ -432,9 +432,14 @@ describe WhiskeyDisk::Config do
432
432
 
433
433
  describe 'computing the base path for the project' do
434
434
  before do
435
+ @original_path = Dir.pwd
435
436
  ENV['path'] = @path = nil
436
437
  end
437
438
 
439
+ after do
440
+ Dir.chdir(@original_path)
441
+ end
442
+
438
443
  describe 'and a "path" environment variable is set' do
439
444
  before do
440
445
  ENV['path'] = @path = CURRENT
@@ -140,6 +140,7 @@ describe 'rake tasks' do
140
140
  @configuration = { }
141
141
  WhiskeyDisk::Config.stub!(:fetch).and_return(@configuration)
142
142
  [
143
+ :enable_staleness_checks,
143
144
  :update_main_repository_checkout,
144
145
  :update_configuration_repository_checkout,
145
146
  :refresh_configuration,
@@ -161,6 +162,11 @@ describe 'rake tasks' do
161
162
  WhiskeyDisk.should.not.be.remote
162
163
  end
163
164
 
165
+ it 'should enable staleness checks' do
166
+ WhiskeyDisk.should.receive(:enable_staleness_checks)
167
+ @rake["deploy:now"].invoke
168
+ end
169
+
164
170
  it 'should update the main repository checkout' do
165
171
  WhiskeyDisk.should.receive(:update_main_repository_checkout)
166
172
  @rake["deploy:now"].invoke
@@ -83,6 +83,27 @@ describe 'WhiskeyDisk' do
83
83
  WhiskeyDisk.has_config_repo?.should == false
84
84
  end
85
85
  end
86
+
87
+ describe 'enabling staleness checks' do
88
+ it 'should ensure that staleness checks are activated' do
89
+ WhiskeyDisk.reset
90
+ WhiskeyDisk.enable_staleness_checks
91
+ WhiskeyDisk.staleness_checks_enabled?.should == true
92
+ end
93
+ end
94
+
95
+ describe 'when checking staleness checks' do
96
+ it 'should return false if staleness checks have not been enabled' do
97
+ WhiskeyDisk.reset
98
+ WhiskeyDisk.staleness_checks_enabled?.should == false
99
+ end
100
+
101
+ it 'should return true if staleness checks have been enabled' do
102
+ WhiskeyDisk.reset
103
+ WhiskeyDisk.enable_staleness_checks
104
+ WhiskeyDisk.staleness_checks_enabled?.should == true
105
+ end
106
+ end
86
107
 
87
108
  describe 'ensuring that the parent path for the main repository checkout is present' do
88
109
  before do
@@ -287,6 +308,8 @@ describe 'WhiskeyDisk' do
287
308
  @parameters = { 'deploy_to' => '/path/to/main/repo',
288
309
  'deploy_config_to' => '/path/to/config/repo',
289
310
  'environment' => 'production',
311
+ 'config_repository' => 'git@git://foo.bar.git',
312
+ 'config_branch' => 'master',
290
313
  'project' => 'whiskey_disk' }
291
314
  WhiskeyDisk::Config.stub!(:fetch).and_return(@parameters)
292
315
  WhiskeyDisk.reset
@@ -455,15 +478,207 @@ describe 'WhiskeyDisk' do
455
478
  before do
456
479
  WhiskeyDisk.reset
457
480
  end
458
-
459
- it 'should return an empty string if there are no commands' do
460
- WhiskeyDisk.bundle.should == ''
461
- end
462
481
 
463
- it 'should wrap each command with {} and join with &&s' do
464
- WhiskeyDisk.enqueue("cd foo/bar/baz || true")
465
- WhiskeyDisk.enqueue("rsync -avz --progress /yer/mom /yo/")
466
- WhiskeyDisk.bundle.should == "{ cd foo/bar/baz || true ; } && { rsync -avz --progress /yer/mom /yo/ ; }"
482
+ describe 'when staleness checks are disabled' do
483
+ it 'should return an empty string if there are no commands' do
484
+ WhiskeyDisk.bundle.should == ''
485
+ end
486
+
487
+ it 'should wrap each command with {} and join with &&s' do
488
+ WhiskeyDisk.enqueue("cd foo/bar/baz || true")
489
+ WhiskeyDisk.enqueue("rsync -avz --progress /yer/mom /yo/")
490
+ WhiskeyDisk.bundle.should == "{ cd foo/bar/baz || true ; } && { rsync -avz --progress /yer/mom /yo/ ; }"
491
+ end
492
+
493
+ it 'should not wrap the bundled commands inside a staleness check' do
494
+ WhiskeyDisk.enqueue("cd foo/bar/baz || true")
495
+ WhiskeyDisk.enqueue("rsync -avz --progress /yer/mom /yo/")
496
+ WhiskeyDisk.bundle.should == "{ cd foo/bar/baz || true ; } && { rsync -avz --progress /yer/mom /yo/ ; }"
497
+ end
498
+ end
499
+
500
+ describe 'when staleness checks are enabled' do
501
+ before do
502
+ WhiskeyDisk.enable_staleness_checks
503
+ end
504
+
505
+ describe 'but not we are not configured for staleness checks on this deployment' do
506
+ before do
507
+ ENV['check'] = nil
508
+ end
509
+
510
+ it 'should return an empty string if there are no commands' do
511
+ WhiskeyDisk.bundle.should == ''
512
+ end
513
+
514
+ it 'should wrap each command with {} and join with &&s' do
515
+ WhiskeyDisk.enqueue("cd foo/bar/baz || true")
516
+ WhiskeyDisk.enqueue("rsync -avz --progress /yer/mom /yo/")
517
+ WhiskeyDisk.bundle.should == "{ cd foo/bar/baz || true ; } && { rsync -avz --progress /yer/mom /yo/ ; }"
518
+ end
519
+
520
+ it 'should not wrap the bundled commands inside a staleness check' do
521
+ WhiskeyDisk.enqueue("cd foo/bar/baz || true")
522
+ WhiskeyDisk.enqueue("rsync -avz --progress /yer/mom /yo/")
523
+ WhiskeyDisk.bundle.should == "{ cd foo/bar/baz || true ; } && { rsync -avz --progress /yer/mom /yo/ ; }"
524
+ end
525
+ end
526
+
527
+ describe 'and we are configured for staleness checks on this deployment' do
528
+ before do
529
+ ENV['check'] = 'true'
530
+ end
531
+
532
+ describe 'when no configuration repository is in use' do
533
+ before do
534
+ @deploy_to = '/path/to/main/repo'
535
+ @repository = 'git@git://foo.bar.git'
536
+ @parameters = { 'deploy_to' => @deploy_to, 'repository' => @repository }
537
+ WhiskeyDisk::Config.stub!(:fetch).and_return(@parameters)
538
+ WhiskeyDisk.reset
539
+ WhiskeyDisk.enable_staleness_checks
540
+ end
541
+
542
+ it 'should return an empty string if there are no commands' do
543
+ WhiskeyDisk.bundle.should == ''
544
+ end
545
+
546
+ it 'should wrap each command with {} and join with &&s' do
547
+ WhiskeyDisk.enqueue("cd foo/bar/baz || true")
548
+ WhiskeyDisk.enqueue("rsync -avz --progress /yer/mom /yo/")
549
+ WhiskeyDisk.bundle.should.match(Regexp.new(Regexp.escape("{ cd foo/bar/baz || true ; } && { rsync -avz --progress /yer/mom /yo/ ; }")))
550
+ end
551
+
552
+ it 'should wrap the bundled commands inside a staleness check which checks only the main repo for staleness' do
553
+ WhiskeyDisk.enqueue("COMMAND")
554
+ WhiskeyDisk.bundle.should.match(Regexp.new(Regexp.escape("if [[ $ml != ${mr%%\t*} ]] ; then { COMMAND ; }")))
555
+ end
556
+
557
+ it 'should add a notice message for when the repository is not stale' do
558
+ WhiskeyDisk.enqueue("COMMAND")
559
+ WhiskeyDisk.bundle.should.match(Regexp.new(Regexp.escape("then { COMMAND ; }; else echo \"No changes to deploy.\"; fi")))
560
+ end
561
+
562
+ it "should query the head of the main checkout's master branch if no branch is specified" do
563
+ WhiskeyDisk.enqueue("COMMAND")
564
+ WhiskeyDisk.bundle.should.match(Regexp.new(Regexp.escape("cd #{@deploy_to}; ml=\`cat .git/refs/heads/master\`;")))
565
+ end
566
+
567
+ it "should query the head of the main checkout's specified branch if a branch is specified" do
568
+ WhiskeyDisk::Config.stub!(:fetch).and_return(@parameters.merge({'branch' => 'production'}))
569
+ WhiskeyDisk.reset
570
+ WhiskeyDisk.enable_staleness_checks
571
+ WhiskeyDisk.enqueue("COMMAND")
572
+ WhiskeyDisk.bundle.should.match(Regexp.new(Regexp.escape("cd #{@deploy_to}; ml=\`cat .git/refs/heads/production\`;")))
573
+ end
574
+
575
+ it "should query the head on the main repository's master branch if no branch is specified" do
576
+ WhiskeyDisk.enqueue("COMMAND")
577
+ WhiskeyDisk.bundle.should.match(Regexp.new(Regexp.escape("mr=\`git ls-remote #{@repository} refs/heads/master\`;")))
578
+ end
579
+
580
+ it "should query the head of the main repository's specified branch if a branch is specified" do
581
+ WhiskeyDisk::Config.stub!(:fetch).and_return(@parameters.merge({'branch' => 'production'}))
582
+ WhiskeyDisk.reset
583
+ WhiskeyDisk.enable_staleness_checks
584
+ WhiskeyDisk.enqueue("COMMAND")
585
+ WhiskeyDisk.bundle.should.match(Regexp.new(Regexp.escape("mr=\`git ls-remote #{@repository} refs/heads/production\`;")))
586
+ end
587
+
588
+ it 'should not check a configuration repository for staleness' do
589
+ WhiskeyDisk.enqueue("COMMAND")
590
+ WhiskeyDisk.bundle.should.not.match(/c[lr]=/)
591
+ end
592
+ end
593
+
594
+ describe 'when a configuration repository is in use' do
595
+ before do
596
+ @deploy_to = '/path/to/main/repo'
597
+ @repository = 'git@git://foo.bar.git'
598
+ @deploy_config_to = '/path/to/config/repo'
599
+ @config_repository = 'git@git://foo.bar-config.git'
600
+ @parameters = {
601
+ 'deploy_to' => @deploy_to, 'repository' => @repository,
602
+ 'deploy_config_to' => @deploy_config_to, 'config_repository' => @config_repository
603
+ }
604
+ WhiskeyDisk::Config.stub!(:fetch).and_return(@parameters)
605
+ WhiskeyDisk.reset
606
+ WhiskeyDisk.enable_staleness_checks
607
+ end
608
+
609
+ it 'should return an empty string if there are no commands' do
610
+ WhiskeyDisk.bundle.should == ''
611
+ end
612
+
613
+ it 'should wrap each command with {} and join with &&s' do
614
+ WhiskeyDisk.enqueue("cd foo/bar/baz || true")
615
+ WhiskeyDisk.enqueue("rsync -avz --progress /yer/mom /yo/")
616
+ WhiskeyDisk.bundle.should.match(Regexp.new(Regexp.escape("{ cd foo/bar/baz || true ; } && { rsync -avz --progress /yer/mom /yo/ ; }")))
617
+ end
618
+
619
+ it 'should wrap the bundled commands inside a staleness check which checks both main and config repos for staleness' do
620
+ WhiskeyDisk.enqueue("COMMAND")
621
+ WhiskeyDisk.bundle.should.match(Regexp.new(Regexp.escape("if [[ $ml != ${mr%%\t*} ]] || [[ $cl != ${cr%%\t*} ]]; then { COMMAND ; }")))
622
+ end
623
+
624
+ it 'should add a notice message for when the repositories are not stale' do
625
+ WhiskeyDisk.enqueue("COMMAND")
626
+ WhiskeyDisk.bundle.should.match(Regexp.new(Regexp.escape("then { COMMAND ; }; else echo \"No changes to deploy.\"; fi")))
627
+ end
628
+
629
+ it "should query the head of the main checkout's master branch if no branch is specified" do
630
+ WhiskeyDisk.enqueue("COMMAND")
631
+ WhiskeyDisk.bundle.should.match(Regexp.new(Regexp.escape("cd #{@deploy_to}; ml=\`cat .git/refs/heads/master\`;")))
632
+ end
633
+
634
+ it "should query the head of the main checkout's specified branch if a branch is specified" do
635
+ WhiskeyDisk::Config.stub!(:fetch).and_return(@parameters.merge({'branch' => 'production'}))
636
+ WhiskeyDisk.reset
637
+ WhiskeyDisk.enable_staleness_checks
638
+ WhiskeyDisk.enqueue("COMMAND")
639
+ WhiskeyDisk.bundle.should.match(Regexp.new(Regexp.escape("cd #{@deploy_to}; ml=\`cat .git/refs/heads/production\`;")))
640
+ end
641
+
642
+ it "should query the head on the main repository's master branch if no branch is specified" do
643
+ WhiskeyDisk.enqueue("COMMAND")
644
+ WhiskeyDisk.bundle.should.match(Regexp.new(Regexp.escape("mr=\`git ls-remote #{@repository} refs/heads/master\`;")))
645
+ end
646
+
647
+ it "should query the head of the main repository's specified branch if a branch is specified" do
648
+ WhiskeyDisk::Config.stub!(:fetch).and_return(@parameters.merge({'branch' => 'production'}))
649
+ WhiskeyDisk.reset
650
+ WhiskeyDisk.enable_staleness_checks
651
+ WhiskeyDisk.enqueue("COMMAND")
652
+ WhiskeyDisk.bundle.should.match(Regexp.new(Regexp.escape("mr=\`git ls-remote #{@repository} refs/heads/production\`;")))
653
+ end
654
+
655
+ it "should query the head of the config checkout's master branch if no branch is specified" do
656
+ WhiskeyDisk.enqueue("COMMAND")
657
+ WhiskeyDisk.bundle.should.match(Regexp.new(Regexp.escape("cd #{@deploy_config_to}; cl=\`cat .git/refs/heads/master\`;")))
658
+ end
659
+
660
+ it "should query the head of the config checkout's specified branch if a branch is specified" do
661
+ WhiskeyDisk::Config.stub!(:fetch).and_return(@parameters.merge({'config_branch' => 'production'}))
662
+ WhiskeyDisk.reset
663
+ WhiskeyDisk.enable_staleness_checks
664
+ WhiskeyDisk.enqueue("COMMAND")
665
+ WhiskeyDisk.bundle.should.match(Regexp.new(Regexp.escape("cd #{@deploy_config_to}; cl=\`cat .git/refs/heads/production\`;")))
666
+ end
667
+
668
+ it "should query the head on the config repository's master branch if no branch is specified" do
669
+ WhiskeyDisk.enqueue("COMMAND")
670
+ WhiskeyDisk.bundle.should.match(Regexp.new(Regexp.escape("cr=\`git ls-remote #{@config_repository} refs/heads/master\`;")))
671
+ end
672
+
673
+ it "should query the head of the config repository's specified branch if a branch is specified" do
674
+ WhiskeyDisk::Config.stub!(:fetch).and_return(@parameters.merge({'config_branch' => 'production'}))
675
+ WhiskeyDisk.reset
676
+ WhiskeyDisk.enable_staleness_checks
677
+ WhiskeyDisk.enqueue("COMMAND")
678
+ WhiskeyDisk.bundle.should.match(Regexp.new(Regexp.escape("cr=\`git ls-remote #{@config_repository} refs/heads/production\`;")))
679
+ end
680
+ end
681
+ end
467
682
  end
468
683
  end
469
684
 
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.3.1"
8
+ s.version = "0.4.0"
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{2010-07-08}
12
+ s.date = %q{2010-07-09}
13
13
  s.default_executable = %q{wd}
14
14
  s.description = %q{Opinionated gem for doing fast git-based server deployments.}
15
15
  s.email = %q{rick@rickbradley.com}
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: 17
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 3
9
- - 1
10
- version: 0.3.1
8
+ - 4
9
+ - 0
10
+ version: 0.4.0
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: 2010-07-08 00:00:00 -05:00
18
+ date: 2010-07-09 00:00:00 -05:00
19
19
  default_executable: wd
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency