whiskey_disk 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
data/TODO.txt CHANGED
@@ -1,3 +1,5 @@
1
+ Q - how do we track registries of deployment files (do we recommend people use larry/puppet or is something else going on?)
2
+
1
3
  - do git-deploy style change detection:
2
4
  - 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
5
  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
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.2
1
+ 0.4.3
data/lib/whiskey_disk.rb CHANGED
@@ -122,6 +122,11 @@ class WhiskeyDisk
122
122
  %Q{if [[ `rake -P | grep #{task}` != "" ]]; then #{cmd}; fi}
123
123
  end
124
124
 
125
+ def conditional_clone(repo, path)
126
+ "if [ -e #{path} ]; then echo 'Repository already cloned to [#{path}]. Skipping.'; " +
127
+ "else git clone #{repo} #{tail_path(path)} ; fi"
128
+ end
129
+
125
130
  def ensure_main_parent_path_is_present
126
131
  needs(:deploy_to)
127
132
  enqueue "mkdir -p #{parent_path(self[:deploy_to])}"
@@ -131,17 +136,17 @@ class WhiskeyDisk
131
136
  needs(:deploy_config_to)
132
137
  enqueue "mkdir -p #{parent_path(self[:deploy_config_to])}"
133
138
  end
134
-
139
+
135
140
  def checkout_main_repository
136
141
  needs(:deploy_to, :repository)
137
142
  enqueue "cd #{parent_path(self[:deploy_to])}"
138
- enqueue "git clone #{self[:repository]} #{tail_path(self[:deploy_to])} ; true"
143
+ enqueue conditional_clone(self[:repository], self[:deploy_to])
139
144
  end
140
145
 
141
146
  def checkout_configuration_repository
142
147
  needs(:deploy_config_to, :config_repository)
143
148
  enqueue "cd #{parent_path(self[:deploy_config_to])}"
144
- enqueue "git clone #{self[:config_repository]} #{tail_path(self[:deploy_config_to])} ; true"
149
+ enqueue conditional_clone(self[:config_repository], self[:deploy_config_to])
145
150
  end
146
151
 
147
152
  def update_main_repository_checkout
@@ -170,14 +170,14 @@ describe 'WhiskeyDisk' do
170
170
  WhiskeyDisk.buffer.join(' ').should.not.match(%r{cd /path/to/main/repo})
171
171
  end
172
172
 
173
- it 'should attempt to clone the main repository to the repository checkout path' do
173
+ it 'should make the main repository clone conditional on the lack of a main repository checkout' do
174
174
  WhiskeyDisk.checkout_main_repository
175
- WhiskeyDisk.buffer.join(' ').should.match(%r{clone #{@parameters['repository']} repo})
175
+ WhiskeyDisk.buffer.join(' ').should.match(%r{if \[ -e #{@parameters['deploy_to']} \]; then .*; fi})
176
176
  end
177
177
 
178
- it 'should ignore errors from failing to clone an existing repository' do
178
+ it 'should attempt to clone the main repository to the repository checkout path' do
179
179
  WhiskeyDisk.checkout_main_repository
180
- WhiskeyDisk.buffer.join(' ').should.match(%r{; true})
180
+ WhiskeyDisk.buffer.join(' ').should.match(%r{clone #{@parameters['repository']} repo})
181
181
  end
182
182
  end
183
183
 
@@ -205,16 +205,16 @@ describe 'WhiskeyDisk' do
205
205
  WhiskeyDisk.buffer.join(' ').should.match(%r{cd /path/to/config})
206
206
  WhiskeyDisk.buffer.join(' ').should.not.match(%r{cd /path/to/config/repo})
207
207
  end
208
+
209
+ it 'should make the configuration repository clone conditional on the lack of a main repository checkout' do
210
+ WhiskeyDisk.checkout_configuration_repository
211
+ WhiskeyDisk.buffer.join(' ').should.match(%r{if \[ -e #{@parameters['deploy_config_to']} \]; then .*; fi})
212
+ end
208
213
 
209
214
  it 'should attempt to clone the configuration repository to the repository checkout path' do
210
215
  WhiskeyDisk.checkout_configuration_repository
211
216
  WhiskeyDisk.buffer.join(' ').should.match(%r{clone #{@parameters['config_repository']} repo})
212
217
  end
213
-
214
- it 'should ignore errors from failing to clone an existing repository' do
215
- WhiskeyDisk.checkout_configuration_repository
216
- WhiskeyDisk.buffer.join(' ').should.match(%r{; true})
217
- end
218
218
  end
219
219
 
220
220
  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.4.2"
8
+ s.version = "0.4.3"
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-15}
12
+ s.date = %q{2010-07-23}
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: 11
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 2
10
- version: 0.4.2
9
+ - 3
10
+ version: 0.4.3
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-15 00:00:00 -05:00
18
+ date: 2010-07-23 00:00:00 -05:00
19
19
  default_executable: wd
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency