whiskey_disk 0.6.22 → 0.6.23

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) hide show
  1. data/CHANGELOG +25 -15
  2. data/README.integration_specs +24 -36
  3. data/README.markdown +112 -96
  4. data/Rakefile +79 -5
  5. data/VERSION +1 -1
  6. data/lib/whiskey_disk.rb +297 -294
  7. data/lib/whiskey_disk/config.rb +99 -168
  8. data/lib/whiskey_disk/config/abstract_filter.rb +19 -0
  9. data/lib/whiskey_disk/config/filter.rb +48 -0
  10. data/lib/whiskey_disk/config/filters/add_environment_name_filter.rb +11 -0
  11. data/lib/whiskey_disk/config/filters/add_project_name_filter.rb +11 -0
  12. data/lib/whiskey_disk/config/filters/check_for_duplicate_domains_filter.rb +21 -0
  13. data/lib/whiskey_disk/config/filters/convert_role_strings_to_list_filter.rb +20 -0
  14. data/lib/whiskey_disk/config/filters/default_config_target_filter.rb +12 -0
  15. data/lib/whiskey_disk/config/filters/default_domain_filter.rb +12 -0
  16. data/lib/whiskey_disk/config/filters/drop_empty_domain_roles_filter.rb +32 -0
  17. data/lib/whiskey_disk/config/filters/environment_scope_filter.rb +20 -0
  18. data/lib/whiskey_disk/config/filters/hashify_domain_entries_filter.rb +29 -0
  19. data/lib/whiskey_disk/config/filters/localize_domains_filter.rb +24 -0
  20. data/lib/whiskey_disk/config/filters/modules/scope_helper.rb +11 -0
  21. data/lib/whiskey_disk/config/filters/normalize_ssh_options_filter.rb +29 -0
  22. data/lib/whiskey_disk/config/filters/project_scope_filter.rb +34 -0
  23. data/lib/whiskey_disk/config/filters/select_project_and_environment_filter.rb +12 -0
  24. data/lib/whiskey_disk/config/filters/stringify_hash_keys_filter.rb +25 -0
  25. data/lib/whiskey_disk/helpers.rb +1 -1
  26. data/lib/whiskey_disk/rake.rb +25 -22
  27. data/scenarios/git_repositories/config.git/HEAD +1 -0
  28. data/scenarios/git_repositories/config.git/config +5 -0
  29. data/scenarios/git_repositories/config.git/description +1 -0
  30. data/scenarios/git_repositories/config.git/git-daemon-export-ok +0 -0
  31. data/scenarios/git_repositories/config.git/hooks/applypatch-msg.sample +15 -0
  32. data/scenarios/git_repositories/config.git/hooks/commit-msg.sample +24 -0
  33. data/scenarios/git_repositories/config.git/hooks/post-commit.sample +8 -0
  34. data/scenarios/git_repositories/config.git/hooks/post-receive.sample +15 -0
  35. data/scenarios/git_repositories/config.git/hooks/post-update.sample +8 -0
  36. data/scenarios/git_repositories/config.git/hooks/pre-applypatch.sample +14 -0
  37. data/scenarios/git_repositories/config.git/hooks/pre-commit.sample +46 -0
  38. data/scenarios/git_repositories/config.git/hooks/pre-rebase.sample +169 -0
  39. data/scenarios/git_repositories/config.git/hooks/prepare-commit-msg.sample +36 -0
  40. data/scenarios/git_repositories/config.git/hooks/update.sample +128 -0
  41. data/scenarios/git_repositories/config.git/info/exclude +6 -0
  42. data/scenarios/git_repositories/config.git/objects/0d/b14dd6ddc54017c0a11960dcda82ed802cde69 +0 -0
  43. data/scenarios/git_repositories/config.git/objects/0e/e781f5ce80d64db32a74a7aae7b5248dafe112 +3 -0
  44. data/scenarios/git_repositories/config.git/objects/17/6bf54cf17d1d1c24556dc059c4144a5df230e8 +0 -0
  45. data/scenarios/git_repositories/config.git/objects/20/e9ff3feaa8ede30f707e5f1b4356e3c02bb7ec +0 -0
  46. data/scenarios/git_repositories/config.git/objects/45/117b1c775f0de415478dbf08ed9d667ab17d13 +0 -0
  47. data/scenarios/git_repositories/config.git/objects/51/3954c9aca090e6ce40359f0e9fde30ea78eb8c +0 -0
  48. data/scenarios/git_repositories/config.git/objects/66/947a7a11a6f5d3d561fe95de284ced3010819a +0 -0
  49. data/scenarios/git_repositories/config.git/objects/6b/bc79311bfac47d3ed724aa82a4814e0dda4c67 +0 -0
  50. data/scenarios/git_repositories/config.git/objects/71/eb5df52676e8e6efba471050b46978173af110 +1 -0
  51. data/scenarios/git_repositories/config.git/objects/84/17d2fe3e8fcc0825249c517b29b0f9ea8b8b31 +2 -0
  52. data/scenarios/git_repositories/config.git/objects/8b/384fcfcf7c0dee7c3c1d5636bee9e645d9cf38 +0 -0
  53. data/scenarios/git_repositories/config.git/objects/bb/59da633ba74296b0c2f9ff70784ac155ddb599 +0 -0
  54. data/scenarios/git_repositories/config.git/objects/cc/b86b26189afbf45d8eb9165812ab86dbdfca63 +0 -0
  55. data/scenarios/git_repositories/config.git/objects/d1/0bcd51fec41f854001e4d61f99d9e282a695d3 +0 -0
  56. data/scenarios/git_repositories/config.git/objects/d8/a8b0f5b1fd66844efb141d9544965ea0065f2d +0 -0
  57. data/scenarios/git_repositories/config.git/objects/e6/b02c66ad632e6b8535c4630cb8fe07732a72fc +0 -0
  58. data/scenarios/git_repositories/config.git/objects/e8/b8bfeeba735c0a1a873082554cb4d7256ac125 +0 -0
  59. data/scenarios/git_repositories/config.git/objects/f9/0181466a1a60b793ca9cc9abd584c18d4e3887 +0 -0
  60. data/scenarios/git_repositories/config.git/objects/f9/49d5d8a4f12c91471e34d4e277239c35ebd10d +0 -0
  61. data/scenarios/git_repositories/config.git/refs/heads/master +1 -0
  62. data/scenarios/git_repositories/project.git/HEAD +1 -0
  63. data/scenarios/git_repositories/project.git/config +5 -0
  64. data/scenarios/git_repositories/project.git/description +1 -0
  65. data/scenarios/git_repositories/project.git/git-daemon-export-ok +0 -0
  66. data/scenarios/git_repositories/project.git/hooks/applypatch-msg.sample +15 -0
  67. data/scenarios/git_repositories/project.git/hooks/commit-msg.sample +24 -0
  68. data/scenarios/git_repositories/project.git/hooks/post-commit.sample +8 -0
  69. data/scenarios/git_repositories/project.git/hooks/post-receive.sample +15 -0
  70. data/scenarios/git_repositories/project.git/hooks/post-update.sample +8 -0
  71. data/scenarios/git_repositories/project.git/hooks/pre-applypatch.sample +14 -0
  72. data/scenarios/git_repositories/project.git/hooks/pre-commit.sample +46 -0
  73. data/scenarios/git_repositories/project.git/hooks/pre-rebase.sample +169 -0
  74. data/scenarios/git_repositories/project.git/hooks/prepare-commit-msg.sample +36 -0
  75. data/scenarios/git_repositories/project.git/hooks/update.sample +128 -0
  76. data/scenarios/git_repositories/project.git/info/exclude +6 -0
  77. data/scenarios/git_repositories/project.git/objects/04/26e152e66c8cd42974279bdcae09be9839c172 +0 -0
  78. data/scenarios/git_repositories/project.git/objects/04/f4de85eaf72ef1631dc6d7424045c0a749b757 +1 -0
  79. data/scenarios/git_repositories/project.git/objects/06/13fe277280cbcdb2856e1eefc70bdaff011b20 +0 -0
  80. data/scenarios/git_repositories/project.git/objects/06/7aca89b86265eee211387434c3e50f37ccf009 +0 -0
  81. data/scenarios/git_repositories/project.git/objects/09/445dacc4822722612d60833c9948219ecdd8f5 +0 -0
  82. data/scenarios/git_repositories/project.git/objects/11/c4ec64326de35462f4e79d0f4229bf8e26e0c5 +0 -0
  83. data/scenarios/git_repositories/project.git/objects/20/1c7641c2e42b0b904e5c1f793489d8b858e4da +2 -0
  84. data/scenarios/git_repositories/project.git/objects/23/979639da60d2d31e9744468df1c1221b101e64 +0 -0
  85. data/scenarios/git_repositories/project.git/objects/27/a3fff2c4c45ab5513a405f694c0a042cb5d417 +1 -0
  86. data/scenarios/git_repositories/project.git/objects/2c/0c33cfba8e1af15df88522c0db2b10a6a94138 +2 -0
  87. data/scenarios/git_repositories/project.git/objects/38/b574660305ecb5fec6b2daa7ee1e0dbf1b6003 +0 -0
  88. data/scenarios/git_repositories/project.git/objects/4a/57abb5e4e426cfc9101b3af22ac83ccbd8e2ad +0 -0
  89. data/scenarios/git_repositories/project.git/objects/4c/77ebdd985e57afe7988480720c5dc77ec525c9 +0 -0
  90. data/scenarios/git_repositories/project.git/objects/51/c94da6f1b8aa9d2346088d3d362475b60c7f32 +0 -0
  91. data/scenarios/git_repositories/project.git/objects/5b/a96acf9cc9b87babe37c032676f53bf1ba9ae7 +2 -0
  92. data/scenarios/git_repositories/project.git/objects/5d/f555601d60f1c2a84d2364af0ad640612c3ba5 +0 -0
  93. data/scenarios/git_repositories/project.git/objects/71/03b5ac94940d596c2160a5cfcd55ca4ccac41f +0 -0
  94. data/scenarios/git_repositories/project.git/objects/73/3fc331098b03523f414f3509b9ae6e637c6866 +0 -0
  95. data/scenarios/git_repositories/project.git/objects/80/26076649ceccbe96a6292f2432652f08483035 +0 -0
  96. data/scenarios/git_repositories/project.git/objects/86/d1ef0976be4567de562224e1b51fbf9820c53a +1 -0
  97. data/scenarios/git_repositories/project.git/objects/87/a9d8b09b3401d21b23d90253332d6b28b47db2 +0 -0
  98. data/scenarios/git_repositories/project.git/objects/8b/030ba688255c917d189ae3f87d7c5ccd226bc2 +0 -0
  99. data/scenarios/git_repositories/project.git/objects/95/c9d5ad9b1c90e4c805516783105fc2037dedeb +2 -0
  100. data/scenarios/git_repositories/project.git/objects/95/d82d043af35a80eabfd56c0d705abfa3488787 +2 -0
  101. data/scenarios/git_repositories/project.git/objects/96/0bf34bb0b46d0aeb0be87f688f4ef06a4b35e1 +0 -0
  102. data/scenarios/git_repositories/project.git/objects/a3/860106dc1d148c7831cd45ae38829b4ed47702 +2 -0
  103. data/scenarios/git_repositories/project.git/objects/a8/506d6439b71784a72ac72d284b2ad53088f573 +0 -0
  104. data/scenarios/git_repositories/project.git/objects/ad/22ea6c7563777936ecfbe50d8e2cf8120fd525 +0 -0
  105. data/scenarios/git_repositories/project.git/objects/ae/3900de54aff557c61c81146d00f9d38e55a265 +1 -0
  106. data/scenarios/git_repositories/project.git/objects/bf/5e3740d52b80abb0378b3f85f93a53b1294521 +1 -0
  107. data/scenarios/git_repositories/project.git/objects/bf/b59811cdbc069418dee14b171e6e7e979784b7 +0 -0
  108. data/scenarios/git_repositories/project.git/objects/cc/5ac0afb24e727d5de344cc26a425f4fb7fd17d +3 -0
  109. data/scenarios/git_repositories/project.git/objects/d1/091aa2dd76885108461110c639e6b33a297fce +0 -0
  110. data/scenarios/git_repositories/project.git/objects/d8/913f6650eb2b7bf2a633732d8452008ca23dcb +0 -0
  111. data/scenarios/git_repositories/project.git/objects/db/d1b9667f1b26b13331ac0c321dced8be1aeab0 +3 -0
  112. data/scenarios/git_repositories/project.git/objects/e4/3b9107e9b1908ce415025e64eb83a493d329b7 +0 -0
  113. data/scenarios/git_repositories/project.git/objects/ef/2a88894d5421920b9dfe67a9a4d8043830e62e +0 -0
  114. data/scenarios/git_repositories/project.git/objects/f4/0123a1ff20c65d8dc15a38a83222647908e6f7 +0 -0
  115. data/scenarios/git_repositories/project.git/objects/f5/0af315b75ca0b12c720dec6d916b76b968c319 +0 -0
  116. data/scenarios/git_repositories/project.git/objects/f6/0215709b7b23f3738e9cbaf634b1c86bbd376a +0 -0
  117. data/scenarios/git_repositories/project.git/refs/heads/bad_rakefile +1 -0
  118. data/scenarios/git_repositories/project.git/refs/heads/hook_with_changed +1 -0
  119. data/scenarios/git_repositories/project.git/refs/heads/master +1 -0
  120. data/scenarios/git_repositories/project.git/refs/heads/no_rake_hooks +1 -0
  121. data/scenarios/git_repositories/project.git/refs/heads/post_rake_tasks +1 -0
  122. data/scenarios/invalid/deploy.yml +1 -0
  123. data/scenarios/local/deploy.yml.erb +17 -0
  124. data/scenarios/remote/deploy.yml +119 -0
  125. data/scenarios/setup/vagrant/.gitignore +3 -0
  126. data/scenarios/setup/vagrant/Vagrantfile +10 -0
  127. data/scenarios/setup/vagrant/manifests/integration.pp +32 -0
  128. data/scenarios/setup/vagrant/pids/.gitignore +1 -0
  129. data/spec/init_spec.rb +1 -1
  130. data/spec/install_spec.rb +4 -4
  131. data/spec/integration/branch_switching_spec.rb +41 -0
  132. data/spec/integration/deployment_failures_spec.rb +106 -0
  133. data/spec/integration/helper_spec.rb +90 -0
  134. data/spec/integration/invalid_configuration_spec.rb +39 -0
  135. data/spec/integration/local_deployments_spec.rb +230 -0
  136. data/spec/integration/post_rake_tasks_spec.rb +226 -0
  137. data/spec/integration/post_scripts_spec.rb +246 -0
  138. data/spec/integration/remote_deployments_spec.rb +166 -0
  139. data/spec/integration/staleness_checks_spec.rb +72 -0
  140. data/spec/spec_helper.rb +30 -2
  141. data/spec/wd_command_spec.rb +136 -136
  142. data/spec/wd_role_command_spec.rb +5 -5
  143. data/spec/whiskey_disk/config/filter_spec.rb +77 -0
  144. data/spec/whiskey_disk/config/filters/add_environment_name_filter_spec.rb +20 -0
  145. data/spec/whiskey_disk/config/filters/add_project_name_filter_spec.rb +19 -0
  146. data/spec/whiskey_disk/config/filters/check_for_duplicate_domains_filter_spec.rb +29 -0
  147. data/spec/whiskey_disk/config/filters/convert_role_strings_to_list_filter_spec.rb +48 -0
  148. data/spec/whiskey_disk/config/filters/default_config_target_filter_spec.rb +19 -0
  149. data/spec/whiskey_disk/config/filters/default_domain_filter_spec.rb +18 -0
  150. data/spec/whiskey_disk/config/filters/drop_empty_domain_roles_filter_spec.rb +60 -0
  151. data/spec/whiskey_disk/config/filters/environment_scope_filter_spec.rb +32 -0
  152. data/spec/whiskey_disk/config/filters/hashify_domain_entries_filter_spec.rb +41 -0
  153. data/spec/whiskey_disk/config/filters/localize_domains_filter_spec.rb +30 -0
  154. data/spec/whiskey_disk/config/filters/normalize_ssh_options_filter_spec.rb +56 -0
  155. data/spec/whiskey_disk/config/filters/project_scope_filter_spec.rb +75 -0
  156. data/spec/whiskey_disk/config/filters/select_project_and_environment_filter_spec.rb +30 -0
  157. data/spec/whiskey_disk/config/filters/stringify_hash_keys_filter_spec.rb +40 -0
  158. data/spec/whiskey_disk/config_spec.rb +259 -446
  159. data/spec/whiskey_disk/helpers_spec.rb +51 -51
  160. data/spec/whiskey_disk/rake_spec.rb +80 -80
  161. data/spec/whiskey_disk_spec.rb +591 -562
  162. data/whiskey_disk.gemspec +151 -20
  163. metadata +151 -18
