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.
Files changed (62) hide show
  1. data/CHANGELOG +34 -0
  2. data/README.integration_specs +36 -0
  3. data/README.markdown +122 -5
  4. data/VERSION +1 -1
  5. data/bin/wd +5 -0
  6. data/lib/whiskey_disk/config.rb +35 -7
  7. data/lib/whiskey_disk.rb +31 -9
  8. data/scenarios/git_repositories/config.git/HEAD +1 -0
  9. data/scenarios/git_repositories/config.git/config +5 -0
  10. data/scenarios/git_repositories/config.git/description +1 -0
  11. data/scenarios/git_repositories/config.git/git-daemon-export-ok +0 -0
  12. data/scenarios/git_repositories/config.git/hooks/applypatch-msg.sample +15 -0
  13. data/scenarios/git_repositories/config.git/hooks/commit-msg.sample +24 -0
  14. data/scenarios/git_repositories/config.git/hooks/post-commit.sample +8 -0
  15. data/scenarios/git_repositories/config.git/hooks/post-receive.sample +15 -0
  16. data/scenarios/git_repositories/config.git/hooks/post-update.sample +8 -0
  17. data/scenarios/git_repositories/config.git/hooks/pre-applypatch.sample +14 -0
  18. data/scenarios/git_repositories/config.git/hooks/pre-commit.sample +46 -0
  19. data/scenarios/git_repositories/config.git/hooks/pre-rebase.sample +169 -0
  20. data/scenarios/git_repositories/config.git/hooks/prepare-commit-msg.sample +36 -0
  21. data/scenarios/git_repositories/config.git/hooks/update.sample +128 -0
  22. data/scenarios/git_repositories/config.git/info/exclude +6 -0
  23. data/scenarios/git_repositories/config.git/objects/17/6bf54cf17d1d1c24556dc059c4144a5df230e8 +0 -0
  24. data/scenarios/git_repositories/config.git/objects/20/e9ff3feaa8ede30f707e5f1b4356e3c02bb7ec +0 -0
  25. data/scenarios/git_repositories/config.git/objects/45/117b1c775f0de415478dbf08ed9d667ab17d13 +0 -0
  26. data/scenarios/git_repositories/config.git/objects/71/eb5df52676e8e6efba471050b46978173af110 +1 -0
  27. data/scenarios/git_repositories/config.git/objects/d1/0bcd51fec41f854001e4d61f99d9e282a695d3 +0 -0
  28. data/scenarios/git_repositories/config.git/objects/e6/b02c66ad632e6b8535c4630cb8fe07732a72fc +0 -0
  29. data/scenarios/git_repositories/config.git/objects/f9/49d5d8a4f12c91471e34d4e277239c35ebd10d +0 -0
  30. data/scenarios/git_repositories/config.git/refs/heads/master +1 -0
  31. data/scenarios/git_repositories/project.git/HEAD +1 -0
  32. data/scenarios/git_repositories/project.git/config +5 -0
  33. data/scenarios/git_repositories/project.git/description +1 -0
  34. data/scenarios/git_repositories/project.git/git-daemon-export-ok +0 -0
  35. data/scenarios/git_repositories/project.git/hooks/applypatch-msg.sample +15 -0
  36. data/scenarios/git_repositories/project.git/hooks/commit-msg.sample +24 -0
  37. data/scenarios/git_repositories/project.git/hooks/post-commit.sample +8 -0
  38. data/scenarios/git_repositories/project.git/hooks/post-receive.sample +15 -0
  39. data/scenarios/git_repositories/project.git/hooks/post-update.sample +8 -0
  40. data/scenarios/git_repositories/project.git/hooks/pre-applypatch.sample +14 -0
  41. data/scenarios/git_repositories/project.git/hooks/pre-commit.sample +46 -0
  42. data/scenarios/git_repositories/project.git/hooks/pre-rebase.sample +169 -0
  43. data/scenarios/git_repositories/project.git/hooks/prepare-commit-msg.sample +36 -0
  44. data/scenarios/git_repositories/project.git/hooks/update.sample +128 -0
  45. data/scenarios/git_repositories/project.git/info/exclude +6 -0
  46. data/scenarios/git_repositories/project.git/objects/20/1c7641c2e42b0b904e5c1f793489d8b858e4da +2 -0
  47. data/scenarios/git_repositories/project.git/objects/80/26076649ceccbe96a6292f2432652f08483035 +0 -0
  48. data/scenarios/git_repositories/project.git/objects/ef/2a88894d5421920b9dfe67a9a4d8043830e62e +0 -0
  49. data/scenarios/git_repositories/project.git/refs/heads/master +1 -0
  50. data/scenarios/invalid/deploy.yml +1 -0
  51. data/scenarios/local/deploy.yml +16 -0
  52. data/scenarios/remote/deploy.yml +5 -0
  53. data/spec/integration/invalid_configuration_spec.rb +39 -0
  54. data/spec/integration/local_deployments_spec.rb +230 -0
  55. data/spec/integration/remote_deployments_spec.rb +54 -0
  56. data/spec/spec_helper.rb +57 -0
  57. data/spec/wd_command_spec.rb +289 -6
  58. data/spec/whiskey_disk/config_spec.rb +233 -89
  59. data/spec/whiskey_disk/rake_spec.rb +0 -21
  60. data/spec/whiskey_disk_spec.rb +160 -142
  61. data/whiskey_disk.gemspec +55 -2
  62. metadata +57 -4
