engineyard-serverside 2.6.14 → 2.6.15.alpha1

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 (209) hide show
  1. checksums.yaml +13 -5
  2. data/bin/engineyard-serverside +1 -1
  3. data/lib/engineyard-serverside/cli.rb +4 -225
  4. data/lib/engineyard-serverside/cli/app.rb +136 -0
  5. data/lib/engineyard-serverside/cli/helpers.rb +58 -0
  6. data/lib/engineyard-serverside/cli/server_hash_extractor.rb +49 -0
  7. data/lib/engineyard-serverside/cli/workflows.rb +45 -0
  8. data/lib/engineyard-serverside/cli/workflows/base.rb +78 -0
  9. data/lib/engineyard-serverside/cli/workflows/calling_deploy_hooks.rb +31 -0
  10. data/lib/engineyard-serverside/cli/workflows/deploying_applications.rb +28 -0
  11. data/lib/engineyard-serverside/cli/workflows/disabling_maintenance.rb +29 -0
  12. data/lib/engineyard-serverside/cli/workflows/enabling_maintenance.rb +29 -0
  13. data/lib/engineyard-serverside/cli/workflows/errors.rb +13 -0
  14. data/lib/engineyard-serverside/cli/workflows/helpers.rb +21 -0
  15. data/lib/engineyard-serverside/cli/workflows/integrating_servers.rb +63 -0
  16. data/lib/engineyard-serverside/cli/workflows/restarting_applications.rb +36 -0
  17. data/lib/engineyard-serverside/cli/workflows/rolling_back_applications.rb +28 -0
  18. data/lib/engineyard-serverside/cli/workflows/showing_maintenance_status.rb +28 -0
  19. data/lib/engineyard-serverside/dependency_manager/bundler.rb +43 -14
  20. data/lib/engineyard-serverside/propagator.rb +59 -0
  21. data/lib/engineyard-serverside/rails_assets.rb +5 -2
  22. data/lib/engineyard-serverside/version.rb +1 -1
  23. metadata +66 -394
  24. data/lib/engineyard-serverside/cli_helpers.rb +0 -53
  25. data/spec/archive_deploy_spec.rb +0 -53
  26. data/spec/basic_deploy_spec.rb +0 -26
  27. data/spec/bundler_deploy_spec.rb +0 -139
  28. data/spec/configuration_spec.rb +0 -205
  29. data/spec/custom_deploy_spec.rb +0 -128
  30. data/spec/deploy_hook_spec.rb +0 -362
  31. data/spec/deprecation_spec.rb +0 -23
  32. data/spec/ey_yml_customized_deploy_spec.rb +0 -99
  33. data/spec/fixtures/gitrepo.tar.gz +0 -0
  34. data/spec/fixtures/gitrepo/bar +0 -0
  35. data/spec/fixtures/gitrepo/foo +0 -0
  36. data/spec/fixtures/invalid_hook.rb +0 -1
  37. data/spec/fixtures/lockfiles/0.9-no-bundler +0 -111
  38. data/spec/fixtures/lockfiles/0.9-with-bundler +0 -117
  39. data/spec/fixtures/lockfiles/1.0-no-bundler +0 -54
  40. data/spec/fixtures/lockfiles/1.0.0.rc.1-with-bundler +0 -162
  41. data/spec/fixtures/lockfiles/1.0.18-do_mysql +0 -88
  42. data/spec/fixtures/lockfiles/1.0.18-do_postgres +0 -79
  43. data/spec/fixtures/lockfiles/1.0.18-mysql +0 -43
  44. data/spec/fixtures/lockfiles/1.0.18-mysql2 +0 -43
  45. data/spec/fixtures/lockfiles/1.0.18-pg +0 -43
  46. data/spec/fixtures/lockfiles/1.0.6-no-bundler +0 -51
  47. data/spec/fixtures/lockfiles/1.0.6-with-any-bundler +0 -52
  48. data/spec/fixtures/lockfiles/1.0.6-with-bundler +0 -52
  49. data/spec/fixtures/lockfiles/1.3.1-rails-3.2.13 +0 -112
  50. data/spec/fixtures/lockfiles/not-a-lockfile +0 -1
  51. data/spec/fixtures/repos/assets_detected/Gemfile +0 -5
  52. data/spec/fixtures/repos/assets_detected/Gemfile.lock +0 -88
  53. data/spec/fixtures/repos/assets_detected/README +0 -1
  54. data/spec/fixtures/repos/assets_detected/Rakefile +0 -5
  55. data/spec/fixtures/repos/assets_detected/app/assets/empty +0 -0
  56. data/spec/fixtures/repos/assets_detected/config/application.rb +0 -5
  57. data/spec/fixtures/repos/assets_detected/config/ey.yml +0 -3
  58. data/spec/fixtures/repos/assets_disabled/Gemfile +0 -5
  59. data/spec/fixtures/repos/assets_disabled/Gemfile.lock +0 -88
  60. data/spec/fixtures/repos/assets_disabled/README +0 -1
  61. data/spec/fixtures/repos/assets_disabled/Rakefile +0 -6
  62. data/spec/fixtures/repos/assets_disabled/app/assets/empty +0 -0
  63. data/spec/fixtures/repos/assets_disabled/config/application.rb +0 -5
  64. data/spec/fixtures/repos/assets_disabled/config/ey.yml +0 -3
  65. data/spec/fixtures/repos/assets_disabled_in_ey_yml/Gemfile +0 -5
  66. data/spec/fixtures/repos/assets_disabled_in_ey_yml/Gemfile.lock +0 -88
  67. data/spec/fixtures/repos/assets_disabled_in_ey_yml/README +0 -1
  68. data/spec/fixtures/repos/assets_disabled_in_ey_yml/Rakefile +0 -6
  69. data/spec/fixtures/repos/assets_disabled_in_ey_yml/app/assets/empty +0 -0
  70. data/spec/fixtures/repos/assets_disabled_in_ey_yml/config/application.rb +0 -5
  71. data/spec/fixtures/repos/assets_disabled_in_ey_yml/config/ey.yml +0 -5
  72. data/spec/fixtures/repos/assets_disabled_utf8/Gemfile +0 -5
  73. data/spec/fixtures/repos/assets_disabled_utf8/Gemfile.lock +0 -88
  74. data/spec/fixtures/repos/assets_disabled_utf8/README +0 -3
  75. data/spec/fixtures/repos/assets_disabled_utf8/Rakefile +0 -5
  76. data/spec/fixtures/repos/assets_disabled_utf8/app/assets/empty +0 -0
  77. data/spec/fixtures/repos/assets_disabled_utf8/config/application.rb +0 -7
  78. data/spec/fixtures/repos/assets_disabled_utf8/config/ey.yml +0 -3
  79. data/spec/fixtures/repos/assets_enabled_all/Gemfile +0 -5
  80. data/spec/fixtures/repos/assets_enabled_all/Gemfile.lock +0 -88
  81. data/spec/fixtures/repos/assets_enabled_all/README +0 -1
  82. data/spec/fixtures/repos/assets_enabled_all/app/assets/empty +0 -0
  83. data/spec/fixtures/repos/assets_enabled_all/config/application.rb +0 -5
  84. data/spec/fixtures/repos/assets_enabled_all/config/ey.yml +0 -6
  85. data/spec/fixtures/repos/assets_enabled_all/script/assets +0 -5
  86. data/spec/fixtures/repos/assets_enabled_all/tmp/obstruction +0 -1
  87. data/spec/fixtures/repos/assets_enabled_in_ey_yml/Gemfile +0 -3
  88. data/spec/fixtures/repos/assets_enabled_in_ey_yml/Gemfile.lock +0 -10
  89. data/spec/fixtures/repos/assets_enabled_in_ey_yml/README +0 -1
  90. data/spec/fixtures/repos/assets_enabled_in_ey_yml/Rakefile +0 -8
  91. data/spec/fixtures/repos/assets_enabled_in_ey_yml/config/ey.yml +0 -4
  92. data/spec/fixtures/repos/assets_enabled_util_only/Gemfile +0 -5
  93. data/spec/fixtures/repos/assets_enabled_util_only/Gemfile.lock +0 -88
  94. data/spec/fixtures/repos/assets_enabled_util_only/README +0 -1
  95. data/spec/fixtures/repos/assets_enabled_util_only/Rakefile +0 -6
  96. data/spec/fixtures/repos/assets_enabled_util_only/app/assets/empty +0 -0
  97. data/spec/fixtures/repos/assets_enabled_util_only/config/application.rb +0 -5
  98. data/spec/fixtures/repos/assets_enabled_util_only/config/ey.yml +0 -6
  99. data/spec/fixtures/repos/assets_in_hook/Gemfile +0 -5
  100. data/spec/fixtures/repos/assets_in_hook/Gemfile.lock +0 -88
  101. data/spec/fixtures/repos/assets_in_hook/README +0 -2
  102. data/spec/fixtures/repos/assets_in_hook/Rakefile +0 -5
  103. data/spec/fixtures/repos/assets_in_hook/app/assets/empty +0 -0
  104. data/spec/fixtures/repos/assets_in_hook/config/application.rb +0 -5
  105. data/spec/fixtures/repos/assets_in_hook/config/ey.yml +0 -3
  106. data/spec/fixtures/repos/assets_in_hook/deploy/before_compile_assets.rb +0 -2
  107. data/spec/fixtures/repos/bundle_fails/Gemfile +0 -1
  108. data/spec/fixtures/repos/bundle_fails/README +0 -1
  109. data/spec/fixtures/repos/bundle_fails/deploy/after_bundle.rb +0 -1
  110. data/spec/fixtures/repos/bundler_disabled/Gemfile +0 -4
  111. data/spec/fixtures/repos/bundler_disabled/Gemfile.lock +0 -12
  112. data/spec/fixtures/repos/bundler_disabled/README +0 -1
  113. data/spec/fixtures/repos/bundler_disabled/config/ey.yml +0 -2
  114. data/spec/fixtures/repos/bundler_disabled/deploy/after_bundle.rb +0 -1
  115. data/spec/fixtures/repos/bundler_disabled/deploy/before_bundle.rb +0 -1
  116. data/spec/fixtures/repos/default/Gemfile +0 -4
  117. data/spec/fixtures/repos/default/Gemfile.lock +0 -12
  118. data/spec/fixtures/repos/default/README +0 -5
  119. data/spec/fixtures/repos/default/ey.yml +0 -3
  120. data/spec/fixtures/repos/executable_hooks/README +0 -1
  121. data/spec/fixtures/repos/executable_hooks/deploy/before_restart +0 -72
  122. data/spec/fixtures/repos/executable_hooks_not_executable/README +0 -3
  123. data/spec/fixtures/repos/executable_hooks_not_executable/deploy/before_restart +0 -3
  124. data/spec/fixtures/repos/ey_yml/Gemfile +0 -4
  125. data/spec/fixtures/repos/ey_yml/Gemfile.lock +0 -12
  126. data/spec/fixtures/repos/ey_yml/README +0 -1
  127. data/spec/fixtures/repos/ey_yml/config/ey.yml +0 -18
  128. data/spec/fixtures/repos/ey_yml/deploy/before_migrate.rb +0 -6
  129. data/spec/fixtures/repos/ey_yml_alt/Gemfile +0 -4
  130. data/spec/fixtures/repos/ey_yml_alt/Gemfile.lock +0 -12
  131. data/spec/fixtures/repos/ey_yml_alt/README +0 -1
  132. data/spec/fixtures/repos/ey_yml_alt/deploy/before_migrate.rb +0 -6
  133. data/spec/fixtures/repos/ey_yml_alt/ey.yml +0 -12
  134. data/spec/fixtures/repos/hook_fails/README +0 -1
  135. data/spec/fixtures/repos/hook_fails/deploy/before_deploy.rb +0 -1
  136. data/spec/fixtures/repos/hooks/README +0 -1
  137. data/spec/fixtures/repos/hooks/deploy/after_bundle.rb +0 -1
  138. data/spec/fixtures/repos/hooks/deploy/after_compile_assets.rb +0 -1
  139. data/spec/fixtures/repos/hooks/deploy/after_deploy.rb +0 -1
  140. data/spec/fixtures/repos/hooks/deploy/after_migrate.rb +0 -1
  141. data/spec/fixtures/repos/hooks/deploy/after_restart.rb +0 -1
  142. data/spec/fixtures/repos/hooks/deploy/after_symlink.rb +0 -1
  143. data/spec/fixtures/repos/hooks/deploy/before_bundle.rb +0 -1
  144. data/spec/fixtures/repos/hooks/deploy/before_compile_assets.rb +0 -1
  145. data/spec/fixtures/repos/hooks/deploy/before_deploy.rb +0 -1
  146. data/spec/fixtures/repos/hooks/deploy/before_migrate.rb +0 -1
  147. data/spec/fixtures/repos/hooks/deploy/before_restart.rb +0 -1
  148. data/spec/fixtures/repos/hooks/deploy/before_symlink.rb +0 -1
  149. data/spec/fixtures/repos/multi_dep_manager/README +0 -1
  150. data/spec/fixtures/repos/multi_dep_manager/composer.json +0 -5
  151. data/spec/fixtures/repos/multi_dep_manager/composer.lock +0 -462
  152. data/spec/fixtures/repos/multi_dep_manager/package.json +0 -7
  153. data/spec/fixtures/repos/multi_dep_manager/public/index.php +0 -4
  154. data/spec/fixtures/repos/no_ey_config/Gemfile +0 -3
  155. data/spec/fixtures/repos/no_ey_config/Gemfile.lock +0 -10
  156. data/spec/fixtures/repos/no_ey_config/README +0 -1
  157. data/spec/fixtures/repos/no_ey_config/ey.yml +0 -3
  158. data/spec/fixtures/repos/no_gemfile_lock/Gemfile +0 -4
  159. data/spec/fixtures/repos/no_gemfile_lock/README +0 -1
  160. data/spec/fixtures/repos/no_gemfile_lock/ey.yml +0 -3
  161. data/spec/fixtures/repos/nodejs/README +0 -1
  162. data/spec/fixtures/repos/nodejs/package.json +0 -7
  163. data/spec/fixtures/repos/not_bundled/README +0 -1
  164. data/spec/fixtures/repos/npm_disabled/README +0 -1
  165. data/spec/fixtures/repos/npm_disabled/config/ey.yml +0 -2
  166. data/spec/fixtures/repos/npm_disabled/package.json +0 -7
  167. data/spec/fixtures/repos/php_composer_disabled/README +0 -1
  168. data/spec/fixtures/repos/php_composer_disabled/composer.json +0 -5
  169. data/spec/fixtures/repos/php_composer_disabled/composer.lock +0 -462
  170. data/spec/fixtures/repos/php_composer_disabled/config/ey.yml +0 -2
  171. data/spec/fixtures/repos/php_composer_disabled/public/index.php +0 -4
  172. data/spec/fixtures/repos/php_composer_lock/README +0 -1
  173. data/spec/fixtures/repos/php_composer_lock/composer.json +0 -5
  174. data/spec/fixtures/repos/php_composer_lock/composer.lock +0 -462
  175. data/spec/fixtures/repos/php_composer_lock/public/index.php +0 -4
  176. data/spec/fixtures/repos/php_no_composer_lock/README +0 -1
  177. data/spec/fixtures/repos/php_no_composer_lock/composer.json +0 -21
  178. data/spec/fixtures/repos/php_no_composer_lock/public/index.php +0 -4
  179. data/spec/fixtures/repos/public_system/Gemfile +0 -4
  180. data/spec/fixtures/repos/public_system/Gemfile.lock +0 -12
  181. data/spec/fixtures/repos/public_system/README +0 -5
  182. data/spec/fixtures/repos/public_system/ey.yml +0 -3
  183. data/spec/fixtures/repos/public_system/public/system/cant_touch_this.txt +0 -3
  184. data/spec/fixtures/repos/sqlite3/Gemfile +0 -4
  185. data/spec/fixtures/repos/sqlite3/Gemfile.lock +0 -89
  186. data/spec/fixtures/repos/sqlite3/README +0 -1
  187. data/spec/fixtures/retwisj.war +0 -0
  188. data/spec/fixtures/valid_hook.rb +0 -1
  189. data/spec/git_strategy_spec.rb +0 -34
  190. data/spec/lockfile_parser_spec.rb +0 -122
  191. data/spec/maintenance_spec.rb +0 -44
  192. data/spec/multi_dependency_manager_spec.rb +0 -25
  193. data/spec/nodejs_deploy_spec.rb +0 -30
  194. data/spec/php_deploy_spec.rb +0 -81
  195. data/spec/platform_configure_spec.rb +0 -61
  196. data/spec/rails31_deploy_spec.rb +0 -164
  197. data/spec/restart_spec.rb +0 -43
  198. data/spec/rollback_spec.rb +0 -87
  199. data/spec/server_spec.rb +0 -70
  200. data/spec/services_deploy_spec.rb +0 -153
  201. data/spec/shell_spec.rb +0 -57
  202. data/spec/source/archive_spec.rb +0 -33
  203. data/spec/source/git_spec.rb +0 -44
  204. data/spec/spec_helper.rb +0 -355
  205. data/spec/sqlite3_deploy_spec.rb +0 -38
  206. data/spec/support/integration.rb +0 -103
  207. data/spec/support/source_doubles.rb +0 -28
  208. data/spec/support/timecop.rb +0 -5
  209. data/spec/symlink_spec.rb +0 -15
@@ -1,53 +0,0 @@
1
- module EY
2
- module Serverside
3
- module CLIHelpers
4
- def account_app_env_options
5
- method_option :app, :type => :string,
6
- :required => true,
7
- :desc => "Application to deploy",
8
- :aliases => %w[-a --app-name]
9
- method_option :environment_name, :type => :string,
10
- :required => true,
11
- :desc => "Environment name"
12
- method_option :account_name, :type => :string,
13
- :required => true,
14
- :desc => "Account name"
15
- end
16
-
17
- def framework_env_option
18
- method_option :framework_env, :type => :string,
19
- :required => true,
20
- :desc => "Ruby web framework environment",
21
- :aliases => ["-e"]
22
- end
23
-
24
- def stack_option
25
- method_option :stack, :type => :string,
26
- :desc => "Web stack (so we can restart it correctly)"
27
- end
28
-
29
-
30
- def config_option
31
- method_option :config, :type => :string,
32
- :desc => "Additional configuration"
33
- end
34
-
35
- def instances_options
36
- method_option :instances, :type => :array,
37
- :desc => "Hostnames of instances to deploy to, e.g. --instances localhost app1 app2"
38
- method_option :instance_roles, :type => :hash,
39
- :default => {},
40
- :desc => "Roles of instances, keyed on hostname, comma-separated. e.g. instance1:app_master,etc instance2:db,memcached ..."
41
- method_option :instance_names, :type => :hash,
42
- :default => {},
43
- :desc => "Instance names, keyed on hostname. e.g. instance1:name1 instance2:name2"
44
- end
45
-
46
- def verbose_option
47
- method_option :verbose, :type => :boolean,
48
- :desc => "Verbose output",
49
- :aliases => ["-v"]
50
- end
51
- end
52
- end
53
- end
@@ -1,53 +0,0 @@
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.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
@@ -1,26 +0,0 @@
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
@@ -1,139 +0,0 @@
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
-
6
- context "with a Gemfile.lock" do
7
- before(:all) do
8
- deploy_test_application('ey_yml')
9
- @install_bundler_command = @deployer.commands.grep(/gem install bundler/).first
10
- @bundle_install_command = @deployer.commands.grep(/bundle _#{VERSION_PATTERN}_ install/).first
11
- end
12
-
13
- it "runs the right bundler command" do
14
- expect(@install_bundler_command).not_to be_nil
15
- expect(@install_bundler_command).to match(/install bundler .* -v "#{VERSION_PATTERN}"/)
16
- end
17
-
18
- it "runs 'bundle install' with --deployment" do
19
- expect(@bundle_install_command).not_to be_nil
20
- expect(@bundle_install_command).to include('--deployment')
21
- end
22
-
23
- it "removes bundled_gems directory if the ruby or system version changed" do
24
- should_run_clear_bundle_cmd = @deployer.commands.grep(/diff/).first
25
- expect(should_run_clear_bundle_cmd).not_to be_nil
26
- clear_bundle_cmd = @deployer.commands.grep(/rm -Rf \S+\/bundled_gems/).first
27
- expect(clear_bundle_cmd).not_to be_nil
28
- end
29
-
30
- it "has the binstubs in the path when migrating" do
31
- expect(deploy_dir.join('path-when-migrating').read).to include('ey_bundler_binstubs')
32
- end
33
-
34
- it "creates a ruby version file" do
35
- expect(deploy_dir.join('shared', 'bundled_gems', 'RUBY_VERSION')).to exist
36
- end
37
-
38
- it "creates a system version file" do
39
- expect(deploy_dir.join('shared', 'bundled_gems', 'SYSTEM_VERSION')).to exist
40
- end
41
-
42
- it "generates bundler binstubs" do
43
- pending "doesn't work with mocked bundler"
44
- expect(deploy_dir.join('current', 'ey_bundler_binstubs', 'rake')).to exist
45
- end
46
- end
47
-
48
- context "with clean option" do
49
- before(:all) do
50
- deploy_test_application('ey_yml', 'clean' => true)
51
- end
52
-
53
- it "removes bundled_gems directory if the ruby or system version changed" do
54
- should_run_clear_bundle_cmd = @deployer.commands.grep(/diff/).first
55
- expect(should_run_clear_bundle_cmd).to be_nil
56
- clear_bundle_cmd = @deployer.commands.grep(/rm -Rf \S+\/bundled_gems/).first
57
- expect(clear_bundle_cmd).not_to be_nil
58
- end
59
-
60
- end
61
-
62
- context "with bundler disabled in ey.yml" do
63
- before(:all) do
64
- deploy_test_application('bundler_disabled')
65
- end
66
-
67
- it "does not run bundler commands" do
68
- expect(@deployer.commands.grep(/gem install bundler/)).to be_empty
69
- expect(@deployer.commands.grep(/bundle _.*_ install/)).to be_empty
70
- end
71
-
72
- it "still runs the hooks" do
73
- expect(deploy_dir.join('current', 'before_bundle.ran' )).to exist
74
- expect(deploy_dir.join('current', 'after_bundle.ran' )).to exist
75
- end
76
- end
77
-
78
- context "without a Gemfile.lock" do
79
- before(:all) do
80
- deploy_test_application('no_gemfile_lock')
81
- @install_bundler_command = @deployer.commands.grep(/gem install bundler/).first
82
- @bundle_install_command = @deployer.commands.grep(/bundle _#{VERSION_PATTERN}_ install/).first
83
- end
84
-
85
- it "installs the proper Bundler version" do
86
- expect(@install_bundler_command).not_to be_nil
87
- 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}"/)
88
- end
89
-
90
- it "runs 'bundle install' without --deployment" do
91
- expect(@bundle_install_command).not_to be_nil
92
- expect(@bundle_install_command).not_to match(/--deployment/)
93
- end
94
-
95
- it "exports GIT_SSH for the bundle install" do
96
- expect(@bundle_install_command).to match(/export GIT_SSH/)
97
- end
98
-
99
- it "puts down RUBY_VERSION and SYSTEM_VERSION" do
100
- expect(deploy_dir.join('shared', 'bundled_gems', 'RUBY_VERSION')).to exist
101
- expect(deploy_dir.join('shared', 'bundled_gems', 'SYSTEM_VERSION')).to exist
102
- end
103
-
104
- it "warns that using a lockfile is idiomatic" do
105
- out = read_output
106
- expect(out).to match(/WARNING: Gemfile found but Gemfile.lock is missing!/)
107
- end
108
- end
109
-
110
- context "without a Gemfile.lock and ignoring the warning" do
111
- before(:all) do
112
- deploy_test_application('no_gemfile_lock', 'config' => {'ignore_gemfile_lock_warning' => true})
113
- expect(@config.ignore_gemfile_lock_warning).to be_truthy
114
- @install_bundler_command = @deployer.commands.grep(/gem install bundler/).first
115
- @bundle_install_command = @deployer.commands.grep(/bundle _#{VERSION_PATTERN}_ install/).first
116
- end
117
-
118
- it "should not warn" do
119
- out = read_output
120
- expect(out).not_to match(/WARNING/)
121
- end
122
- end
123
-
124
- context "with a failing Gemfile" do
125
- before(:all) do
126
- begin
127
- deploy_test_application('bundle_fails', 'bundle_install_fails' => true, 'verbose' => false)
128
- rescue EY::Serverside::RemoteFailure
129
- end
130
- end
131
-
132
- it "prints the failure to the log" do
133
- out = read_output
134
- expect(out).to match(%r|bundle install failure|)
135
- expect(deploy_dir.join('current', 'after_bundle.ran' )).not_to exist
136
- end
137
- end
138
- end
139
-
@@ -1,205 +0,0 @@
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