engineyard-serverside 2.6.15.cf2 → 2.6.15.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (192) hide show
  1. checksums.yaml +4 -4
  2. data/lib/engineyard-serverside/deploy.rb +0 -2
  3. data/lib/engineyard-serverside/paths.rb +34 -36
  4. data/lib/engineyard-serverside/version.rb +1 -1
  5. data/spec/archive_deploy_spec.rb +53 -0
  6. data/spec/basic_deploy_spec.rb +26 -0
  7. data/spec/bundler_deploy_spec.rb +160 -0
  8. data/spec/configuration_spec.rb +205 -0
  9. data/spec/custom_deploy_spec.rb +128 -0
  10. data/spec/deploy_hook_spec.rb +362 -0
  11. data/spec/deprecation_spec.rb +23 -0
  12. data/spec/ey_yml_customized_deploy_spec.rb +99 -0
  13. data/spec/fixtures/gitrepo.tar.gz +0 -0
  14. data/spec/fixtures/invalid_hook.rb +1 -0
  15. data/spec/fixtures/lockfiles/0.9-no-bundler +111 -0
  16. data/spec/fixtures/lockfiles/0.9-with-bundler +117 -0
  17. data/spec/fixtures/lockfiles/1.0-no-bundler +54 -0
  18. data/spec/fixtures/lockfiles/1.0.0.rc.1-with-bundler +162 -0
  19. data/spec/fixtures/lockfiles/1.0.18-do_mysql +88 -0
  20. data/spec/fixtures/lockfiles/1.0.18-do_postgres +79 -0
  21. data/spec/fixtures/lockfiles/1.0.18-mysql +43 -0
  22. data/spec/fixtures/lockfiles/1.0.18-mysql2 +43 -0
  23. data/spec/fixtures/lockfiles/1.0.18-pg +43 -0
  24. data/spec/fixtures/lockfiles/1.0.6-no-bundler +51 -0
  25. data/spec/fixtures/lockfiles/1.0.6-with-any-bundler +52 -0
  26. data/spec/fixtures/lockfiles/1.0.6-with-bundler +52 -0
  27. data/spec/fixtures/lockfiles/1.15.1-no-bundler +51 -0
  28. data/spec/fixtures/lockfiles/1.3.1-rails-3.2.13 +112 -0
  29. data/spec/fixtures/lockfiles/not-a-lockfile +1 -0
  30. data/spec/fixtures/repos/assets_detected/Gemfile +5 -0
  31. data/spec/fixtures/repos/assets_detected/Gemfile.lock +88 -0
  32. data/spec/fixtures/repos/assets_detected/README +1 -0
  33. data/spec/fixtures/repos/assets_detected/Rakefile +5 -0
  34. data/spec/fixtures/repos/assets_detected/app/assets/empty +0 -0
  35. data/spec/fixtures/repos/assets_detected/config/application.rb +5 -0
  36. data/spec/fixtures/repos/assets_detected/config/ey.yml +3 -0
  37. data/spec/fixtures/repos/assets_disabled/Gemfile +5 -0
  38. data/spec/fixtures/repos/assets_disabled/Gemfile.lock +88 -0
  39. data/spec/fixtures/repos/assets_disabled/README +1 -0
  40. data/spec/fixtures/repos/assets_disabled/Rakefile +6 -0
  41. data/spec/fixtures/repos/assets_disabled/app/assets/empty +0 -0
  42. data/spec/fixtures/repos/assets_disabled/config/application.rb +5 -0
  43. data/spec/fixtures/repos/assets_disabled/config/ey.yml +3 -0
  44. data/spec/fixtures/repos/assets_disabled_in_ey_yml/Gemfile +5 -0
  45. data/spec/fixtures/repos/assets_disabled_in_ey_yml/Gemfile.lock +88 -0
  46. data/spec/fixtures/repos/assets_disabled_in_ey_yml/README +1 -0
  47. data/spec/fixtures/repos/assets_disabled_in_ey_yml/Rakefile +6 -0
  48. data/spec/fixtures/repos/assets_disabled_in_ey_yml/app/assets/empty +0 -0
  49. data/spec/fixtures/repos/assets_disabled_in_ey_yml/config/application.rb +5 -0
  50. data/spec/fixtures/repos/assets_disabled_in_ey_yml/config/ey.yml +5 -0
  51. data/spec/fixtures/repos/assets_disabled_utf8/Gemfile +5 -0
  52. data/spec/fixtures/repos/assets_disabled_utf8/Gemfile.lock +88 -0
  53. data/spec/fixtures/repos/assets_disabled_utf8/README +3 -0
  54. data/spec/fixtures/repos/assets_disabled_utf8/Rakefile +5 -0
  55. data/spec/fixtures/repos/assets_disabled_utf8/app/assets/empty +0 -0
  56. data/spec/fixtures/repos/assets_disabled_utf8/config/application.rb +7 -0
  57. data/spec/fixtures/repos/assets_disabled_utf8/config/ey.yml +3 -0
  58. data/spec/fixtures/repos/assets_enabled_all/Gemfile +5 -0
  59. data/spec/fixtures/repos/assets_enabled_all/Gemfile.lock +88 -0
  60. data/spec/fixtures/repos/assets_enabled_all/README +1 -0
  61. data/spec/fixtures/repos/assets_enabled_all/app/assets/empty +0 -0
  62. data/spec/fixtures/repos/assets_enabled_all/config/application.rb +5 -0
  63. data/spec/fixtures/repos/assets_enabled_all/config/ey.yml +6 -0
  64. data/spec/fixtures/repos/assets_enabled_all/script/assets +5 -0
  65. data/spec/fixtures/repos/assets_enabled_all/tmp/obstruction +1 -0
  66. data/spec/fixtures/repos/assets_enabled_in_ey_yml/Gemfile +3 -0
  67. data/spec/fixtures/repos/assets_enabled_in_ey_yml/Gemfile.lock +10 -0
  68. data/spec/fixtures/repos/assets_enabled_in_ey_yml/README +1 -0
  69. data/spec/fixtures/repos/assets_enabled_in_ey_yml/Rakefile +8 -0
  70. data/spec/fixtures/repos/assets_enabled_in_ey_yml/config/ey.yml +4 -0
  71. data/spec/fixtures/repos/assets_enabled_util_only/Gemfile +5 -0
  72. data/spec/fixtures/repos/assets_enabled_util_only/Gemfile.lock +88 -0
  73. data/spec/fixtures/repos/assets_enabled_util_only/README +1 -0
  74. data/spec/fixtures/repos/assets_enabled_util_only/Rakefile +6 -0
  75. data/spec/fixtures/repos/assets_enabled_util_only/app/assets/empty +0 -0
  76. data/spec/fixtures/repos/assets_enabled_util_only/config/application.rb +5 -0
  77. data/spec/fixtures/repos/assets_enabled_util_only/config/ey.yml +6 -0
  78. data/spec/fixtures/repos/assets_in_hook/Gemfile +5 -0
  79. data/spec/fixtures/repos/assets_in_hook/Gemfile.lock +88 -0
  80. data/spec/fixtures/repos/assets_in_hook/README +2 -0
  81. data/spec/fixtures/repos/assets_in_hook/Rakefile +5 -0
  82. data/spec/fixtures/repos/assets_in_hook/app/assets/empty +0 -0
  83. data/spec/fixtures/repos/assets_in_hook/config/application.rb +5 -0
  84. data/spec/fixtures/repos/assets_in_hook/config/ey.yml +3 -0
  85. data/spec/fixtures/repos/assets_in_hook/deploy/before_compile_assets.rb +2 -0
  86. data/spec/fixtures/repos/bundle_fails/Gemfile +1 -0
  87. data/spec/fixtures/repos/bundle_fails/README +1 -0
  88. data/spec/fixtures/repos/bundle_fails/deploy/after_bundle.rb +1 -0
  89. data/spec/fixtures/repos/bundler_disabled/Gemfile +4 -0
  90. data/spec/fixtures/repos/bundler_disabled/Gemfile.lock +12 -0
  91. data/spec/fixtures/repos/bundler_disabled/README +1 -0
  92. data/spec/fixtures/repos/bundler_disabled/config/ey.yml +2 -0
  93. data/spec/fixtures/repos/bundler_disabled/deploy/after_bundle.rb +1 -0
  94. data/spec/fixtures/repos/bundler_disabled/deploy/before_bundle.rb +1 -0
  95. data/spec/fixtures/repos/bundler_old/Gemfile +5 -0
  96. data/spec/fixtures/repos/bundler_old/Gemfile.lock +15 -0
  97. data/spec/fixtures/repos/bundler_old/README +1 -0
  98. data/spec/fixtures/repos/default/Gemfile +4 -0
  99. data/spec/fixtures/repos/default/Gemfile.lock +12 -0
  100. data/spec/fixtures/repos/default/README +5 -0
  101. data/spec/fixtures/repos/default/ey.yml +3 -0
  102. data/spec/fixtures/repos/executable_hooks/README +1 -0
  103. data/spec/fixtures/repos/executable_hooks/deploy/before_restart +72 -0
  104. data/spec/fixtures/repos/executable_hooks_not_executable/README +3 -0
  105. data/spec/fixtures/repos/executable_hooks_not_executable/deploy/before_restart +3 -0
  106. data/spec/fixtures/repos/ey_yml/Gemfile +4 -0
  107. data/spec/fixtures/repos/ey_yml/Gemfile.lock +12 -0
  108. data/spec/fixtures/repos/ey_yml/README +1 -0
  109. data/spec/fixtures/repos/ey_yml/config/ey.yml +18 -0
  110. data/spec/fixtures/repos/ey_yml/deploy/before_migrate.rb +6 -0
  111. data/spec/fixtures/repos/ey_yml_alt/Gemfile +4 -0
  112. data/spec/fixtures/repos/ey_yml_alt/Gemfile.lock +12 -0
  113. data/spec/fixtures/repos/ey_yml_alt/README +1 -0
  114. data/spec/fixtures/repos/ey_yml_alt/deploy/before_migrate.rb +6 -0
  115. data/spec/fixtures/repos/ey_yml_alt/ey.yml +12 -0
  116. data/spec/fixtures/repos/hook_fails/README +1 -0
  117. data/spec/fixtures/repos/hook_fails/deploy/before_deploy.rb +1 -0
  118. data/spec/fixtures/repos/hooks/README +1 -0
  119. data/spec/fixtures/repos/hooks/deploy/after_bundle.rb +1 -0
  120. data/spec/fixtures/repos/hooks/deploy/after_compile_assets.rb +1 -0
  121. data/spec/fixtures/repos/hooks/deploy/after_deploy.rb +1 -0
  122. data/spec/fixtures/repos/hooks/deploy/after_migrate.rb +1 -0
  123. data/spec/fixtures/repos/hooks/deploy/after_restart.rb +1 -0
  124. data/spec/fixtures/repos/hooks/deploy/after_symlink.rb +1 -0
  125. data/spec/fixtures/repos/hooks/deploy/before_bundle.rb +1 -0
  126. data/spec/fixtures/repos/hooks/deploy/before_compile_assets.rb +1 -0
  127. data/spec/fixtures/repos/hooks/deploy/before_deploy.rb +1 -0
  128. data/spec/fixtures/repos/hooks/deploy/before_migrate.rb +1 -0
  129. data/spec/fixtures/repos/hooks/deploy/before_restart.rb +1 -0
  130. data/spec/fixtures/repos/hooks/deploy/before_symlink.rb +1 -0
  131. data/spec/fixtures/repos/multi_dep_manager/README +1 -0
  132. data/spec/fixtures/repos/multi_dep_manager/composer.json +5 -0
  133. data/spec/fixtures/repos/multi_dep_manager/composer.lock +462 -0
  134. data/spec/fixtures/repos/multi_dep_manager/package.json +7 -0
  135. data/spec/fixtures/repos/multi_dep_manager/public/index.php +4 -0
  136. data/spec/fixtures/repos/no_ey_config/Gemfile +3 -0
  137. data/spec/fixtures/repos/no_ey_config/Gemfile.lock +10 -0
  138. data/spec/fixtures/repos/no_ey_config/README +1 -0
  139. data/spec/fixtures/repos/no_ey_config/ey.yml +3 -0
  140. data/spec/fixtures/repos/no_gemfile_lock/Gemfile +4 -0
  141. data/spec/fixtures/repos/no_gemfile_lock/README +1 -0
  142. data/spec/fixtures/repos/no_gemfile_lock/ey.yml +3 -0
  143. data/spec/fixtures/repos/nodejs/README +1 -0
  144. data/spec/fixtures/repos/nodejs/package.json +7 -0
  145. data/spec/fixtures/repos/not_bundled/README +1 -0
  146. data/spec/fixtures/repos/npm_disabled/README +1 -0
  147. data/spec/fixtures/repos/npm_disabled/config/ey.yml +2 -0
  148. data/spec/fixtures/repos/npm_disabled/package.json +7 -0
  149. data/spec/fixtures/repos/php_composer_disabled/README +1 -0
  150. data/spec/fixtures/repos/php_composer_disabled/composer.json +5 -0
  151. data/spec/fixtures/repos/php_composer_disabled/composer.lock +462 -0
  152. data/spec/fixtures/repos/php_composer_disabled/config/ey.yml +2 -0
  153. data/spec/fixtures/repos/php_composer_disabled/public/index.php +4 -0
  154. data/spec/fixtures/repos/php_composer_lock/README +1 -0
  155. data/spec/fixtures/repos/php_composer_lock/composer.json +5 -0
  156. data/spec/fixtures/repos/php_composer_lock/composer.lock +462 -0
  157. data/spec/fixtures/repos/php_composer_lock/public/index.php +4 -0
  158. data/spec/fixtures/repos/php_no_composer_lock/README +1 -0
  159. data/spec/fixtures/repos/php_no_composer_lock/composer.json +21 -0
  160. data/spec/fixtures/repos/php_no_composer_lock/public/index.php +4 -0
  161. data/spec/fixtures/repos/public_system/Gemfile +4 -0
  162. data/spec/fixtures/repos/public_system/Gemfile.lock +12 -0
  163. data/spec/fixtures/repos/public_system/README +5 -0
  164. data/spec/fixtures/repos/public_system/ey.yml +3 -0
  165. data/spec/fixtures/repos/public_system/public/system/cant_touch_this.txt +3 -0
  166. data/spec/fixtures/repos/sqlite3/Gemfile +4 -0
  167. data/spec/fixtures/repos/sqlite3/Gemfile.lock +89 -0
  168. data/spec/fixtures/repos/sqlite3/README +1 -0
  169. data/spec/fixtures/retwisj.war +0 -0
  170. data/spec/fixtures/valid_hook.rb +1 -0
  171. data/spec/git_strategy_spec.rb +34 -0
  172. data/spec/lockfile_parser_spec.rb +126 -0
  173. data/spec/maintenance_spec.rb +44 -0
  174. data/spec/multi_dependency_manager_spec.rb +25 -0
  175. data/spec/nodejs_deploy_spec.rb +30 -0
  176. data/spec/php_deploy_spec.rb +81 -0
  177. data/spec/platform_configure_spec.rb +61 -0
  178. data/spec/rails31_deploy_spec.rb +164 -0
  179. data/spec/restart_spec.rb +43 -0
  180. data/spec/rollback_spec.rb +87 -0
  181. data/spec/server_spec.rb +70 -0
  182. data/spec/services_deploy_spec.rb +153 -0
  183. data/spec/shell_spec.rb +57 -0
  184. data/spec/source/archive_spec.rb +33 -0
  185. data/spec/source/git_spec.rb +44 -0
  186. data/spec/spec_helper.rb +360 -0
  187. data/spec/sqlite3_deploy_spec.rb +38 -0
  188. data/spec/support/integration.rb +103 -0
  189. data/spec/support/source_doubles.rb +28 -0
  190. data/spec/support/timecop.rb +5 -0
  191. data/spec/symlink_spec.rb +15 -0
  192. metadata +378 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 41d8c78c4e322a6006fdc34677ce66bb259c4577