@@ -0,0 +1,6 @@
1
+ # git-ls-files --others --exclude-from=.git/info/exclude
2
+ # Lines that start with '#' are comments.
3
+ # For a project mostly in C, the following would be a good set of
4
+ # exclude patterns (uncomment them if you want to use them):
5
+ # *.[oa]
6
+ # *~
@@ -0,0 +1,2 @@
1
+ x��� 1D�Nۀ��%qD�� ��a�r�?���u���<x3���;hr��D@��mr�h68sZğ��D�7�»?k�G�/���V����v�ż�S��
2
+ ڰ7nb�pDBT���.�*o��¾���<t
@@ -0,0 +1 @@
1
+ 201c7641c2e42b0b904e5c1f793489d8b858e4da
@@ -0,0 +1 @@
1
+ }
@@ -0,0 +1,16 @@
1
+ project:
2
+ "local-default":
3
+ deploy_to: "/tmp/wd-integration-target/destination/project"
4
+ repository: "git://wd-git.example.com/project.git"
5
+ "local-keyword":
6
+ domain: "local"
7
+ deploy_to: "/tmp/wd-integration-target/destination/project"
8
+ repository: "git://wd-git.example.com/project.git"
9
+ "local-user-domain":
10
+ domain: "user@wd-app1.example.com"
11
+ deploy_to: "/tmp/wd-integration-target/destination/project"
12
+ repository: "git://wd-git.example.com/project.git"
13
+ "local-domain":
14
+ domain: "wd-app1.example.com"
15
+ deploy_to: "/tmp/wd-integration-target/destination/project"
16
+ repository: "git://wd-git.example.com/project.git"
@@ -0,0 +1,5 @@
1
+ project:
2
+ "remote":
3
+ domain: "user@wd-app1.example.com"
4
+ deploy_to: "/tmp/wd-integration-target/destination/project"
5
+ repository: "git://wd-git.example.com/project.git"
@@ -0,0 +1,39 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper.rb'))
2
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'lib', 'whiskey_disk'))
3
+
4
+ integration_spec do
5
+ describe 'when an invalid configuration file is specified' do
6
+ before do
7
+ setup_deployment_area
8
+ @config = scenario_config('invalid/deploy.yml')
9
+ @args = "--path=#{@config} --to=project:invalid"
10
+ end
11
+
12
+ describe 'performing a setup' do
13
+ it 'should exit with a false status' do
14
+ run_setup(@args).should == false
15
+ end
16
+
17
+ it 'should not create a repo checkout' do
18
+ run_setup(@args)
19
+ File.exists?(deployed_file('project')).should == false
20
+ end
21
+ end
22
+
23
+ describe 'performing a deployment' do
24
+ before do
25
+ checkout_repo('project')
26
+ File.unlink(deployed_file('project/README')) # modify the deployed checkout
27
+ end
28
+
29
+ it 'should exit with a false status' do
30
+ run_deploy(@args).should == false
31
+ end
32
+
33
+ it 'should not update a repo checkout' do
34
+ run_deploy(@args)
35
+ File.exists?(deployed_file('project/README')).should == false
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,230 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper.rb'))
2
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'lib', 'whiskey_disk'))
3
+
4
+ integration_spec do
5
+ describe 'when configured for a local deployment' do
6
+ before do
7
+ setup_deployment_area
8
+ end
9
+
10
+ describe 'when the configuration specifies no domain' do
11
+ before do
12
+ @config = scenario_config('local/deploy.yml')
13
+ @args = "--path=#{@config} --to=project:local-default"
14
+ end
15
+
16
+ describe 'performing a setup' do
17
+ it 'should perform a checkout of the repository to the target path' do
18
+ run_setup(@args)
19
+ File.exists?(deployed_file('project/README')).should == true
20
+ end
21
+
22
+ it 'should report the local setup as successful' do
23
+ run_setup(@args)
24
+ File.read(integration_log).should =~ /local => succeeded/
25
+ end
26
+
27
+ it 'should exit with a true status' do
28
+ run_setup(@args).should == true
29
+ end
30
+ end
31
+
32
+ describe 'performing a deployment' do
33
+ before do
34
+ checkout_repo('project')
35
+ File.unlink(deployed_file('project/README')) # modify the deployed checkout
36
+ end
37
+
38
+ it 'should update the checkout of the repository on the target path' do
39
+ run_deploy(@args)
40
+ File.exists?(deployed_file('project/README')).should == true
41
+ end
42
+
43
+ it 'should report the local deployment as successful' do
44
+ run_deploy(@args)
45
+ File.read(integration_log).should =~ /local => succeeded/
46
+ end
47
+
48
+ it 'should exit with a true status' do
49
+ run_deploy(@args).should == true
50
+ end
51
+ end
52
+ end
53
+
54
+ describe 'when the configuration specifies a single domain via the "local" keyword' do
55
+ before do
56
+ @config = scenario_config('local/deploy.yml')
57
+ @args = "--path=#{@config} --to=project:local-keyword"
58
+ end
59
+
60
+ describe 'performing a setup' do
61
+ it 'should perform a checkout of the repository to the target path' do
62
+ run_setup(@args)
63
+ File.exists?(deployed_file('project/README')).should == true
64
+ end
65
+
66
+ it 'should report the local setup as successful' do
67
+ run_setup(@args)
68
+ File.read(integration_log).should =~ /local => succeeded/
69
+ end
70
+
71
+ it 'should exit with a true status' do
72
+ run_setup(@args).should == true
73
+ end
74
+ end
75
+
76
+ describe 'performing a deployment' do
77
+ before do
78
+ checkout_repo('project')
79
+ File.unlink(deployed_file('project/README')) # modify the deployed checkout
80
+ end
81
+
82
+ it 'should update the checkout of the repository on the target path' do
83
+ run_deploy(@args)
84
+ File.exists?(deployed_file('project/README')).should == true
85
+ end
86
+
87
+ it 'should report the local deployment as successful' do
88
+ run_deploy(@args)
89
+ File.read(integration_log).should =~ /local => succeeded/
90
+ end
91
+
92
+ it 'should exit with a true status' do
93
+ run_deploy(@args).should == true
94
+ end
95
+ end
96
+ end
97
+
98
+ describe 'when the configuration specifies a single domain specified as user@domain, using --only=domain' do
99
+ before do
100
+ @config = scenario_config('local/deploy.yml')
101
+ @args = "--path=#{@config} --to=project:local-user-domain --only=wd-app1.example.com"
102
+ end
103
+
104
+ describe 'performing a setup' do
105
+ it 'should perform a checkout of the repository to the target path' do
106
+ run_setup(@args)
107
+ File.exists?(deployed_file('project/README')).should == true
108
+ end
109
+
110
+ it 'should report the named domain setup as successful' do
111
+ run_setup(@args)
112
+ File.read(integration_log).should =~ /wd-app1\.example\.com => succeeded/
113
+ end
114
+
115
+ it 'should exit with a true status' do
116
+ run_setup(@args).should == true
117
+ end
118
+ end
119
+
120
+ describe 'performing a deployment' do
121
+ before do
122
+ checkout_repo('project')
123
+ File.unlink(deployed_file('project/README')) # modify the deployed checkout
124
+ end
125
+
126
+ it 'should update the checkout of the repository on the target path' do
127
+ run_deploy(@args)
128
+ File.exists?(deployed_file('project/README')).should == true
129
+ end
130
+
131
+ it 'should report the named domain deployment as successful' do
132
+ run_deploy(@args)
133
+ File.read(integration_log).should =~ /wd-app1\.example\.com => succeeded/
134
+ end
135
+
136
+ it 'should exit with a true status' do
137
+ run_deploy(@args).should == true
138
+ end
139
+ end
140
+ end
141
+
142
+ describe 'when the configuration specifies a single domain without username, using --only=domain' do
143
+ before do
144
+ @config = scenario_config('local/deploy.yml')
145
+ @args = "--path=#{@config} --to=project:local-domain --only=wd-app1.example.com"
146
+ end
147
+
148
+ describe 'performing a setup' do
149
+ it 'should perform a checkout of the repository to the target path' do
150
+ run_setup(@args)
151
+ File.exists?(deployed_file('project/README')).should == true
152
+ end
153
+
154
+ it 'should report the named domain setup as successful' do
155
+ run_setup(@args)
156
+ File.read(integration_log).should =~ /wd-app1\.example\.com => succeeded/
157
+ end
158
+
159
+ it 'should exit with a true status' do
160
+ run_setup(@args).should == true
161
+ end
162
+ end
163
+
164
+ describe 'performing a deployment' do
165
+ before do
166
+ checkout_repo('project')
167
+ File.unlink(deployed_file('project/README')) # modify the deployed checkout
168
+ end
169
+
170
+ it 'should update the checkout of the repository on the target path' do
171
+ run_deploy(@args)
172
+ File.exists?(deployed_file('project/README')).should == true
173
+ end
174
+
175
+ it 'should report the named domain deployment as successful' do
176
+ run_deploy(@args)
177
+ File.read(integration_log).should =~ /wd-app1\.example\.com => succeeded/
178
+ end
179
+
180
+ it 'should exit with a true status' do
181
+ run_deploy(@args).should == true
182
+ end
183
+ end
184
+ end
185
+
186
+ describe 'when the configuration specifies a single domain which does not match the --only domain' do
187
+ before do
188
+ @config = scenario_config('local/deploy.yml')
189
+ @args = "--path=#{@config} --to=project:local-domain --only=wd-app2.example.com"
190
+ end
191
+
192
+ describe 'performing a setup' do
193
+ it 'should not perform a checkout of the repository to the target path' do
194
+ run_setup(@args)
195
+ File.exists?(deployed_file('project/README')).should == false
196
+ end
197
+
198
+ it 'should report that there were no deployments' do
199
+ run_setup(@args)
200
+ File.read(integration_log).should =~ /No deployments/
201
+ end
202
+
203
+ it 'should exit with a true status' do
204
+ run_setup(@args).should == true
205
+ end
206
+ end
207
+
208
+ describe 'performing a deployment' do
209
+ before do
210
+ checkout_repo('project')
211
+ File.unlink(deployed_file('project/README')) # modify the deployed checkout
212
+ end
213
+
214
+ it 'should not update the checkout of the repository on the target path' do
215
+ run_deploy(@args)
216
+ File.exists?(deployed_file('project/README')).should == false
217
+ end
218
+
219
+ it 'should report that there were no deployments' do
220
+ run_deploy(@args)
221
+ File.read(integration_log).should =~ /No deployments/
222
+ end
223
+
224
+ it 'should exit with a true status' do
225
+ run_deploy(@args).should == true
226
+ end
227
+ end
228
+ end
229
+ end
230
+ end
@@ -0,0 +1,54 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper.rb'))
2
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'lib', 'whiskey_disk'))
3
+
4
+ integration_spec do
5
+ describe 'when configured for a remote deployment' do
6
+ before do
7
+ setup_deployment_area
8
+ end
9
+
10
+ describe 'with a single remote domain' do
11
+ before do
12
+ @config = scenario_config('remote/deploy.yml')
13
+ @args = "--path=#{@config} --to=project:remote"
14
+ end
15
+
16
+ describe 'performing a setup' do
17
+ it 'should perform a checkout of the repository to the target path' do
18
+ run_setup(@args)
19
+ File.exists?(deployed_file('project/README')).should == true
20
+ end
21
+
22
+ it 'should report the remote setup as successful' do
23
+ run_setup(@args)
24
+ File.read(integration_log).should =~ /wd-app1.example.com => succeeded/
25
+ end
26
+
27
+ it 'should exit with a true status' do
28
+ run_setup(@args).should == true
29
+ end
30
+ end
31
+
32
+ describe 'performing a deployment' do
33
+ before do
34
+ checkout_repo('project')
35
+ File.unlink(deployed_file('project/README')) # modify the deployed checkout
36
+ end
37
+
38
+ it 'should update the checkout of the repository on the target path' do
39
+ run_deploy(@args)
40
+ File.exists?(deployed_file('project/README')).should == true
41
+ end
42
+
43
+ it 'should report the remoate deployment as successful' do
44
+ run_deploy(@args)
45
+ File.read(integration_log).should =~ /wd-app1.example.com => succeeded/
46
+ end
47
+
48
+ it 'should exit with a true status' do
49
+ run_deploy(@args).should == true
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,62 @@
1
1
  require 'rubygems'