@@ -0,0 +1,90 @@
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 a post_deploy hook uses the changed? method' do
6
+ before do
7
+ setup_deployment_area
8
+ @config = scenario_config('remote/deploy.yml')
9
+ @args = "--path=#{@config} --to=project:hook_with_changed"
10
+ end
11
+
12
+ describe 'and performing a setup' do
13
+ it 'performs a checkout of the repository to the target path' do
14
+ run_setup(@args)
15
+ File.exists?(deployed_file('project/README')).should == true
16
+ end
17
+
18
+ it 'considers all files changed, running any actions guarded by #changed?' do
19
+ run_setup(@args)
20
+ File.read(integration_log).should =~ /changed\? was true/
21
+ end
22
+
23
+ it 'considers all files changed, including by rsync, running any actions guarded by #changed?' do
24
+ run_setup(@args)
25
+ File.read(integration_log).should =~ /changed\? by rsync was true/
26
+ end
27
+
28
+ it 'considers all files changed, not running any actions guarded by ! #changed?' do
29
+ run_setup(@args)
30
+ File.read(integration_log).should.not =~ /changed\? was false/
31
+ end
32
+
33
+ it 'considers all files changed, including by rsync not running any actions guarded by ! #changed?' do
34
+ run_setup(@args)
35
+ File.read(integration_log).should.not =~ /changed\? by rsync was false/
36
+ end
37
+
38
+ it 'reports the remote setup as successful' do
39
+ run_setup(@args)
40
+ File.read(integration_log).should =~ /vagrant => succeeded/
41
+ end
42
+
43
+ it 'exits with a true status' do
44
+ run_setup(@args).should == true
45
+ end
46
+ end
47
+
48
+ describe 'and performing a deployment' do
49
+ before do
50
+ checkout_repo('project', 'hook_with_changed')
51
+ checkout_repo('config')
52
+ jump_to_initial_commit('project') # reset the deployed checkout
53
+ end
54
+
55
+ it 'updates the repo checkout' do
56
+ run_deploy(@args)
57
+ File.exists?(deployed_file('project/README')).should == true
58
+ end
59
+
60
+ it 'runs actions contingent on file changes' do
61
+ run_deploy(@args)
62
+ File.read(integration_log).should =~ /changed\? was true/
63
+ end
64
+
65
+ it 'runs actions contingent on rsync file changes' do
66
+ run_deploy(@args)
67
+ File.read(integration_log).should =~ /changed\? by rsync was true/
68
+ end
69
+
70
+ it 'does not run actions contingent upon files not changing' do
71
+ run_deploy(@args)
72
+ File.read(integration_log).should =~ /changed\? was false/
73
+ end
74
+
75
+ it 'does not run actions contingent upon rsync files not changing' do
76
+ run_deploy(@args)
77
+ File.read(integration_log).should =~ /changed\? by rsync was false/
78
+ end
79
+
80
+ it 'exits with a true status' do
81
+ run_deploy(@args).should == true
82
+ end
83
+
84
+ it 'reports the deployment as successful' do
85
+ run_deploy(@args)
86
+ File.read(integration_log).should =~ /vagrant => succeeded/
87
+ end
88
+ end
89
+ end
90
+ end
@@ -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 'exits with a false status' do
14
+ run_setup(@args).should == false
15
+ end
16
+
17
+ it 'does 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 'exits with a false status' do
30
+ run_deploy(@args).should == false
31
+ end
32
+
33
+ it 'does 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.erb')
13
+ @args = "--path=#{@config} --to=project:local-default"
14
+ end
15
+
16
+ describe 'performing a setup' do
17
+ it 'performs 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 'reports the local setup as successful' do
23
+ run_setup(@args)
24
+ File.read(integration_log).should =~ /local => succeeded/
25
+ end
26
+
27
+ it 'exits 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 'updates 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 'reports the local deployment as successful' do
44
+ run_deploy(@args)
45
+ File.read(integration_log).should =~ /local => succeeded/
46
+ end
47
+
48
+ it 'exits 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.erb')
57
+ @args = "--path=#{@config} --to=project:local-keyword"
58
+ end
59
+
60
+ describe 'performing a setup' do
61
+ it 'performs 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 'reports the local setup as successful' do
67
+ run_setup(@args)
68
+ File.read(integration_log).should =~ /local => succeeded/
69
+ end
70
+
71
+ it 'exits 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 'updates 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 'reports the local deployment as successful' do
88
+ run_deploy(@args)
89
+ File.read(integration_log).should =~ /local => succeeded/
90
+ end
91
+
92
+ it 'exits 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.erb')
101
+ @args = "--path=#{@config} --to=project:local-user-domain --only=localhost"
102
+ end
103
+
104
+ describe 'performing a setup' do
105
+ it 'performs 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 'reports the named domain setup as successful' do
111
+ run_setup(@args)
112
+ File.read(integration_log).should =~ /localhost => succeeded/
113
+ end
114
+
115
+ it 'exits 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 'updates 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 'reports the named domain deployment as successful' do
132
+ run_deploy(@args)
133
+ File.read(integration_log).should =~ /localhost => succeeded/
134
+ end
135
+
136
+ it 'exits 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.erb')
145
+ @args = "--path=#{@config} --to=project:local-domain --only=localhost"
146
+ end
147
+
148
+ describe 'performing a setup' do
149
+ it 'performs 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 'reports the named domain setup as successful' do
155
+ run_setup(@args)
156
+ File.read(integration_log).should =~ /localhost => succeeded/
157
+ end
158
+
159
+ it 'exits 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 'updates 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 'reports the named domain deployment as successful' do
176
+ run_deploy(@args)
177
+ File.read(integration_log).should =~ /localhost => succeeded/
178
+ end
179
+
180
+ it 'exits 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.erb')
189
+ @args = "--path=#{@config} --to=project:local-domain --only=vagrant2"
190
+ end
191
+
192
+ describe 'performing a setup' do
193
+ it 'does 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 'reports that there were no deployments' do
199
+ run_setup(@args)
200
+ File.read(integration_log).should =~ /No deployments/
201
+ end
202
+
203
+ it 'exits 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 'does 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 'reports that there were no deployments' do
220
+ run_deploy(@args)
221
+ File.read(integration_log).should =~ /No deployments/
222
+ end
223
+
224
+ it 'exits with a true status' do
225
+ run_deploy(@args).should == true
226
+ end
227
+ end
228
+ end
229
+ end
230
+ end
@@ -0,0 +1,226 @@
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 no Rakefile in the project' do
11
+ before do
12
+ @config = scenario_config('remote/deploy.yml')
13
+ @args = "--path=#{@config} --to=project:no_rakefile"
14
+ end
15
+
16
+ describe 'performing a setup' do
17
+ it 'performs 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 'does not run a deploy:post_setup rake task' do
23
+ run_setup(@args)
24
+ File.read(integration_log).should.not =~ /Running a post_setup task/
25
+ end
26
+
27
+ it 'reports the remote setup as successful' do
28
+ run_setup(@args)
29
+ File.read(integration_log).should =~ /vagrant => succeeded/
30
+ end
31
+
32
+ it 'exits with a true status' do
33
+ run_setup(@args).should == true
34
+ end
35
+ end
36
+
37
+ describe 'performing a deployment' do
38
+ before do
39
+ checkout_repo('project')
40
+ File.unlink(deployed_file('project/README')) # modify the deployed checkout
41
+ end
42
+
43
+ it 'updates the checkout of the repository on the target path' do
44
+ run_deploy(@args)
45
+ File.exists?(deployed_file('project/README')).should == true
46
+ end
47
+
48
+ it 'does not run a deploy:post_deploy rake task' do
49
+ run_deploy(@args)
50
+ File.read(integration_log).should.not =~ /Running a post_deploy task/
51
+ end
52
+
53
+ it 'reports the remote deployment as successful' do
54
+ run_deploy(@args)
55
+ File.read(integration_log).should =~ /vagrant => succeeded/
56
+ end
57
+
58
+ it 'exits with a true status' do
59
+ run_deploy(@args).should == true
60
+ end
61
+ end
62
+ end
63
+
64
+ describe 'with an unparseable Rakefile in the project' do
65
+ before do
66
+ @config = scenario_config('remote/deploy.yml')
67
+ @args = "--path=#{@config} --to=project:bad_rakefile"
68
+ end
69
+
70
+ describe 'performing a setup' do
71
+ it 'performs a checkout of the repository to the target path' do
72
+ run_setup(@args)
73
+ File.exists?(deployed_file('project/README')).should == true
74
+ end
75
+
76
+ it 'does not run a deploy:post_setup rake task' do
77
+ run_setup(@args)
78
+ File.read(integration_log).should.not =~ /Running a post_setup task/
79
+ end
80
+
81
+ it 'reports the remote setup as a failure' do
82
+ run_setup(@args)
83
+ File.read(integration_log).should =~ /vagrant => failed/
84
+ end
85
+
86
+ it 'exits with a false status' do
87
+ run_setup(@args).should == false
88
+ end
89
+ end
90
+
91
+ describe 'performing a deployment' do
92
+ before do
93
+ checkout_repo('project', 'bad_rakefile')
94
+ File.unlink(deployed_file('project/README')) # modify the deployed checkout
95
+ end
96
+
97
+ it 'updates the checkout of the repository on the target path' do
98
+ run_deploy(@args)
99
+ File.exists?(deployed_file('project/README')).should == true
100
+ end
101
+
102
+ it 'does not run a deploy:post_deploy rake task' do
103
+ run_deploy(@args)
104
+ File.read(integration_log).should.not =~ /Running a post_deploy task/
105
+ end
106
+
107
+ it 'reports the remote deployment as a failure' do
108
+ run_deploy(@args)
109
+ File.read(integration_log).should =~ /vagrant => failed/
110
+ end
111
+
112
+ it 'exits with a false status' do
113
+ run_deploy(@args).should == false
114
+ end
115
+ end
116
+ end
117
+
118
+ describe 'with a valid Rakefile in the project with no post_setup or post_deploy hooks' do
119
+ before do
120
+ @config = scenario_config('remote/deploy.yml')
121
+ @args = "--path=#{@config} --to=project:no_rake_hooks"
122
+ end
123
+
124
+ describe 'and doing a setup' do
125
+ it 'performs a checkout of the repository to the target path' do
126
+ run_setup(@args)
127
+ File.exists?(deployed_file('project/README')).should == true
128
+ end
129
+
130
+ it 'does not run a deploy:post_setup rake task' do
131
+ run_setup(@args)
132
+ File.read(integration_log).should.not =~ /Running a post_setup task/
133
+ end
134
+
135
+ it 'reports the remote setup as successful' do
136
+ run_setup(@args)
137
+ File.read(integration_log).should =~ /vagrant => succeeded/
138
+ end
139
+
140
+ it 'exits with a true status' do
141
+ run_setup(@args).should == true
142
+ end
143
+ end
144
+
145
+ describe 'and doing a deploy' do
146
+ before do
147
+ checkout_repo('project', 'no_rake_hooks')
148
+ File.unlink(deployed_file('project/README')) # modify the deployed checkout
149
+ end
150
+
151
+ it 'updates the checkout of the repository on the target path' do
152
+ run_deploy(@args)
153
+ File.exists?(deployed_file('project/README')).should == true
154
+ end
155
+
156
+ it 'does not run a deploy:post_deploy rake task' do
157
+ run_deploy(@args)
158
+ File.read(integration_log).should.not =~ /Running a post_deploy task/
159
+ end
160
+
161
+ it 'reports the remote deployment as successful' do
162
+ run_deploy(@args)
163
+ File.read(integration_log).should =~ /vagrant => succeeded/
164
+ end
165
+
166
+ it 'exits with a true status' do
167
+ run_deploy(@args).should == true
168
+ end
169
+ end
170
+ end
171
+
172
+ describe 'with a valid Rakefile in the project with post_setup and post_deploy hooks' do
173
+ before do
174
+ @config = scenario_config('remote/deploy.yml')
175
+ @args = "--path=#{@config} --to=project:with_rake_hooks"
176
+ end
177
+
178
+ describe 'and doing a setup' do
179
+ it 'performs a checkout of the repository to the target path' do
180
+ run_setup(@args)
181
+ File.exists?(deployed_file('project/README')).should == true
182
+ end
183
+
184
+ it 'runs a deploy:post_setup rake task' do
185
+ run_setup(@args)
186
+ File.read(integration_log).should =~ /Running a post_setup task/
187
+ end
188
+
189
+ it 'reports the remote setup as successful' do
190
+ run_setup(@args)
191
+ File.read(integration_log).should =~ /vagrant => succeeded/
192
+ end
193
+
194
+ it 'exits with a true status' do
195
+ run_setup(@args).should == true
196
+ end
197
+ end
198
+
199
+ describe 'and doing a deploy' do
200
+ before do
201
+ checkout_repo('project', 'post_rake_tasks')
202
+ File.unlink(deployed_file('project/README')) # modify the deployed checkout
203
+ end
204
+
205
+ it 'updates the checkout of the repository on the target path' do
206
+ run_deploy(@args)
207
+ File.exists?(deployed_file('project/README')).should == true
208
+ end
209
+
210
+ it 'runs a deploy:post_deploy rake task' do
211
+ run_deploy(@args)
212
+ File.read(integration_log).should =~ /Running a post_deploy task/
213
+ end
214
+
215
+ it 'reports the remote deployment as successful' do
216
+ run_deploy(@args)
217
+ File.read(integration_log).should =~ /vagrant => succeeded/
218
+ end
219
+
220
+ it 'exits with a true status' do
221
+ run_deploy(@args).should == true
222
+ end
223
+ end
224
+ end
225
+ end
226
+ end