4
- data.tar.gz: 70e82e503f7ef72fa9599c7ac49a19d1dd74fe74
3
+ metadata.gz: a1537833680edb3118f7d0644406b9eb6e0cbd24
4
+ data.tar.gz: f2a4296a8b38c79ab19f7b5dacb5b31daa766a4e
5
5
  SHA512:
6
- metadata.gz: 8bb61358af75fa849fe6d4df06ca1f3d465dea4a4919339e8974d42d9e3011e1e20c58e0300ae990e4f491f9d464daa5e3335b2075b1dad7264a849102fc52f4
7
- data.tar.gz: 50b9d919f8a2a4147e2095cf1df12d2d2c31baf813307cdc628de1bb5f5f7907c4b236f8ccd19991510bf376779e03928a4ac2c8db44101e7b959b54d03d6207
6
+ metadata.gz: 337b2ac745429fcbed447bec44ca7dd953a027d41b3adae6b7cd7b9c389479d3e8b4bd2afbcecddcd6d0d39ed15ab69b695283c5a8381427ab1635fbe83e0f99
7
+ data.tar.gz: b127f8500fd9725ee21b73dc568fe8d76908cae8970284248e70ff39c2d571935dcb31321587ba018bbc3edcede3f9aadd9df08184ee1c5ea4d1d6bfe2cbd93c
@@ -418,8 +418,6 @@ defaults:
418
418
  ["Symlink database.yml if needed", "if [ -f \"#{paths.shared_config}/database.yml\" ]; then ln -nfs #{paths.shared_config}/database.yml #{paths.active_release_config}/database.yml; fi"],
419
419
  ["Symlink newrelic.yml if needed", "if [ -f \"#{paths.shared_config}/newrelic.yml\" ]; then ln -nfs #{paths.shared_config}/newrelic.yml #{paths.active_release_config}/newrelic.yml; fi"],
420
420
  ["Symlink mongrel_cluster.yml if needed", "if [ -f \"#{paths.shared_config}/mongrel_cluster.yml\" ]; then ln -nfs #{paths.shared_config}/mongrel_cluster.yml #{paths.active_release_config}/mongrel_cluster.yml; fi"],
421
- ["Create initializers directory", "mkdir -p #{paths.active_release_initializers}"],
422
- ["Symlink cdn.rb initializer if needed", "if [ -f \"#{paths.shared_initializers}/cdn.rb\" ]; then ln -nfs #{paths.shared_initializers}/cdn.rb #{paths.active_release_initializers}/_cdn.rb; fi"],
423
421
  ]
424
422
  end
425
423
 
@@ -59,42 +59,40 @@ module EY
59
59
 
60
60
  attr_reader :home, :deploy_root
61
61
 
62
- def_path :internal_key, [:home, '.ssh', 'internal']
63
-
64
- def_path :current, [:deploy_root, 'current']
65
- def_path :releases, [:deploy_root, 'releases']
66
- def_path :releases_failed, [:deploy_root, 'releases_failed']
67
- def_path :shared, [:deploy_root, 'shared']
68
- def_path :shared_log, [:shared, 'log']
69
- def_path :shared_tmp, [:shared, 'tmp']
70
- def_path :shared_config, [:shared, 'config']
71
- def_path :shared_node_modules, [:shared, 'node_modules']
72
- def_path :shared_system, [:shared, 'system']
73
- def_path :default_repository_cache, [:shared, 'cached-copy']
74
- def_path :enabled_maintenance_page, [:shared_system, 'maintenance.html']
75
- def_path :shared_assets, [:shared, 'assets']
76
- def_path :bundled_gems, [:shared, 'bundled_gems']
77
- def_path :shared_services_yml, [:shared_config, 'ey_services_config_deploy.yml']
78
- def_path :shared_initializers, [:shared_config, 'initializers']
79
- def_path :ruby_version, [:bundled_gems, 'RUBY_VERSION']
80
- def_path :system_version, [:bundled_gems, 'SYSTEM_VERSION']
81
- def_path :latest_revision, [:latest_release, 'REVISION']
82
- def_path :active_revision, [:active_release, 'REVISION']
83
- def_path :binstubs, [:active_release, 'ey_bundler_binstubs']
84
- def_path :gemfile, [:active_release, 'Gemfile']
85
- def_path :gemfile_lock, [:active_release, 'Gemfile.lock']
86
- def_path :public, [:active_release, 'public']
87
- def_path :deploy_hooks, [:active_release, 'deploy']
88
- def_path :public_assets, [:public, 'assets']
89
- def_path :public_system, [:public, 'system']
90
- def_path :package_json, [:active_release, 'package.json']
91
- def_path :composer_json, [:active_release, 'composer.json']
92
- def_path :composer_lock, [:active_release, 'composer.lock']
93
- def_path :active_release_config, [:active_release, 'config']
94
- def_path :active_release_initializers, [:active_release_config, 'initializers']
95
- def_path :active_log, [:active_release, 'log']
96
- def_path :active_node_modules, [:active_release, 'node_modules']
97
- def_path :active_tmp, [:active_release, 'tmp']
62
+ def_path :internal_key, [:home, '.ssh', 'internal']
63
+
64
+ def_path :current, [:deploy_root, 'current']
65
+ def_path :releases, [:deploy_root, 'releases']
66
+ def_path :releases_failed, [:deploy_root, 'releases_failed']
67
+ def_path :shared, [:deploy_root, 'shared']
68
+ def_path :shared_log, [:shared, 'log']
69
+ def_path :shared_tmp, [:shared, 'tmp']
70
+ def_path :shared_config, [:shared, 'config']
71
+ def_path :shared_node_modules, [:shared, 'node_modules']
72
+ def_path :shared_system, [:shared, 'system']
73
+ def_path :default_repository_cache, [:shared, 'cached-copy']
74
+ def_path :enabled_maintenance_page, [:shared_system, 'maintenance.html']
75
+ def_path :shared_assets, [:shared, 'assets']
76
+ def_path :bundled_gems, [:shared, 'bundled_gems']
77
+ def_path :shared_services_yml, [:shared_config, 'ey_services_config_deploy.yml']
78
+ def_path :ruby_version, [:bundled_gems, 'RUBY_VERSION']
79
+ def_path :system_version, [:bundled_gems, 'SYSTEM_VERSION']
80
+ def_path :latest_revision, [:latest_release, 'REVISION']
81
+ def_path :active_revision, [:active_release, 'REVISION']
82
+ def_path :binstubs, [:active_release, 'ey_bundler_binstubs']
83
+ def_path :gemfile, [:active_release, 'Gemfile']
84
+ def_path :gemfile_lock, [:active_release, 'Gemfile.lock']
85
+ def_path :public, [:active_release, 'public']
86
+ def_path :deploy_hooks, [:active_release, 'deploy']
87
+ def_path :public_assets, [:public, 'assets']
88
+ def_path :public_system, [:public, 'system']
89
+ def_path :package_json, [:active_release, 'package.json']
90
+ def_path :composer_json, [:active_release, 'composer.json']
91
+ def_path :composer_lock, [:active_release, 'composer.lock']
92
+ def_path :active_release_config, [:active_release, 'config']
93
+ def_path :active_log, [:active_release, 'log']
94
+ def_path :active_node_modules, [:active_release, 'node_modules']
95
+ def_path :active_tmp, [:active_release, 'tmp']
98
96
 
99
97
  def initialize(opts)
100
98
  @opts = opts
@@ -1,5 +1,5 @@
1
1
  module EY
2
2
  module Serverside
3
- VERSION = '2.6.15.cf2'
3
+ VERSION = '2.6.15.pre'
4
4
  end
5
5
  end
@@ -0,0 +1,53 @@
1
+ require 'spec_helper'
2
+
3
+ class EY::Serverside::Source::Archive
4
+ def fetch_command
5
+ "cp #{uri} #{source_cache}"
6
+ end
7
+ end
8
+
9
+ describe "Deploying a simple application" do
10
+
11
+ before(:all) do
12
+ adapter = EY::Serverside::Adapter.new do |args|
13
+ args.account_name = "account"
14
+ args.app = "application_name"
15
+ args.stack = "nginx_unicorn"
16
+ args.environment_name = "environment_name"
17
+ args.framework_env = "production"
18
+ args.archive = FIXTURES_DIR.join('retwisj.war')
19
+ args.verbose = true
20
+ args.instances = [{ :hostname => "localhost", :roles => ["solo"], :name => "single" }]
21
+ args.serverside_version = Gem::Version.create(EY::Serverside::VERSION.dup).release
22
+ args.config = {
23
+ "deploy_to" => deploy_dir.to_s,
24
+ "group" => GROUP
25
+ }
26
+ end
27
+ argv = adapter.deploy.commands.last.to_argv[2..-1]
28
+ with_mocked_commands do
29
+ capture do
30
+ EY::Serverside::CLI::App.start(argv)
31
+ end
32
+ end
33
+ end
34
+
35
+ it "exploded the war" do
36
+ %w(META-INF WEB-INF).each {|dir|
37
+ File.exists?(deploy_dir.join('current', dir))
38
+ }
39
+ end
40
+
41
+ it "creates a REVISION file" do
42
+ path = deploy_dir.join('current', 'REVISION')
43
+ expect(path).to exist
44
+ checksum = File.read(path).strip
45
+ expect(checksum).to match(/7400dc058376745c11a98f768b799c6651428857\s+.*retwisj.war$/)
46
+ end
47
+
48
+ it "restarts the app servers" do
49
+ restart = deploy_dir.join('current', 'restart')
50
+ expect(restart).to exist
51
+ expect(restart.read.chomp).to eq(%|LANG="en_US.UTF-8" /engineyard/bin/app_application_name deploy|)
52
+ end
53
+ end
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Deploying a simple application" do
4
+ before(:all) do
5
+ deploy_test_application('not_bundled')
6
+ end
7
+
8
+ it "creates a REVISION file" do
9
+ expect(deploy_dir.join('current', 'REVISION')).to exist
10
+ end
11
+
12
+ it "restarts the app servers" do
13
+ restart = deploy_dir.join('current', 'restart')
14
+ expect(restart).to exist
15
+ expect(restart.read.chomp).to eq(%|LANG="en_US.UTF-8" /engineyard/bin/app_rails31 deploy|)
16
+ end
17
+
18
+ it "reuses the same active_release directory if a release_path is specified (such as in integrate)" do
19
+ path = @config.paths.active_release
20
+ expect(path.parent.children.size).to eq(1)
21
+
22
+ redeploy_test_application('config' => {'release_path' => path.to_s})
23
+
24
+ expect(path.parent.children.size).to eq(1)
25
+ end
26
+ end
@@ -0,0 +1,160 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Deploying an application that uses Bundler" do
4
+ VERSION_PATTERN = Regexp.quote(::EY::Serverside::DependencyManager::Bundler.default_version)
5
+ PARALLEL_JOBS = ::EY::Serverside::DependencyManager::Bundler.jobs_number
6
+
7
+ context "with a Gemfile.lock" do
8
+ before(:all) do
9
+ deploy_test_application('ey_yml')
10
+ @install_bundler_command = @deployer.commands.grep(/gem install bundler/).first
11
+ @bundle_install_command = @deployer.commands.grep(/bundle _#{VERSION_PATTERN}_ install/).first
12
+ end
13
+
14
+ it "runs the right bundler command" do
15
+ expect(@install_bundler_command).not_to be_nil
16
+ expect(@install_bundler_command).to match(/install bundler .* -v "#{VERSION_PATTERN}"/)
17
+ end
18
+
19
+ it "runs 'bundle install' with --deployment" do
20
+ expect(@bundle_install_command).not_to be_nil
21
+ expect(@bundle_install_command).to include('--deployment')
22
+ end
23
+
24
+ it "runs 'bundle install' with --jobs #{PARALLEL_JOBS}" do
25
+ expect(@bundle_install_command).not_to be_nil
26
+ expect(@bundle_install_command).to include("--jobs #{PARALLEL_JOBS}")
27
+ end
28
+
29
+ it "removes bundled_gems directory if the ruby or system version changed" do
30
+ should_run_clear_bundle_cmd = @deployer.commands.grep(/diff/).first
31
+ expect(should_run_clear_bundle_cmd).not_to be_nil
32
+ clear_bundle_cmd = @deployer.commands.grep(/rm -Rf \S+\/bundled_gems/).first
33
+ expect(clear_bundle_cmd).not_to be_nil
34
+ end
35
+
36
+ it "has the binstubs in the path when migrating" do
37
+ expect(deploy_dir.join('path-when-migrating').read).to include('ey_bundler_binstubs')
38
+ end
39
+
40
+ it "creates a ruby version file" do
41
+ expect(deploy_dir.join('shared', 'bundled_gems', 'RUBY_VERSION')).to exist
42
+ end
43
+
44
+ it "creates a system version file" do
45
+ expect(deploy_dir.join('shared', 'bundled_gems', 'SYSTEM_VERSION')).to exist
46
+ end
47
+
48
+ it "generates bundler binstubs" do
49
+ pending "doesn't work with mocked bundler"
50
+ expect(deploy_dir.join('current', 'ey_bundler_binstubs', 'rake')).to exist
51
+ end
52
+ end
53
+
54
+ context "with clean option" do
55
+ before(:all) do
56
+ deploy_test_application('ey_yml', 'clean' => true)
57
+ end
58
+
59
+ it "removes bundled_gems directory if the ruby or system version changed" do
60
+ should_run_clear_bundle_cmd = @deployer.commands.grep(/diff/).first
61
+ expect(should_run_clear_bundle_cmd).to be_nil
62
+ clear_bundle_cmd = @deployer.commands.grep(/rm -Rf \S+\/bundled_gems/).first
63
+ expect(clear_bundle_cmd).not_to be_nil
64
+ end
65
+
66
+ end
67
+
68
+ context "with bundler disabled in ey.yml" do
69
+ before(:all) do
70
+ deploy_test_application('bundler_disabled')
71
+ end
72
+
73
+ it "does not run bundler commands" do
74
+ expect(@deployer.commands.grep(/gem install bundler/)).to be_empty
75
+ expect(@deployer.commands.grep(/bundle _.*_ install/)).to be_empty
76
+ end
77
+
78
+ it "still runs the hooks" do
79
+ expect(deploy_dir.join('current', 'before_bundle.ran' )).to exist
80
+ expect(deploy_dir.join('current', 'after_bundle.ran' )).to exist
81
+ end
82
+ end
83
+
84
+ context "without a Gemfile.lock" do
85
+ before(:all) do
86
+ deploy_test_application('no_gemfile_lock')
87
+ @install_bundler_command = @deployer.commands.grep(/gem install bundler/).first
88
+ @bundle_install_command = @deployer.commands.grep(/bundle _#{VERSION_PATTERN}_ install/).first
89
+ end
90
+
91
+ it "installs the proper Bundler version" do
92
+ expect(@install_bundler_command).not_to be_nil
93
+ expect(@install_bundler_command).to match(/unset RUBYOPT && gem list bundler | grep "bundler " | egrep -q "#{VERSION_PATTERN}[,)]" || gem install bundler -q --no-rdoc --no-ri -v "#{VERSION_PATTERN}"/)
94
+ end
95
+
96
+ it "runs 'bundle install' without --deployment" do
97
+ expect(@bundle_install_command).not_to be_nil
98
+ expect(@bundle_install_command).not_to match(/--deployment/)
99
+ end
100
+
101
+ it "runs 'bundle install' with --jobs #{PARALLEL_JOBS}" do
102
+ expect(@bundle_install_command).not_to be_nil
103
+ expect(@bundle_install_command).to include("--jobs #{PARALLEL_JOBS}")
104
+ end
105
+
106
+ it "exports GIT_SSH for the bundle install" do
107
+ expect(@bundle_install_command).to match(/export GIT_SSH/)
108
+ end
109
+
110
+ it "puts down RUBY_VERSION and SYSTEM_VERSION" do
111
+ expect(deploy_dir.join('shared', 'bundled_gems', 'RUBY_VERSION')).to exist
112
+ expect(deploy_dir.join('shared', 'bundled_gems', 'SYSTEM_VERSION')).to exist
113
+ end
114
+
115
+ it "warns that using a lockfile is idiomatic" do
116
+ out = read_output
117
+ expect(out).to match(/WARNING: Gemfile found but Gemfile.lock is missing!/)
118
+ end
119
+ end
120
+
121
+ context "without a Gemfile.lock and ignoring the warning" do
122
+ before(:all) do
123
+ deploy_test_application('no_gemfile_lock', 'config' => {'ignore_gemfile_lock_warning' => true})
124
+ expect(@config.ignore_gemfile_lock_warning).to be_truthy
125
+ @install_bundler_command = @deployer.commands.grep(/gem install bundler/).first
126
+ @bundle_install_command = @deployer.commands.grep(/bundle _#{VERSION_PATTERN}_ install/).first
127
+ end
128
+
129
+ it "should not warn" do
130
+ out = read_output
131
+ expect(out).not_to match(/WARNING/)
132
+ end
133
+ end
134
+
135
+ context "with a failing Gemfile" do
136
+ before(:all) do
137
+ begin
138
+ deploy_test_application('bundle_fails', 'bundle_install_fails' => true, 'verbose' => false)
139
+ rescue EY::Serverside::RemoteFailure
140
+ end
141
+ end
142
+
143
+ it "prints the failure to the log" do
144
+ out = read_output
145
+ expect(out).to match(%r|bundle install failure|)
146
+ expect(deploy_dir.join('current', 'after_bundle.ran' )).not_to exist
147
+ end
148
+ end
149
+
150
+ context "with outdated bundler" do
151
+ before :all do
152
+ deploy_test_application( "bundler_old" )
153
+ @bundle_install_command = @deployer.commands.grep( /bundle _1.3.6_ install/ ).first
154
+ end
155
+
156
+ it "doesn't run 'bundle install' with --jobs" do
157
+ expect( @bundle_install_command ).to_not include "--jobs"
158
+ end
159
+ end
160
+ end
@@ -0,0 +1,205 @@
1
+ require 'spec_helper'
2
+
3
+ describe EY::Serverside::Deploy::Configuration do
4
+ describe "default options" do
5
+ it "has defaults" do
6
+ @config = EY::Serverside::Deploy::Configuration.new({
7
+ 'app' => 'app_name',
8
+ 'environment_name' => 'env_name',
9
+ 'account_name' => 'acc',
10
+ 'framework_env' => 'production',
11
+ })
12
+ expect(@config.app_name).to eq("app_name")
13
+ expect(@config.environment_name).to eq("env_name")
14
+ expect(@config.account_name).to eq("acc")
15
+ expect(@config.migrate).to eq(nil)
16
+ expect(@config.migrate?).to eq(false)
17
+ expect(@config.branch).to eq("master")
18
+ expect(@config.ref).to eq("master")
19
+ expect(@config.maintenance_on_migrate).to eq(true)
20
+ expect(@config.maintenance_on_restart).to eq(true)
21
+ expect(@config.required_downtime_stack?).to eq(true)
22
+ expect(@config.framework_env).to eq("production")
23
+ expect(@config.precompile_assets).to eq("detect")
24
+ expect(@config.precompile_assets_inferred?).to eq(true)
25
+ expect(@config.skip_precompile_assets?).to eq(false)
26
+ expect(@config.precompile_assets?).to eq(false)
27
+ expect(@config.asset_roles).to eq([:app_master, :app, :solo])
28
+ expect(@config.user).to eq(ENV['USER'])
29
+ expect(@config.group).to eq(ENV['USER'])
30
+ expect(@config.verbose).to eq(false)
31
+ expect(@config.copy_exclude).to eq([])
32
+ expect(@config.ignore_database_adapter_warning).to eq(false)
33
+ expect(@config.ignore_gemfile_lock_warning).to eq(false)
34
+ expect(@config.bundle_without).to eq(%w[test development])
35
+ expect(@config.extra_bundle_install_options).to eq(%w[--without test development])
36
+ expect(@config.deployed_by).to eq("Automation (User name not available)")
37
+ expect(@config.input_ref).to eq(@config.branch)
38
+ expect(@config.keep_releases).to eq(3)
39
+ expect(@config.keep_failed_releases).to eq(3)
40
+ end
41
+
42
+ it "raises when required options are not given" do
43
+ @config = EY::Serverside::Deploy::Configuration.new({})
44
+ expect { @config.app_name }.to raise_error
45
+ expect { @config.environment_name }.to raise_error
46
+ expect { @config.account_name }.to raise_error
47
+ expect { @config.framework_env }.to raise_error
48
+ end
49
+ end
50
+
51
+ context "strategies" do
52
+ let(:options) do
53
+ { "app" => "serverside" }
54
+ end
55
+
56
+ it "uses strategy if set" do
57
+ @config = EY::Serverside::Deploy::Configuration.new(
58
+ options.merge({'strategy' => 'IntegrationSpec', 'git' => 'git@github.com:engineyard/todo.git'})
59
+ )
60
+ capture do # deprecation warning
61
+ expect(@config.source(test_shell)).to be_a_kind_of(EY::Serverside::Source::IntegrationSpec)
62
+ end
63
+ expect(read_output).to include("DEPRECATION WARNING: The configuration key 'strategy' is deprecated in favor of 'source_class'.")
64
+ end
65
+
66
+ it "uses source_class if set" do
67
+ @config = EY::Serverside::Deploy::Configuration.new(
68
+ options.merge({'source_class' => 'IntegrationSpec', 'git' => 'git@github.com:engineyard/todo.git'})
69
+ )
70
+ expect(@config.source(test_shell)).to be_a_kind_of(EY::Serverside::Source::IntegrationSpec)
71
+ end
72
+
73
+ it "infers a git source" do
74
+ @config = EY::Serverside::Deploy::Configuration.new(
75
+ options.merge({ 'git' => 'git@github.com:engineyard/todo.git' })
76
+ )
77
+ expect(@config.source(test_shell)).to be_a_kind_of(EY::Serverside::Source::Git)
78
+ end
79
+
80
+ it "infers a archive source" do
81
+ @config = EY::Serverside::Deploy::Configuration.new(
82
+ options.merge({'archive' => 'https://github.com/engineyard/todo/archive/master.zip'})
83
+ )
84
+
85
+ expect(@config.source(test_shell)).to be_a_kind_of(EY::Serverside::Source::Archive)
86
+ end
87
+ end
88
+
89
+ context "command line options" do
90
+ before do
91
+ @config = EY::Serverside::Deploy::Configuration.new({
92
+ 'repository_cache' => @tempdir,
93
+ 'app' => 'app_name',
94
+ 'stack' => 'nginx_passenger',
95
+ 'framework_env' => 'development',
96
+ 'environment_name' => 'env_name',
97
+ 'account_name' => 'acc',
98
+ 'branch' => 'branch_from_command_line',
99
+ 'config' => MultiJson.dump({'custom' => 'custom_from_extra_config', 'maintenance_on_migrate' => 'false', 'precompile_assets' => 'false', 'deployed_by' => 'Martin Emde', 'input_ref' => 'input_branch'})
100
+ })
101
+ end
102
+
103
+ it "underrides options with config (directly supplied options take precedence over 'config' options)" do
104
+ expect(@config.maintenance_on_migrate).to eq(false)
105
+ expect(@config.branch).to eq("branch_from_command_line")
106
+ end
107
+
108
+ it "corrects command line supplied precompile_assets string (which relies on having a special not-set value of nil, so can't be a boolean)" do
109
+ expect(@config.skip_precompile_assets?).to eq(true)
110
+ expect(@config.precompile_assets?).to eq(false)
111
+ expect(@config.precompile_assets_inferred?).to eq(false)
112
+ end
113
+
114
+ it "doesn't require downtime on restart for nginx_passenger" do
115
+ expect(@config.maintenance_on_migrate).to eq(false)
116
+ expect(@config.maintenance_on_restart).to eq(false)
117
+ end
118
+
119
+ it "doesn't bundle --without the framework_env" do
120
+ expect(@config.bundle_without).to eq(%w[test])
121
+ end
122
+
123
+ it "gets deployed_by and input_ref correct" do
124
+ expect(@config.deployed_by).to eq("Martin Emde")
125
+ expect(@config.input_ref).to eq("input_branch")
126
+ end
127
+ end
128
+
129
+ describe "ey.yml loading" do
130
+ before(:each) do
131
+ @tempdir = `mktemp -d -t ey_yml_spec.XXXXX`.strip
132
+ @config = EY::Serverside::Deploy::Configuration.new({
133
+ 'repository_cache' => @tempdir,
134
+ 'app' => 'app_name',
135
+ 'environment_name' => 'env_name',
136
+ 'account_name' => 'acc',
137
+ 'migrate' => nil,
138
+ 'branch' => 'branch_from_command_line',
139
+ 'config' => MultiJson.dump({'custom' => 'custom_from_extra_config', 'maintenance_on_migrate' => 'false'})
140
+ })
141
+
142
+ @deploy = FullTestDeploy.new(test_servers, @config, test_shell)
143
+
144
+ @yaml_data = {
145
+ 'environments' => {
146
+ 'env_name' => {
147
+ 'copy_exclude' => ['.git'],
148
+ 'migrate' => true,
149
+ 'migration_command' => 'uh oh',
150
+ 'branch' => 'branch_from_ey_yml',
151
+ 'custom' => 'custom_from_ey_yml',
152
+ 'bundle_without' => 'only test',
153
+ 'maintenance_on_migrate' => true,
154
+ }
155
+ }
156
+ }
157
+ end
158
+
159
+ def write_ey_yml(relative_path, data)
160
+ FileUtils.mkdir_p(File.join(
161
+ @tempdir,
162
+ File.dirname(relative_path)))
163
+
164
+ File.open(File.join(@tempdir, relative_path), 'w') do |f|
165
+ f.write data.to_yaml
166
+ end
167
+ end
168
+
169
+ it "requires 'ey.yml' and adds any defined methods to the deploy" do
170
+ write_ey_yml 'ey.yml', @yaml_data
171
+ @deploy.load_ey_yml
172
+ expect(@deploy.config.copy_exclude).to eq(['.git'])
173
+ end
174
+
175
+ it "falls back to 'config/ey.yml'" do
176
+ write_ey_yml 'config/ey.yml', @yaml_data
177
+ @deploy.load_ey_yml
178
+ expect(@deploy.config.copy_exclude).to eq(['.git'])
179
+ end
180
+
181
+ it "loads at lower priority than command line options" do
182
+ write_ey_yml 'ey.yml', @yaml_data
183
+ @deploy.load_ey_yml
184
+ expect(@deploy.config.migrate?).to eq(false)
185
+ end
186
+
187
+ it "loads at lower priority than json config option" do
188
+ write_ey_yml 'ey.yml', @yaml_data
189
+ @deploy.load_ey_yml
190
+ expect(@deploy.config.branch).to eq('branch_from_command_line')
191
+ end
192
+
193
+ it "loads bundle_without from the config, which overrides the default" do
194
+ write_ey_yml 'ey.yml', @yaml_data
195
+ @deploy.load_ey_yml
196
+ expect(@deploy.config.bundle_without).to eq('only test')
197
+ end
198
+
199
+ it "overrides boolean ey.yml only options with --conifg strings" do
200
+ write_ey_yml 'ey.yml', @yaml_data
201
+ @deploy.load_ey_yml
202
+ expect(@deploy.config).not_to be_maintenance_on_migrate
203
+ end
204
+ end
205
+ end