2
2
  require 'bacon'
3
3
  require 'facon'
4
+ require 'fileutils'
4
5
 
5
6
  $:.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')))
7
+
8
+ # local target directory, integration spec workspace
9
+ def deployment_root
10
+ '/tmp/wd-integration-target/destination/'
11
+ end
12
+
13
+ # allow defining an integration spec block
14
+ def integration_spec(&block)
15
+ yield if ENV['INTEGRATION'] and ENV['INTEGRATION'] != ''
16
+ end
17
+
18
+ # reset the deployment directory for integration specs
19
+ def setup_deployment_area
20
+ FileUtils.rm_rf(deployment_root)
21
+ File.umask(0)
22
+ Dir.mkdir(deployment_root, 0777)
23
+ Dir.mkdir(deployed_file('log'), 0777)
24
+ end
25
+
26
+ # run a wd setup using the provided arguments string
27
+ def run_setup(arguments)
28
+ wd_path = File.join(File.dirname(__FILE__), '..', 'bin', 'wd')
29
+ lib_path = File.join(File.dirname(__FILE__), '..', 'lib')
30
+ system("/usr/bin/env ruby -I #{lib_path} -r whiskey_disk -rubygems #{wd_path} setup #{arguments} > #{integration_log} 2> #{integration_log}")
31
+ end
32
+
33
+ def integration_log
34
+ deployed_file('log/out.txt')
35
+ end
36
+
37
+ # run a wd setup using the provided arguments string
38
+ def run_deploy(arguments)
39
+ wd_path = File.join(File.dirname(__FILE__), '..', 'bin', 'wd')
40
+ lib_path = File.join(File.dirname(__FILE__), '..', 'lib')
41
+ status = system("/usr/bin/env ruby -I #{lib_path} -r whiskey_disk -rubygems #{wd_path} deploy #{arguments} > #{integration_log} 2> #{integration_log}")
42
+ status
43
+ end
44
+
45
+ # build the correct local path to the deployment configuration for a given scenario
46
+ def scenario_config(path)
47
+ File.join(File.dirname(__FILE__), '..', 'scenarios', path)
48
+ end
49
+
50
+ # clone a git repository locally (as if a "wd setup" had been deployed)
51
+ def checkout_repo(repo_name, name = '')
52
+ repo_path = File.expand_path(File.join(File.dirname(__FILE__), '..', 'scenarios', 'git_repositories', "#{repo_name}.git"))
53
+ system("cd #{deployment_root} && git clone #{repo_path} #{name} >/dev/null 2>/dev/null")
54
+ end
55
+
56
+ def run_log
57
+ File.readlines(integration_log)
58
+ end
59
+
60
+ def deployed_file(path)
61
+ File.join(deployment_root, path)
62
+ end
@@ -122,6 +122,68 @@ describe 'wd command' do
122
122
  lambda { run_command }.should.not.raise
