whiskey_disk 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -55,11 +55,11 @@ rake, ssh, git, rsync on the deployment target server (affectionately referred t
55
55
 
56
56
  #### Assumptions ####
57
57
 
58
- - you have a Rakefile in the top directory of your project's checkout
59
- - you are deploying over ssh
60
58
  - your project is managed via git
61
- - you are comfortable defining post-setup and post-deployment actions with rake
59
+ - you are deploying over ssh, or deploying locally and have a bash-compatible shell
60
+ - you are comfortable defining (optional) post-setup and post-deployment actions with rake
62
61
  - you have an optional second git repository for per-application/per-target configuration files
62
+ - you have an optional Rakefile in the top directory of your project's checkout
63
63
 
64
64
  ### Installation ###
65
65
 
@@ -290,17 +290,11 @@ overlaid on top of the most recent checkout of the project. Snap.
290
290
  a gist showing a bit more interesting deploy.rake file for post_setup and
291
291
  post_deploy work: [https://gist.github.com/47e23f2980943531beeb](https://gist.github.com/47e23f2980943531beeb)
292
292
 
293
- On the radar for an upcoming release are:
294
293
 
295
- - common post_* recipes being specifiable by symbol names in deploy.yml ?
296
- - bringing in a very simplified version of mislav/git-deploy post-{receive,reset} hooks, and a little sugar so you can say:
297
-
298
- task :post_deploy do
299
- if has_changes?('db/migrate') or has_changes?('config/database.yml')
300
- Rake::Task['db:migrate'].invoke
301
- end
302
- end
294
+ ### Future Directions ###
303
295
 
296
+ Check out the [TODO.txt](http://github.com/flogic/whiskey_disk/raw/master/TODO.txt) file
297
+ to see what we have in mind for the near future.
304
298
 
305
299
  ### Resources ###
306
300
 
data/TODO.txt CHANGED
@@ -1,6 +1,8 @@
1
-
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)
3
- - some sort of simple API to access the detected changes
1
+ - do git-deploy style change detection:
2
+ - 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)
3
+ we can use the ml/cl part of staleness checking to get the "before" versions of the main and config repos (i.e., leave that part in always, just not the conditional stuff), and have the main run a script which dumps the relative paths of changed files as a .whiskey_disk-paths-changed in the main checkout
4
+
5
+ - some sort of simple API to access the detected changes:
4
6
  require 'whiskey_disk/rake'
5
7
 
6
8
  namespace :deploy do
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.4.1
data/lib/whiskey_disk.rb CHANGED
@@ -118,6 +118,10 @@ class WhiskeyDisk
118
118
  "if [ -e #{path} ]; then #{cmd}; fi"
119
119
  end
120
120
 
121
+ def if_task_defined(task, cmd)
122
+ %Q{if [[ `rake --silent -T #{task}` != "" ]]; then #{cmd}; fi}
123
+ end
124
+
121
125
  def ensure_main_parent_path_is_present
122
126
  needs(:deploy_to)
123
127
  enqueue "mkdir -p #{parent_path(self[:deploy_to])}"
@@ -164,14 +168,16 @@ class WhiskeyDisk
164
168
  needs(:deploy_to)
165
169
  enqueue "cd #{self[:deploy_to]}"
166
170
  enqueue(if_file_present("#{self[:deploy_to]}/Rakefile",
167
- "#{env_vars} rake --trace deploy:post_setup to=#{self[:environment]}"))
171
+ if_task_defined("deploy:post_setup",
172
+ "#{env_vars} rake --trace deploy:post_setup to=#{self[:environment]}")))
168
173
  end
169
174
 
170
175
  def run_post_deploy_hooks
171
176
  needs(:deploy_to)
172
177
  enqueue "cd #{self[:deploy_to]}"
173
178
  enqueue(if_file_present("#{self[:deploy_to]}/Rakefile",
174
- "#{env_vars} rake --trace deploy:post_deploy to=#{self[:environment]}"))
179
+ if_task_defined("deploy:post_deploy",
180
+ "#{env_vars} rake --trace deploy:post_deploy to=#{self[:environment]}")))
175
181
  end
176
182
  end
177
183
  end
@@ -362,6 +362,11 @@ describe 'WhiskeyDisk' do
362
362
  WhiskeyDisk.buffer.join(' ').should.match(%r{if \[ -e /path/to/main/repo/Rakefile \]; then .*; fi})
363
363
  end
364
364
 
365
+ it 'should make the post deployment rake tasks conditional on the deploy:post_deploy rake task being defined' do
366
+ WhiskeyDisk.run_post_setup_hooks
367
+ WhiskeyDisk.buffer.join(' ').should.match(%r{if \[\[ \`rake --silent -T deploy:post_setup\` != "" \]\]; })
368
+ end
369
+
365
370
  it 'should attempt to run the post setup rake tasks' do
366
371
  WhiskeyDisk.run_post_setup_hooks
367
372
  WhiskeyDisk.buffer.join(' ').should.match(%r{rake.*deploy:post_setup})
@@ -406,6 +411,11 @@ describe 'WhiskeyDisk' do
406
411
  WhiskeyDisk.buffer.join(' ').should.match(%r{if \[ -e /path/to/main/repo/Rakefile \]; then .*; fi})
407
412
  end
408
413
 
414
+ it 'should make the post deployment rake tasks conditional on the deploy:post_deploy rake task being defined' do
415
+ WhiskeyDisk.run_post_deploy_hooks
416
+ WhiskeyDisk.buffer.join(' ').should.match(%r{if \[\[ \`rake --silent -T deploy:post_deploy\` != "" \]\]; })
417
+ end
418
+
409
419
  it 'should attempt to run the post deployment rake tasks' do
410
420
  WhiskeyDisk.run_post_deploy_hooks
411
421
  WhiskeyDisk.buffer.join(' ').should.match(%r{rake.*deploy:post_deploy})
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.4.0"
8
+ s.version = "0.4.1"
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-09}
12
+ s.date = %q{2010-07-13}
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: 15
4
+ hash: 13
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 0
10
- version: 0.4.0
9
+ - 1
10
+ version: 0.4.1
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-09 00:00:00 -05:00
18
+ date: 2010-07-13 00:00:00 -05:00
19
19
  default_executable: wd
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency