whiskey_disk 0.6.4 → 0.6.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +34 -0
- data/README.integration_specs +36 -0
- data/README.markdown +122 -5
- data/VERSION +1 -1
- data/bin/wd +5 -0
- data/lib/whiskey_disk/config.rb +35 -7
- data/lib/whiskey_disk.rb +31 -9
- data/scenarios/git_repositories/config.git/HEAD +1 -0
- data/scenarios/git_repositories/config.git/config +5 -0
- data/scenarios/git_repositories/config.git/description +1 -0
- data/scenarios/git_repositories/config.git/git-daemon-export-ok +0 -0
- data/scenarios/git_repositories/config.git/hooks/applypatch-msg.sample +15 -0
- data/scenarios/git_repositories/config.git/hooks/commit-msg.sample +24 -0
- data/scenarios/git_repositories/config.git/hooks/post-commit.sample +8 -0
- data/scenarios/git_repositories/config.git/hooks/post-receive.sample +15 -0
- data/scenarios/git_repositories/config.git/hooks/post-update.sample +8 -0
- data/scenarios/git_repositories/config.git/hooks/pre-applypatch.sample +14 -0
- data/scenarios/git_repositories/config.git/hooks/pre-commit.sample +46 -0
- data/scenarios/git_repositories/config.git/hooks/pre-rebase.sample +169 -0
- data/scenarios/git_repositories/config.git/hooks/prepare-commit-msg.sample +36 -0
- data/scenarios/git_repositories/config.git/hooks/update.sample +128 -0
- data/scenarios/git_repositories/config.git/info/exclude +6 -0
- data/scenarios/git_repositories/config.git/objects/17/6bf54cf17d1d1c24556dc059c4144a5df230e8 +0 -0
- data/scenarios/git_repositories/config.git/objects/20/e9ff3feaa8ede30f707e5f1b4356e3c02bb7ec +0 -0
- data/scenarios/git_repositories/config.git/objects/45/117b1c775f0de415478dbf08ed9d667ab17d13 +0 -0
- data/scenarios/git_repositories/config.git/objects/71/eb5df52676e8e6efba471050b46978173af110 +1 -0
- data/scenarios/git_repositories/config.git/objects/d1/0bcd51fec41f854001e4d61f99d9e282a695d3 +0 -0
- data/scenarios/git_repositories/config.git/objects/e6/b02c66ad632e6b8535c4630cb8fe07732a72fc +0 -0
- data/scenarios/git_repositories/config.git/objects/f9/49d5d8a4f12c91471e34d4e277239c35ebd10d +0 -0
- data/scenarios/git_repositories/config.git/refs/heads/master +1 -0
- data/scenarios/git_repositories/project.git/HEAD +1 -0
- data/scenarios/git_repositories/project.git/config +5 -0
- data/scenarios/git_repositories/project.git/description +1 -0
- data/scenarios/git_repositories/project.git/git-daemon-export-ok +0 -0
- data/scenarios/git_repositories/project.git/hooks/applypatch-msg.sample +15 -0
- data/scenarios/git_repositories/project.git/hooks/commit-msg.sample +24 -0
- data/scenarios/git_repositories/project.git/hooks/post-commit.sample +8 -0
- data/scenarios/git_repositories/project.git/hooks/post-receive.sample +15 -0
- data/scenarios/git_repositories/project.git/hooks/post-update.sample +8 -0
- data/scenarios/git_repositories/project.git/hooks/pre-applypatch.sample +14 -0
- data/scenarios/git_repositories/project.git/hooks/pre-commit.sample +46 -0
- data/scenarios/git_repositories/project.git/hooks/pre-rebase.sample +169 -0
- data/scenarios/git_repositories/project.git/hooks/prepare-commit-msg.sample +36 -0
- data/scenarios/git_repositories/project.git/hooks/update.sample +128 -0
- data/scenarios/git_repositories/project.git/info/exclude +6 -0
- data/scenarios/git_repositories/project.git/objects/20/1c7641c2e42b0b904e5c1f793489d8b858e4da +2 -0
- data/scenarios/git_repositories/project.git/objects/80/26076649ceccbe96a6292f2432652f08483035 +0 -0
- data/scenarios/git_repositories/project.git/objects/ef/2a88894d5421920b9dfe67a9a4d8043830e62e +0 -0
- data/scenarios/git_repositories/project.git/refs/heads/master +1 -0
- data/scenarios/invalid/deploy.yml +1 -0
- data/scenarios/local/deploy.yml +16 -0
- data/scenarios/remote/deploy.yml +5 -0
- data/spec/integration/invalid_configuration_spec.rb +39 -0
- data/spec/integration/local_deployments_spec.rb +230 -0
- data/spec/integration/remote_deployments_spec.rb +54 -0
- data/spec/spec_helper.rb +57 -0
- data/spec/wd_command_spec.rb +289 -6
- data/spec/whiskey_disk/config_spec.rb +233 -89
- data/spec/whiskey_disk/rake_spec.rb +0 -21
- data/spec/whiskey_disk_spec.rb +160 -142
- data/whiskey_disk.gemspec +55 -2
- metadata +57 -4
@@ -19,6 +19,17 @@ def write_config_file(data)
|
|
19
19
|
File.open(@config_file, 'w') { |f| f.puts YAML.dump(data) }
|
20
20
|
end
|
21
21
|
|
22
|
+
# class for testing .open calls -- for use with URL config paths
|
23
|
+
class TestURLConfig < WhiskeyDisk::Config
|
24
|
+
def self.open
|
25
|
+
raise
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def set_config_url_response(data)
|
30
|
+
TestURLConfig.stub!(:open).and_return(YAML.dump(data))
|
31
|
+
end
|
32
|
+
|
22
33
|
describe WhiskeyDisk::Config do
|
23
34
|
describe 'when computing the environment name' do
|
24
35
|
it 'should return false when there is no ENV["to"] setting' do
|
@@ -78,98 +89,202 @@ describe WhiskeyDisk::Config do
|
|
78
89
|
WhiskeyDisk::Config.check_staleness?.should == true
|
79
90
|
end
|
80
91
|
end
|
92
|
+
|
93
|
+
describe 'when determining whether there is a domain limit set' do
|
94
|
+
it 'should return false when ENV["only"] is nil' do
|
95
|
+
ENV['only'] = nil
|
96
|
+
WhiskeyDisk::Config.domain_limit.should == false
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'should return false when ENV["only"] is empty' do
|
100
|
+
ENV['only'] = ''
|
101
|
+
WhiskeyDisk::Config.domain_limit.should == false
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'should return the value in ENV["only"] when it is non-empty' do
|
105
|
+
ENV['only'] = 'somedomain'
|
106
|
+
WhiskeyDisk::Config.domain_limit.should == 'somedomain'
|
107
|
+
end
|
108
|
+
end
|
81
109
|
|
82
110
|
describe 'when fetching configuration' do
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
111
|
+
describe 'and path specified is an URL' do
|
112
|
+
before do
|
113
|
+
ENV['to'] = @env = 'foo:staging'
|
114
|
+
ENV['path'] = 'https://www.example.com/foo/bar/deploy.yml'
|
115
|
+
end
|
116
|
+
|
117
|
+
it 'should fail if the current environment cannot be determined' do
|
118
|
+
ENV['to'] = nil
|
119
|
+
lambda { TestURLConfig.fetch }.should.raise
|
120
|
+
end
|
88
121
|
|
89
|
-
|
90
|
-
|
91
|
-
|
122
|
+
it 'should fail if the configuration data cannot be retrieved' do
|
123
|
+
TestURLConfig.stub!(:open).and_raise(RuntimeError)
|
124
|
+
lambda { TestURLConfig.fetch }.should.raise
|
125
|
+
end
|
92
126
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
127
|
+
it 'should fail if the retrieved configuration data is invalid' do
|
128
|
+
TestURLConfig.stub!(:open).and_return("}")
|
129
|
+
lambda { TestURLConfig.fetch }.should.raise
|
130
|
+
end
|
97
131
|
|
98
|
-
|
99
|
-
|
100
|
-
|
132
|
+
it 'should fail if the retrieved configuration data does not define data for this environment' do
|
133
|
+
set_config_url_response('foo' => { 'production' => { 'a' => 'b'} })
|
134
|
+
lambda { TestURLConfig.fetch }.should.raise
|
135
|
+
end
|
101
136
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
137
|
+
it 'should return the retrieved configuration yaml data for this environment as a hash' do
|
138
|
+
staging = { 'foo' => 'bar', 'repository' => 'xyzzy' }
|
139
|
+
set_config_url_response('foo' => { 'production' => { 'repository' => 'b'}, 'staging' => staging })
|
140
|
+
result = TestURLConfig.fetch
|
141
|
+
staging.each_pair do |k,v|
|
142
|
+
result[k].should == v
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
it 'should not include configuration information for other environments in the returned hash' do
|
147
|
+
staging = { 'foo' => 'bar', 'baz' => 'xyzzy' }
|
148
|
+
set_config_url_response('production' => { 'repository' => 'c', 'a' => 'b'}, 'staging' => staging)
|
149
|
+
TestURLConfig.fetch['a'].should.be.nil
|
150
|
+
end
|
106
151
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
152
|
+
it 'should include the environment in the hash' do
|
153
|
+
staging = { 'foo' => 'bar', 'baz' => 'xyzzy' }
|
154
|
+
set_config_url_response('foo' => { 'production' => { 'repository' => 'b'}, 'staging' => staging })
|
155
|
+
TestURLConfig.fetch['environment'].should == 'staging'
|
156
|
+
end
|
111
157
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
158
|
+
it 'should not allow overriding the environment in the configuration file' do
|
159
|
+
staging = { 'foo' => 'bar', 'repository' => 'xyzzy', 'environment' => 'production' }
|
160
|
+
set_config_url_response('foo' => { 'production' => { 'repository' => 'b'}, 'staging' => staging })
|
161
|
+
TestURLConfig.fetch['environment'].should == 'staging'
|
162
|
+
end
|
116
163
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
164
|
+
it 'should include the project handle in the hash' do
|
165
|
+
staging = { 'foo' => 'bar', 'repository' => 'xyzzy' }
|
166
|
+
set_config_url_response('foo' => { 'production' => { 'repository' => 'b'}, 'staging' => staging })
|
167
|
+
TestURLConfig.fetch['project'].should == 'foo'
|
168
|
+
end
|
169
|
+
|
170
|
+
it 'should not allow overriding the project handle in the configuration file when a project root is specified' do
|
171
|
+
staging = { 'foo' => 'bar', 'repository' => 'xyzzy', 'project' => 'diskey_whisk' }
|
172
|
+
set_config_url_response('foo' => { 'production' => { 'repository' => 'b'}, 'staging' => staging })
|
173
|
+
TestURLConfig.fetch['project'].should == 'foo'
|
174
|
+
end
|
175
|
+
|
176
|
+
it 'should allow overriding the project handle in the configuration file when a project root is not specified' do
|
177
|
+
ENV['to'] = @env = 'staging'
|
178
|
+
staging = { 'foo' => 'bar', 'repository' => 'xyzzy', 'project' => 'diskey_whisk' }
|
179
|
+
set_config_url_response('production' => { 'repository' => 'b'}, 'staging' => staging)
|
180
|
+
TestURLConfig.fetch['project'].should == 'diskey_whisk'
|
123
181
|
end
|
124
|
-
end
|
125
182
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
183
|
+
it 'should include the environment name as the config_target setting when no config_target is specified' do
|
184
|
+
staging = { 'foo' => 'bar', 'repository' => 'xyzzy', 'project' => 'diskey_whisk' }
|
185
|
+
set_config_url_response('production' => { 'repository' => 'b'}, 'staging' => staging)
|
186
|
+
TestURLConfig.fetch['config_target'].should == 'staging'
|
187
|
+
end
|
188
|
+
|
189
|
+
it 'should include the config_target setting when a config_target is specified' do
|
190
|
+
staging = { 'foo' => 'bar', 'repository' => 'xyzzy', 'project' => 'diskey_whisk', 'config_target' => 'testing' }
|
191
|
+
set_config_url_response('production' => { 'repository' => 'b'}, 'staging' => staging)
|
192
|
+
TestURLConfig.fetch['config_target'].should == 'testing'
|
193
|
+
end
|
130
194
|
end
|
195
|
+
|
196
|
+
describe 'and path specified is not an URL' do
|
197
|
+
before do
|
198
|
+
ENV['to'] = @env = 'foo:staging'
|
199
|
+
@path = build_temp_dir
|
200
|
+
ENV['path'] = @config_file = File.join(@path, 'deploy.yml')
|
201
|
+
end
|
131
202
|
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
WhiskeyDisk::Config.fetch['environment'].should == 'staging'
|
136
|
-
end
|
203
|
+
after do
|
204
|
+
FileUtils.rm_rf(@path)
|
205
|
+
end
|
137
206
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
end
|
207
|
+
it 'should fail if the current environment cannot be determined' do
|
208
|
+
ENV['to'] = nil
|
209
|
+
lambda { WhiskeyDisk::Config.fetch }.should.raise
|
210
|
+
end
|
143
211
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
WhiskeyDisk::Config.fetch['project'].should == 'foo'
|
148
|
-
end
|
212
|
+
it 'should fail if the configuration file does not exist' do
|
213
|
+
lambda { WhiskeyDisk::Config.fetch }.should.raise
|
214
|
+
end
|
149
215
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
end
|
216
|
+
it 'should fail if the configuration file cannot be read' do
|
217
|
+
Dir.mkdir(File.join(@path, 'tmp'))
|
218
|
+
lambda { WhiskeyDisk::Config.fetch }.should.raise
|
219
|
+
end
|
155
220
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
221
|
+
it 'should fail if the configuration file is invalid' do
|
222
|
+
File.open(@config_file, 'w') {|f| f.puts "}" }
|
223
|
+
lambda { WhiskeyDisk::Config.fetch }.should.raise
|
224
|
+
end
|
225
|
+
|
226
|
+
it 'should fail if the configuration file does not define data for this environment' do
|
227
|
+
write_config_file('foo' => { 'production' => { 'a' => 'b'} })
|
228
|
+
lambda { WhiskeyDisk::Config.fetch }.should.raise
|
229
|
+
end
|
230
|
+
|
231
|
+
it 'should return the configuration yaml file data for this environment as a hash' do
|
232
|
+
staging = { 'foo' => 'bar', 'repository' => 'xyzzy' }
|
233
|
+
write_config_file('foo' => { 'production' => { 'repository' => 'b'}, 'staging' => staging })
|
234
|
+
result = WhiskeyDisk::Config.fetch
|
235
|
+
staging.each_pair do |k,v|
|
236
|
+
result[k].should == v
|
237
|
+
end
|
238
|
+
end
|
162
239
|
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
240
|
+
it 'should not include configuration information for other environments in the returned hash' do
|
241
|
+
staging = { 'foo' => 'bar', 'baz' => 'xyzzy' }
|
242
|
+
write_config_file('production' => { 'repository' => 'c', 'a' => 'b'}, 'staging' => staging)
|
243
|
+
WhiskeyDisk::Config.fetch['a'].should.be.nil
|
244
|
+
end
|
245
|
+
|
246
|
+
it 'should include the environment in the hash' do
|
247
|
+
staging = { 'foo' => 'bar', 'baz' => 'xyzzy' }
|
248
|
+
write_config_file('foo' => { 'production' => { 'repository' => 'b'}, 'staging' => staging })
|
249
|
+
WhiskeyDisk::Config.fetch['environment'].should == 'staging'
|
250
|
+
end
|
251
|
+
|
252
|
+
it 'should not allow overriding the environment in the configuration file' do
|
253
|
+
staging = { 'foo' => 'bar', 'repository' => 'xyzzy', 'environment' => 'production' }
|
254
|
+
write_config_file('foo' => { 'production' => { 'repository' => 'b'}, 'staging' => staging })
|
255
|
+
WhiskeyDisk::Config.fetch['environment'].should == 'staging'
|
256
|
+
end
|
257
|
+
|
258
|
+
it 'should include the project handle in the hash' do
|
259
|
+
staging = { 'foo' => 'bar', 'repository' => 'xyzzy' }
|
260
|
+
write_config_file('foo' => { 'production' => { 'repository' => 'b'}, 'staging' => staging })
|
261
|
+
WhiskeyDisk::Config.fetch['project'].should == 'foo'
|
262
|
+
end
|
263
|
+
|
264
|
+
it 'should not allow overriding the project handle in the configuration file when a project root is specified' do
|
265
|
+
staging = { 'foo' => 'bar', 'repository' => 'xyzzy', 'project' => 'diskey_whisk' }
|
266
|
+
write_config_file('foo' => { 'production' => { 'repository' => 'b'}, 'staging' => staging })
|
267
|
+
WhiskeyDisk::Config.fetch['project'].should == 'foo'
|
268
|
+
end
|
269
|
+
|
270
|
+
it 'should allow overriding the project handle in the configuration file when a project root is not specified' do
|
271
|
+
ENV['to'] = @env = 'staging'
|
272
|
+
staging = { 'foo' => 'bar', 'repository' => 'xyzzy', 'project' => 'diskey_whisk' }
|
273
|
+
write_config_file('production' => { 'repository' => 'b'}, 'staging' => staging)
|
274
|
+
WhiskeyDisk::Config.fetch['project'].should == 'diskey_whisk'
|
275
|
+
end
|
168
276
|
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
277
|
+
it 'should include the environment name as the config_target setting when no config_target is specified' do
|
278
|
+
staging = { 'foo' => 'bar', 'repository' => 'xyzzy', 'project' => 'diskey_whisk' }
|
279
|
+
write_config_file('production' => { 'repository' => 'b'}, 'staging' => staging)
|
280
|
+
WhiskeyDisk::Config.fetch['config_target'].should == 'staging'
|
281
|
+
end
|
282
|
+
|
283
|
+
it 'should include the config_target setting when a config_target is specified' do
|
284
|
+
staging = { 'foo' => 'bar', 'repository' => 'xyzzy', 'project' => 'diskey_whisk', 'config_target' => 'testing' }
|
285
|
+
write_config_file('production' => { 'repository' => 'b'}, 'staging' => staging)
|
286
|
+
WhiskeyDisk::Config.fetch['config_target'].should == 'testing'
|
287
|
+
end
|
173
288
|
end
|
174
289
|
end
|
175
290
|
|
@@ -215,7 +330,7 @@ describe WhiskeyDisk::Config do
|
|
215
330
|
|
216
331
|
it 'should return a normalized version of the un-YAMLized configuration data' do
|
217
332
|
write_config_file('repository' => 'x')
|
218
|
-
WhiskeyDisk::Config.load_data.should == { 'foo' => { 'bar' => { 'repository' => 'x' } } }
|
333
|
+
WhiskeyDisk::Config.load_data.should == { 'foo' => { 'bar' => { 'repository' => 'x', 'domain' => [{ :name => 'local' } ] } } }
|
219
334
|
end
|
220
335
|
|
221
336
|
describe 'normalizing domains' do
|
@@ -226,7 +341,8 @@ describe WhiskeyDisk::Config do
|
|
226
341
|
'eee' => { 'repository' => 'x', 'domain' => '' },
|
227
342
|
'abc' => { 'repository' => 'x', 'domain' => 'what@example.com' },
|
228
343
|
'baz' => { 'repository' => 'x', 'domain' => [ 'bar@example.com', 'baz@domain.com' ]},
|
229
|
-
'bar' => { 'repository' => 'x', 'domain' => [ 'user@example.com', nil, 'foo@domain.com'
|
344
|
+
'bar' => { 'repository' => 'x', 'domain' => [ 'user@example.com', nil, 'foo@domain.com' ]},
|
345
|
+
'bat' => { 'repository' => 'x', 'domain' => [ 'user@example.com', 'foo@domain.com', '' ]},
|
230
346
|
'hsh' => { 'repository' => 'x', 'domain' => [ { 'name' => 'bar@example.com' }, { 'name' => 'baz@domain.com' } ]},
|
231
347
|
'mix' => { 'repository' => 'x', 'domain' => [ { 'name' => 'bar@example.com' }, 'baz@domain.com' ]},
|
232
348
|
'erl' => { 'repository' => 'x', 'domain' => [ { 'name' => 'bar@example.com', 'roles' => nil },
|
@@ -237,7 +353,7 @@ describe WhiskeyDisk::Config do
|
|
237
353
|
{ 'name' => 'aok@domain.com', 'roles' => 'app' } ]},
|
238
354
|
'wow' => { 'repository' => 'x', 'domain' => [ { 'name' => 'bar@example.com', 'roles' => [ 'web', 'db' ] },
|
239
355
|
{ 'name' => 'baz@domain.com', 'roles' => [ 'db' ] },
|
240
|
-
|
356
|
+
'', 'foo@bar.example.com',
|
241
357
|
{ 'name' => 'aok@domain.com', 'roles' => 'app' } ]},
|
242
358
|
},
|
243
359
|
|
@@ -246,7 +362,8 @@ describe WhiskeyDisk::Config do
|
|
246
362
|
'eee' => { 'repository' => 'x', 'domain' => '' },
|
247
363
|
'abc' => { 'repository' => 'x', 'domain' => 'what@example.com' },
|
248
364
|
'hij' => { 'repository' => 'x', 'domain' => [ 'bar@example.com', 'baz@domain.com' ]},
|
249
|
-
'def' => { 'repository' => 'x', 'domain' => [ 'user@example.com', nil, 'foo@domain.com'
|
365
|
+
'def' => { 'repository' => 'x', 'domain' => [ 'user@example.com', nil, 'foo@domain.com' ]},
|
366
|
+
'dex' => { 'repository' => 'x', 'domain' => [ 'user@example.com', 'foo@domain.com', '' ]},
|
250
367
|
'hsh' => { 'repository' => 'x', 'domain' => [ { 'name' => 'bar@example.com' }, { 'name' => 'baz@domain.com' } ]},
|
251
368
|
'mix' => { 'repository' => 'x', 'domain' => [ { 'name' => 'bar@example.com' }, 'baz@domain.com' ]},
|
252
369
|
'erl' => { 'repository' => 'x', 'domain' => [ { 'name' => 'bar@example.com', 'roles' => nil },
|
@@ -257,26 +374,26 @@ describe WhiskeyDisk::Config do
|
|
257
374
|
{ 'name' => 'aok@domain.com', 'roles' => 'app' } ]},
|
258
375
|
'wow' => { 'repository' => 'x', 'domain' => [ { 'name' => 'bar@example.com', 'roles' => [ 'web', 'db' ] },
|
259
376
|
{ 'name' => 'baz@domain.com', 'roles' => [ 'db' ] },
|
260
|
-
|
377
|
+
'', 'foo@bar.example.com',
|
261
378
|
{ 'name' => 'aok@domain.com', 'roles' => 'app' } ]},
|
262
379
|
}
|
263
380
|
)
|
264
381
|
end
|
265
382
|
|
266
|
-
it 'should
|
267
|
-
WhiskeyDisk::Config.load_data['foo']['xyz']['domain'].should
|
383
|
+
it 'should set the domain to "local" when no domain is specified' do
|
384
|
+
WhiskeyDisk::Config.load_data['foo']['xyz']['domain'].should == [ { :name => 'local' } ]
|
268
385
|
end
|
269
386
|
|
270
387
|
it 'should handle nil domains across all projects and targets' do
|
271
|
-
WhiskeyDisk::Config.load_data['zyx']['xyz']['domain'].should
|
388
|
+
WhiskeyDisk::Config.load_data['zyx']['xyz']['domain'].should == [ { :name => 'local' } ]
|
272
389
|
end
|
273
390
|
|
274
|
-
it 'should return domain as
|
275
|
-
WhiskeyDisk::Config.load_data['foo']['eee']['domain'].should
|
391
|
+
it 'should return domain as "local" if a single empty domain was specified' do
|
392
|
+
WhiskeyDisk::Config.load_data['foo']['eee']['domain'].should == [ { :name => 'local' } ]
|
276
393
|
end
|
277
394
|
|
278
395
|
it 'should handle single empty specified domains across all projects and targets' do
|
279
|
-
WhiskeyDisk::Config.load_data['zyx']['eee']['domain'].should
|
396
|
+
WhiskeyDisk::Config.load_data['zyx']['eee']['domain'].should == [ { :name => 'local' } ]
|
280
397
|
end
|
281
398
|
|
282
399
|
it 'should return domain as a single element list with a name if a single non-empty domain was specified' do
|
@@ -295,19 +412,31 @@ describe WhiskeyDisk::Config do
|
|
295
412
|
|
296
413
|
it 'should handle lists of domains across all projects and targets' do
|
297
414
|
WhiskeyDisk::Config.load_data['zyx']['hij']['domain'].should == [
|
298
|
-
{ :name => 'bar@example.com' }, { :name => 'baz@domain.com' }
|
415
|
+
{ :name => 'bar@example.com' }, { :name => 'baz@domain.com' }
|
299
416
|
]
|
300
417
|
end
|
301
418
|
|
302
|
-
it 'should
|
419
|
+
it 'should replace any nil domains with "local" domains in a domain list' do
|
303
420
|
WhiskeyDisk::Config.load_data['foo']['bar']['domain'].should == [
|
304
|
-
{ :name => 'user@example.com' }, { :name => 'foo@domain.com' }
|
421
|
+
{ :name => 'user@example.com' }, { :name => 'local' }, { :name => 'foo@domain.com' }
|
305
422
|
]
|
306
423
|
end
|
307
424
|
|
308
|
-
it 'should handle
|
425
|
+
it 'should handle localizing nils across all projects and targets' do
|
309
426
|
WhiskeyDisk::Config.load_data['zyx']['def']['domain'].should == [
|
310
|
-
{ :name => 'user@example.com' }, { :name => 'foo@domain.com' }
|
427
|
+
{ :name => 'user@example.com' }, { :name => 'local' }, { :name => 'foo@domain.com' }
|
428
|
+
]
|
429
|
+
end
|
430
|
+
|
431
|
+
it 'should replace any blank domains with "local" domains in a domain list' do
|
432
|
+
WhiskeyDisk::Config.load_data['foo']['bat']['domain'].should == [
|
433
|
+
{ :name => 'user@example.com' }, { :name => 'foo@domain.com' }, { :name => 'local' }
|
434
|
+
]
|
435
|
+
end
|
436
|
+
|
437
|
+
it 'should handle localizing blanks across all projects and targets' do
|
438
|
+
WhiskeyDisk::Config.load_data['zyx']['dex']['domain'].should == [
|
439
|
+
{ :name => 'user@example.com' }, { :name => 'foo@domain.com' }, { :name => 'local' }
|
311
440
|
]
|
312
441
|
end
|
313
442
|
|
@@ -343,6 +472,7 @@ describe WhiskeyDisk::Config do
|
|
343
472
|
WhiskeyDisk::Config.load_data['foo']['wow']['domain'].should == [
|
344
473
|
{ :name => 'bar@example.com', :roles => [ 'web', 'db' ] },
|
345
474
|
{ :name => 'baz@domain.com', :roles => [ 'db' ] },
|
475
|
+
{ :name => 'local' },
|
346
476
|
{ :name => 'foo@bar.example.com' },
|
347
477
|
{ :name => 'aok@domain.com', :roles => [ 'app' ] }
|
348
478
|
]
|
@@ -352,10 +482,24 @@ describe WhiskeyDisk::Config do
|
|
352
482
|
WhiskeyDisk::Config.load_data['zyx']['wow']['domain'].should == [
|
353
483
|
{ :name => 'bar@example.com', :roles => [ 'web', 'db' ] },
|
354
484
|
{ :name => 'baz@domain.com', :roles => [ 'db' ] },
|
485
|
+
{ :name => 'local' },
|
355
486
|
{ :name => 'foo@bar.example.com' },
|
356
487
|
{ :name => 'aok@domain.com', :roles => [ 'app' ] }
|
357
488
|
]
|
358
489
|
end
|
490
|
+
|
491
|
+
it 'should raise an exception if a domain appears more than once in a target' do
|
492
|
+
write_config_file(
|
493
|
+
'foo' => {
|
494
|
+
'erl' => { 'repository' => 'x', 'domain' => [ { 'name' => 'bar@example.com', 'roles' => nil },
|
495
|
+
{ 'name' => 'baz@domain.com', 'roles' => '' },
|
496
|
+
{ 'name' => 'bar@example.com', 'roles' => [] } ]},
|
497
|
+
}
|
498
|
+
)
|
499
|
+
|
500
|
+
lambda { WhiskeyDisk::Config.load_data }.should.raise
|
501
|
+
|
502
|
+
end
|
359
503
|
end
|
360
504
|
end
|
361
505
|
|
@@ -34,17 +34,6 @@ describe 'rake tasks' do
|
|
34
34
|
WhiskeyDisk.stub!(:success?).and_return(true)
|
35
35
|
end
|
36
36
|
|
37
|
-
it 'should make changes on the specified domain when a domain is specified' do
|
38
|
-
WhiskeyDisk.configuration = { 'domain' => [ 'some domain' ] }
|
39
|
-
@rake["deploy:setup"].invoke
|
40
|
-
WhiskeyDisk.should.be.remote
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'should make changes on the local system when no domain is specified' do
|
44
|
-
WhiskeyDisk.configuration = { 'domain' => nil }
|
45
|
-
WhiskeyDisk.should.not.be.remote
|
46
|
-
end
|
47
|
-
|
48
37
|
it 'should ensure that the parent path for the main repository checkout is present' do
|
49
38
|
WhiskeyDisk.should.receive(:ensure_main_parent_path_is_present)
|
50
39
|
@rake["deploy:setup"].invoke
|
@@ -163,16 +152,6 @@ describe 'rake tasks' do
|
|
163
152
|
WhiskeyDisk.stub!(:success?).and_return(true)
|
164
153
|
end
|
165
154
|
|
166
|
-
it 'should make changes on the specified domain when a domain is specified' do
|
167
|
-
WhiskeyDisk.configuration = { 'domain' => [ 'some domain' ]}
|
168
|
-
@rake["deploy:now"].invoke
|
169
|
-
WhiskeyDisk.should.be.remote
|
170
|
-
end
|
171
|
-
|
172
|
-
it 'should make changes on the local system when no domain is specified' do
|
173
|
-
WhiskeyDisk.should.not.be.remote
|
174
|
-
end
|
175
|
-
|
176
155
|
it 'should enable staleness checks' do
|
177
156
|
WhiskeyDisk.should.receive(:enable_staleness_checks)
|
178
157
|
@rake["deploy:now"].invoke
|