123
123
  end
124
124
  end
125
+
126
+ describe 'and a --only argument is specified' do
127
+ before do
128
+ @domain = 'smeghost'
129
+ ARGV.push "--only=#{@domain}"
130
+ end
131
+
132
+ it 'should make the specified domain available as an "only" argument to the rake task' do
133
+ run_command
134
+ ENV['only'].should == @domain
135
+ end
136
+
137
+ it 'should fail if the rake task fails' do
138
+ @rake.stub!(:invoke).and_raise(RuntimeError)
139
+ lambda { run_command }.should.raise
140
+ end
141
+
142
+ it 'should not fail if the rake task succeeds' do
143
+ @rake.stub!(:invoke).and_return(true)
144
+ lambda { run_command }.should.not.raise
145
+ end
146
+ end
147
+
148
+ describe 'and a -o argument is specified' do
149
+ before do
150
+ @domain = 'smeghost'
151
+ ARGV.push '-o'
152
+ ARGV.push @domain
153
+ end
154
+
155
+ it 'should make the specified domain available as an "only" argument to the rake task' do
156
+ run_command
157
+ ENV['only'].should == @domain
158
+ end
159
+
160
+ it 'should fail if the rake task fails' do
161
+ @rake.stub!(:invoke).and_raise(RuntimeError)
162
+ lambda { run_command }.should.raise
163
+ end
164
+
165
+ it 'should not fail if the rake task succeeds' do
166
+ @rake.stub!(:invoke).and_return(true)
167
+ lambda { run_command }.should.not.raise
168
+ end
169
+ end
170
+
171
+ describe 'and no --only or -o argument is specified' do
172
+ it 'should not make an "only" argument available to the rake task' do
173
+ run_command
174
+ ENV['only'].should.be.nil
175
+ end
176
+
177
+ it 'should fail if the rake task fails' do
178
+ @rake.stub!(:invoke).and_raise(RuntimeError)
179
+ lambda { run_command }.should.raise
180
+ end
181
+
182
+ it 'should not fail if the rake task succeeds' do
183
+ @rake.stub!(:invoke).and_return(true)
184
+ lambda { run_command }.should.not.raise
185
+ end
186
+ end
125
187
  end
126
188
 
127
189
  describe 'and a -t argument is specified' do
@@ -204,16 +266,78 @@ describe 'wd command' do
204
266
  lambda { run_command }.should.not.raise
205
267
  end
206
268
  end
269
+
270
+ describe 'and a --only argument is specified' do
271
+ before do
272
+ @domain = 'smeghost'
273
+ ARGV.push "--only=#{@domain}"
274
+ end
275
+
276
+ it 'should make the specified domain available as an "only" argument to the rake task' do
277
+ run_command
278
+ ENV['only'].should == @domain
279
+ end
280
+
281
+ it 'should fail if the rake task fails' do
282
+ @rake.stub!(:invoke).and_raise(RuntimeError)
283
+ lambda { run_command }.should.raise
284
+ end
285
+
286
+ it 'should not fail if the rake task succeeds' do
287
+ @rake.stub!(:invoke).and_return(true)
288
+ lambda { run_command }.should.not.raise
289
+ end
290
+ end
291
+
292
+ describe 'and a -o argument is specified' do
293
+ before do
294
+ @domain = 'smeghost'
295
+ ARGV.push '-o'
296
+ ARGV.push @domain
297
+ end
298
+
299
+ it 'should make the specified domain available as an "only" argument to the rake task' do
300
+ run_command
301
+ ENV['only'].should == @domain
302
+ end
303
+
304
+ it 'should fail if the rake task fails' do
305
+ @rake.stub!(:invoke).and_raise(RuntimeError)
306
+ lambda { run_command }.should.raise
307
+ end
308
+
309
+ it 'should not fail if the rake task succeeds' do
310
+ @rake.stub!(:invoke).and_return(true)
311
+ lambda { run_command }.should.not.raise
312
+ end
313
+ end
314
+
315
+ describe 'and no --only or -o argument is specified' do
316
+ it 'should not make an "only" argument available to the rake task' do
317
+ run_command
318
+ ENV['only'].should.be.nil
319
+ end
320
+
321
+ it 'should fail if the rake task fails' do
322
+ @rake.stub!(:invoke).and_raise(RuntimeError)
323
+ lambda { run_command }.should.raise
324
+ end
325
+
326
+ it 'should not fail if the rake task succeeds' do
327
+ @rake.stub!(:invoke).and_return(true)
328
+ lambda { run_command }.should.not.raise
329
+ end
330
+ end
207
331
  end
208
332
  end
209
333
 
210
334
  describe "when the 'deploy' command is specified" do
211
- describe 'but no target is specified' do
212
- before do
213
- Object.send(:remove_const, :ARGV)
214
- ARGV = ['deploy']
215
- end
335
+ before do
336
+ Object.send(:remove_const, :ARGV)
337
+ ARGV = ['deploy']
338
+ end
216
339
 
340
+ describe 'but no target is specified' do
217
341
  it 'should not run rake tasks' do
218
342
  Rake::Application.should.receive(:new).never
219
343
  lambda { run_command }
@@ -289,6 +413,23 @@ describe 'wd command' do
289
413
  end
290
414
  end
291
415
 
416
+ describe 'and no --check or -c argument is specified' do
417
+ it 'should not make a "check" argument available to the rake task' do
418
+ run_command
419
+ ENV['check'].should.be.nil
420
+ end
421
+
422
+ it 'should fail if the rake task fails' do
423
+ @rake.stub!(:invoke).and_raise(RuntimeError)
424
+ lambda { run_command }.should.raise
425
+ end
426
+
427
+ it 'should not fail if the rake task succeeds' do
428
+ @rake.stub!(:invoke).and_return(true)
429
+ lambda { run_command }.should.not.raise
430
+ end
431
+ end
432
+
292
433
  describe 'and a --path argument is specified' do
293
434
  before do
294
435
  ARGV.push '--path=/path/to/foo'
@@ -332,8 +473,9 @@ describe 'wd command' do
332
473
  end
333
474
  end
334
475
 
335
- describe 'and no --path or -p argument is specified' do
476
+ describe 'and no --path or -p argument is specified' do
336
477
  it 'should not make a "path" argument available to the rake task' do
478
+ run_command
337
479
  ENV['path'].should.be.nil
338
480
  end
339
481
 
@@ -347,6 +489,68 @@ describe 'wd command' do
347
489
  lambda { run_command }.should.not.raise
348
490
  end
349
491
  end
492
+
493
+ describe 'and a --only argument is specified' do
494
+ before do
495
+ @domain = 'smeghost'
496
+ ARGV.push "--only=#{@domain}"
497
+ end
498
+
499
+ it 'should make the specified domain available as an "only" argument to the rake task' do
500
+ run_command
501
+ ENV['only'].should == @domain
502
+ end
503
+
504
+ it 'should fail if the rake task fails' do
505
+ @rake.stub!(:invoke).and_raise(RuntimeError)
506
+ lambda { run_command }.should.raise
507
+ end
508
+
509
+ it 'should not fail if the rake task succeeds' do
510
+ @rake.stub!(:invoke).and_return(true)
511
+ lambda { run_command }.should.not.raise
512
+ end
513
+ end
514
+
515
+ describe 'and a -o argument is specified' do
516
+ before do
517
+ @domain = 'smeghost'
518
+ ARGV.push '-o'
519
+ ARGV.push @domain
520
+ end
521
+
522
+ it 'should make the specified domain available as an "only" argument to the rake task' do
523
+ run_command
524
+ ENV['only'].should == @domain
525
+ end
526
+
527
+ it 'should fail if the rake task fails' do
528
+ @rake.stub!(:invoke).and_raise(RuntimeError)
529
+ lambda { run_command }.should.raise
530
+ end
531
+
532
+ it 'should not fail if the rake task succeeds' do
533
+ @rake.stub!(:invoke).and_return(true)
534
+ lambda { run_command }.should.not.raise
535
+ end
536
+ end
537
+
538
+ describe 'and no --only or -o argument is specified' do
539
+ it 'should not make an "only" argument available to the rake task' do
540
+ run_command
541
+ ENV['only'].should.be.nil
542
+ end
543
+
544
+ it 'should fail if the rake task fails' do
545
+ @rake.stub!(:invoke).and_raise(RuntimeError)
546
+ lambda { run_command }.should.raise
547
+ end
548
+
549
+ it 'should not fail if the rake task succeeds' do
550
+ @rake.stub!(:invoke).and_return(true)
551
+ lambda { run_command }.should.not.raise
552
+ end
553
+ end
350
554
  end
351
555
 
352
556
  describe 'and a -t argument is specified' do
@@ -415,6 +619,23 @@ describe 'wd command' do
415
619
  end
416
620
  end
417
621
 
622
+ describe 'and no --check or -c argument is specified' do
623
+ it 'should not make a "check" argument available to the rake task' do
624
+ run_command
625
+ ENV['check'].should.be.nil
626
+ end
627
+
628
+ it 'should fail if the rake task fails' do
629
+ @rake.stub!(:invoke).and_raise(RuntimeError)
630
+ lambda { run_command }.should.raise
631
+ end
632
+
633
+ it 'should not fail if the rake task succeeds' do
634
+ @rake.stub!(:invoke).and_return(true)
635
+ lambda { run_command }.should.not.raise
636
+ end
637
+ end
638
+
418
639
  describe 'and a --path argument is specified' do
419
640
  before do
420
641
  ARGV.push '--path=/path/to/foo'
@@ -473,6 +694,68 @@ describe 'wd command' do
473
694
  lambda { run_command }.should.not.raise
474
695
  end
475
696
  end
697
+
698
+ describe 'and a --only argument is specified' do
699
+ before do
700
+ @domain = 'smeghost'
701
+ ARGV.push "--only=#{@domain}"
702
+ end
703
+
704
+ it 'should make the specified domain available as an "only" argument to the rake task' do
705
+ run_command
706
+ ENV['only'].should == @domain
707
+ end
708
+
709
+ it 'should fail if the rake task fails' do
710
+ @rake.stub!(:invoke).and_raise(RuntimeError)
711
+ lambda { run_command }.should.raise
712
+ end
713
+
714
+ it 'should not fail if the rake task succeeds' do
715
+ @rake.stub!(:invoke).and_return(true)
716
+ lambda { run_command }.should.not.raise
717
+ end
718
+ end
719
+
720
+ describe 'and a -o argument is specified' do
721
+ before do
722
+ @domain = 'smeghost'
723
+ ARGV.push '-o'
724
+ ARGV.push @domain
725
+ end
726
+
727
+ it 'should make the specified domain available as an "only" argument to the rake task' do
728
+ run_command
729
+ ENV['only'].should == @domain
730
+ end
731
+
732
+ it 'should fail if the rake task fails' do
733
+ @rake.stub!(:invoke).and_raise(RuntimeError)
734
+ lambda { run_command }.should.raise
735
+ end
736
+
737
+ it 'should not fail if the rake task succeeds' do
738
+ @rake.stub!(:invoke).and_return(true)
739
+ lambda { run_command }.should.not.raise
740
+ end
741
+ end
742
+
743
+ describe 'and no --only or -o argument is specified' do
744
+ it 'should not make an "only" argument available to the rake task' do
745
+ run_command
746
+ ENV['only'].should.be.nil
747
+ end
748
+
749
+ it 'should fail if the rake task fails' do
750
+ @rake.stub!(:invoke).and_raise(RuntimeError)
751
+ lambda { run_command }.should.raise
752
+ end
753
+
754
+ it 'should not fail if the rake task succeeds' do
755
+ @rake.stub!(:invoke).and_return(true)
756
+ lambda { run_command }.should.not.raise
757
+ end
758
+ end
476
759
  end
477
760
  end
478
761