engineyard-serverside 2.3.9 → 2.4.0

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 (42) hide show
  1. checksums.yaml +15 -0
  2. data/bin/engineyard-serverside-execute-hook +31 -0
  3. data/lib/engineyard-serverside/about.rb +3 -0
  4. data/lib/engineyard-serverside/cli.rb +3 -1
  5. data/lib/engineyard-serverside/configuration.rb +5 -0
  6. data/lib/engineyard-serverside/deploy.rb +25 -7
  7. data/lib/engineyard-serverside/maintenance.rb +14 -1
  8. data/lib/engineyard-serverside/paths.rb +4 -0
  9. data/lib/engineyard-serverside/server.rb +3 -2
  10. data/lib/engineyard-serverside/version.rb +1 -1
  11. data/spec/archive_deploy_spec.rb +4 -10
  12. data/spec/basic_deploy_spec.rb +3 -3
  13. data/spec/bundler_deploy_spec.rb +32 -32
  14. data/spec/configuration_spec.rb +42 -42
  15. data/spec/custom_deploy_spec.rb +9 -9
  16. data/spec/deploy_hook_spec.rb +103 -89
  17. data/spec/deprecation_spec.rb +3 -3
  18. data/spec/ey_yml_customized_deploy_spec.rb +21 -21
  19. data/spec/fixtures/repos/executable_hooks/README +1 -0
  20. data/spec/fixtures/repos/executable_hooks/deploy/before_restart +72 -0
  21. data/spec/fixtures/repos/public_system/Gemfile +4 -0
  22. data/spec/fixtures/repos/public_system/Gemfile.lock +12 -0
  23. data/spec/fixtures/repos/public_system/README +5 -0
  24. data/spec/fixtures/repos/public_system/ey.yml +3 -0
  25. data/spec/fixtures/repos/public_system/public/system/cant_touch_this.txt +3 -0
  26. data/spec/lockfile_parser_spec.rb +26 -26
  27. data/spec/multi_dependency_manager_spec.rb +3 -3
  28. data/spec/nodejs_deploy_spec.rb +2 -2
  29. data/spec/php_deploy_spec.rb +7 -7
  30. data/spec/rails31_deploy_spec.rb +56 -56
  31. data/spec/restart_spec.rb +3 -3
  32. data/spec/rollback_spec.rb +19 -19
  33. data/spec/server_spec.rb +16 -16
  34. data/spec/services_deploy_spec.rb +40 -40
  35. data/spec/shell_spec.rb +1 -1
  36. data/spec/source/archive_spec.rb +1 -1
  37. data/spec/source/git_spec.rb +1 -1
  38. data/spec/spec_helper.rb +0 -1
  39. data/spec/sqlite3_deploy_spec.rb +6 -6
  40. data/spec/symlink_spec.rb +15 -0
  41. metadata +139 -154
  42. data/lib/engineyard-serverside/source_strategy.rb +0 -77
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YTE4NmI1MTllMTQ3MzM0MjQ5MmJlYjQ5ZTRhYjA4Y2QwM2E0ZWE0NA==
5
+ data.tar.gz: !binary |-
6
+ MWM0MmQ0YTMxMWRkYzcyZjliZTgwZjI1MGExZTk2ZWY1MWJiMGFkNA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ ZTNiNWE2NTQyOWM0YTUzM2M5MDBjNjVjYTZlYTU5ZmI1NDE1YTNiYTcwMTli
10
+ Y2YwOWU2YzM4ZGU5MjkwMDJjNmFjN2UwNjQzN2I5ODNiMzYwY2YyZmMzNDkx
11
+ NTQxMWQyMjdkZTU5ZDZhNmI4ZTMwMmZlYmYxNzcwZGUwYzI0YWM=
12
+ data.tar.gz: !binary |-
13
+ OWNjOThiOTU1NzNiNjZkNDRlZWM5Y2U3NmE0MWQzMTkwN2U4ODA1MmU0MzBk
14
+ Zjc3Yzc2YTVjZWY2OGM0MDBmZmI2OTNkMmQ0ZDg5MGYyYzhmMDc0NGFlYTE2
15
+ NzgzZjA2YWRmZmUyYjlmYWFhMWZiNWYyOTE4MGJiYWJhNDlhZjY=
@@ -0,0 +1,31 @@
1
+ #!/bin/sh
2
+
3
+ #
4
+ # This script is used to execute non-ruby deploy hooks. It's called from
5
+ # EY::Serverside::Deploy#callback. If you'd like to call it directly you should
6
+ # be careful to replicate everything done in EY::Serverside::Deploy or your
7
+ # hook code may not execute as planned.
8
+ #
9
+
10
+ set -o nounset
11
+
12
+ abort() {
13
+ echo "$*"
14
+ exit 1
15
+ }
16
+
17
+ HOOK=${1:-}
18
+ [ -n "${HOOK}" ] || abort "No hook name provided."
19
+
20
+ # We run all deploy hooks from the root directory of the current release of
21
+ # their app.
22
+ [ -n "${EY_DEPLOY_RELEASE_PATH:-}" ] || abort "EY_DEPLOY_RELEASE_PATH must be set."
23
+ [ -d ${EY_DEPLOY_RELEASE_PATH} ] || abort "EY_DEPLOY_RELEASE_PATH must exist and be a directory"
24
+ cd ${EY_DEPLOY_RELEASE_PATH}
25
+
26
+ # Run the hook.
27
+ _hook_path=deploy/${HOOK}
28
+ if [ ! \( -f ${_hook_path} -a -x ${_hook_path} \) ]; then
29
+ abort "${_hook_path} must exist and be executable"
30
+ fi
31
+ exec ${_hook_path}
@@ -32,6 +32,9 @@ module EY
32
32
  File.expand_path("../../../bin/#{gem_name}", __FILE__)
33
33
  end
34
34
 
35
+ def hook_executor
36
+ binary + "-execute-hook"
37
+ end
35
38
  end
36
39
  end
37
40
  end
@@ -93,6 +93,8 @@ module EY
93
93
  end
94
94
  end
95
95
 
96
+ method_option :ignore_existing, :type => :boolean,
97
+ :desc => "When syncing /data/app directory, don't overwrite destination files"
96
98
  account_app_env_options
97
99
  config_option
98
100
  framework_env_option
@@ -124,7 +126,7 @@ module EY
124
126
 
125
127
  servers.run_for_each! do |server|
126
128
  chown = server.command_on_server('sudo sh -l -c', chown_command)
127
- sync = server.sync_directory_command(app_dir)
129
+ sync = server.sync_directory_command(app_dir, options[:ignore_existing])
128
130
  clean = server.command_on_server('sh -l -c', "rm -rf #{current_app_dir}")
129
131
  "(#{chown}) && (#{sync}) && (#{clean})"
130
132
  end
@@ -241,6 +241,11 @@ module EY
241
241
  )
242
242
  end
243
243
 
244
+ # Use [] to access attributes instead of calling methods so
245
+ # that we get nils instead of NoMethodError.
246
+ #
247
+ # Rollback doesn't know about the repository location (nor
248
+ # should it need to), but it would like to use #short_log_message.
244
249
  def paths
245
250
  @paths ||= Paths.new({
246
251
  :home => configuration['home_path'],
@@ -337,12 +337,13 @@ YML
337
337
  def symlink_tasks
338
338
  [
339
339
  ["Set group write permissions", "chmod -R g+w #{paths.active_release}"],
340
- ["Remove symlinked shared directories", "rm -rf #{paths.active_log} #{paths.public_system} #{paths.active_release}/tmp/pids"],
340
+ ["Remove public/system if symlinked", "if [ -L \"#{paths.public_system}\" ]; then rm -rf #{paths.public_system}; fi"],
341
+ ["Remove symlinked shared directories", "rm -rf #{paths.active_log} #{paths.active_release}/tmp/pids"],
341
342
  ["Create tmp directory", "mkdir -p #{paths.active_release}/tmp"],
342
343
  ["Create public directory", "mkdir -p #{paths.public}"],
343
344
  ["Create config directory", "mkdir -p #{paths.active_release_config}"],
344
345
  ["Symlink shared log directory", "ln -nfs #{paths.shared_log} #{paths.active_log}"],
345
- ["Symlink public system directory", "ln -nfs #{paths.shared_system} #{paths.public_system}"],
346
+ ["Symlink public system directory", "if [ ! -e \"#{paths.public_system}\" ]; then ln -ns #{paths.shared_system} #{paths.public_system}; fi"],
346
347
  ["Symlink shared pids directory", "ln -nfs #{paths.shared}/pids #{paths.active_release}/tmp/pids"],
347
348
  ["Symlink other shared config files", "find #{paths.shared_config} -maxdepth 1 -type f -not -name 'database.yml' -exec ln -s {} #{paths.active_release_config} \\;"],
348
349
  ["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"],
@@ -381,6 +382,7 @@ YML
381
382
 
382
383
  def callback(what)
383
384
  @callbacks_reached ||= true
385
+
384
386
  if paths.deploy_hook(what).exist?
385
387
  shell.status "Running deploy hook: deploy/#{what}.rb"
386
388
  run Escape.shell_command(base_callback_command_for(what)) do |server, cmd|
@@ -390,14 +392,16 @@ YML
390
392
  per_instance_args << '--config' << config.to_json
391
393
  cmd << " " << Escape.shell_command(per_instance_args)
392
394
  end
395
+ elsif paths.executable_deploy_hook(what).executable?
396
+ shell.status "Running deploy hook: deploy/#{what}"
397
+ run [About.hook_executor, what.to_s].join(' ') do |server, cmd|
398
+ cmd = hook_env_vars(server).reject{|k,v| v.nil?}.map{|k,v|
399
+ "#{k}=#{Escape.shell_command([v])}"
400
+ }.join(' ') + ' ' + config.framework_envs + ' ' + cmd
401
+ end
393
402
  end
394
403
  end
395
404
 
396
- # Use [] to access attributes instead of calling methods so
397
- # that we get nils instead of NoMethodError.
398
- #
399
- # Rollback doesn't know about the repository location (nor
400
- # should it need to), but it would like to use #short_log_message.
401
405
  def source
402
406
  ensure_git_ssh_wrapper
403
407
  @source ||= config.source(shell)
@@ -416,6 +420,20 @@ YML
416
420
  cmd
417
421
  end
418
422
 
423
+ def hook_env_vars(server)
424
+ {
425
+ 'EY_DEPLOY_ACCOUNT_NAME' => config.account_name,
426
+ 'EY_DEPLOY_APP' => config.app,
427
+ 'EY_DEPLOY_CONFIG' => config.to_json,
428
+ 'EY_DEPLOY_CURRENT_ROLES' => server.roles.to_a.join(' '),
429
+ 'EY_DEPLOY_CURRENT_NAME' => server.name ? server.name.to_s : nil,
430
+ 'EY_DEPLOY_ENVIRONMENT_NAME' => config.environment_name,
431
+ 'EY_DEPLOY_FRAMEWORK_ENV' => config.framework_env.to_s,
432
+ 'EY_DEPLOY_RELEASE_PATH' => paths.active_release.to_s,
433
+ 'EY_DEPLOY_VERBOSE' => (config.verbose ? '1' : '0'),
434
+ }
435
+ end
436
+
419
437
  # FIXME: Legacy method, warn and remove.
420
438
  def serverside_bin
421
439
  About.binary
@@ -58,8 +58,9 @@ module EY
58
58
 
59
59
  def enable
60
60
  shell.status "Enabling maintenance page."
61
- @up = true
62
61
  run "mkdir -p #{maintenance_page_dirname}"
62
+ public_system_symlink_warning
63
+ @up = true
63
64
  run "cp #{source_path} #{enabled_maintenance_page_pathname}"
64
65
  end
65
66
 
@@ -107,6 +108,18 @@ This application stack does not support no-downtime restarts.
107
108
  end
108
109
  end
109
110
 
111
+ def public_system_symlink_warning
112
+ if paths.public_system.realpath != maintenance_page_dirname.realpath
113
+ shell.warning <<-WARN
114
+ Current repository layout does not allow for maintenance pages!
115
+ Web traffic may still be served to your application.
116
+
117
+ Expected a symlink at #{paths.public_system}
118
+
119
+ To use maintenance pages, remove 'public/system' from your repository.
120
+ WARN
121
+ end
122
+ end
110
123
  end
111
124
  end
112
125
  end
@@ -108,6 +108,10 @@ module EY
108
108
  path(:active_release, 'deploy', "#{hook_name}.rb")
109
109
  end
110
110
 
111
+ def executable_deploy_hook(hook_name)
112
+ path(:active_release, 'deploy', "#{hook_name}")
113
+ end
114
+
111
115
  def repository_cache
112
116
  @repository_cache ||= default_repository_cache
113
117
  end
@@ -34,14 +34,15 @@ module EY
34
34
  hostname == 'localhost'
35
35
  end
36
36
 
37
- def sync_directory_command(directory)
37
+ def sync_directory_command(directory, ignore_existing = false)
38
38
  return nil if local?
39
+ ignore_flag = ignore_existing ? ["--ignore-existing"] : []
39
40
  [
40
41
  remote_command("mkdir -p #{directory}"),
41
42
  # File mod times aren't important during deploy, and
42
43
  # -a (archive mode) sets --times which causes problems.
43
44
  # -a is equivalent to -rlptgoD. We remove the -t, and add -q.
44
- Escape.shell_command(%w[rsync --delete -rlpgoDq -e] + [ssh_command, "#{directory}/", "#{user}@#{hostname}:#{directory}"])
45
+ Escape.shell_command(%w[rsync --delete -rlpgoDq] + ignore_flag + ["-e", ssh_command, "#{directory}/", "#{user}@#{hostname}:#{directory}"])
45
46
  ].join(' && ')
46
47
  end
47
48
 
@@ -1,5 +1,5 @@
1
1
  module EY
2
2
  module Serverside
3
- VERSION = '2.3.9'
3
+ VERSION = '2.4.0'
4
4
  end
5
5
  end
@@ -7,8 +7,9 @@ class EY::Serverside::Source::Archive
7
7
  end
8
8
 
9
9
  describe "Deploying a simple application" do
10
- let(:adapter) {
11
- EY::Serverside::Adapter.new do |args|
10
+
11
+ before(:all) do
12
+ adapter = EY::Serverside::Adapter.new do |args|
12
13
  args.account_name = "account"
13
14
  args.app = "application_name"
14
15
  args.stack = "nginx_unicorn"
@@ -24,13 +25,6 @@ describe "Deploying a simple application" do
24
25
  "group" => GROUP
25
26
  }
26
27
  end
27
- }
28
-
29
- let(:binpath) {
30
- File.expand_path(File.join(File.dirname(__FILE__), '..', 'bin', 'engineyard-serverside'))
31
- }
32
-
33
- before(:all) do
34
28
  argv = adapter.deploy.commands.last.to_argv[2..-1]
35
29
  with_mocked_commands do
36
30
  capture do
@@ -54,7 +48,7 @@ describe "Deploying a simple application" do
54
48
 
55
49
  it "restarts the app servers" do
56
50
  restart = deploy_dir.join('current', 'restart')
57
- restart.should exist
51
+ expect(restart).to exist
58
52
  expect(restart.read.chomp).to eq(%|LANG="en_US.UTF-8" /engineyard/bin/app_application_name deploy|)
59
53
  end
60
54
  end
@@ -7,13 +7,13 @@ describe "Deploying a simple application" do
7
7
  end
8
8
 
9
9
  it "creates a REVISION file" do
10
- deploy_dir.join('current', 'REVISION').should exist
10
+ expect(deploy_dir.join('current', 'REVISION')).to exist
11
11
  end
12
12
 
13
13
  it "restarts the app servers" do
14
14
  restart = deploy_dir.join('current', 'restart')
15
- restart.should exist
16
- restart.read.chomp.should == %|LANG="en_US.UTF-8" /engineyard/bin/app_rails31 deploy|
15
+ expect(restart).to exist
16
+ expect(restart.read.chomp).to eq(%|LANG="en_US.UTF-8" /engineyard/bin/app_rails31 deploy|)
17
17
  end
18
18
  end
19
19
  end
@@ -1,47 +1,47 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe "Deploying an application that uses Bundler" do
4
- let(:version_pattern) { Regexp.quote(::EY::Serverside::DependencyManager::Bundler.default_version) }
4
+ VERSION_PATTERN = Regexp.quote(::EY::Serverside::DependencyManager::Bundler.default_version)
5
5
 
6
6
  context "with a Gemfile.lock" do
7
7
  before(:all) do
8
8
  deploy_test_application('ey_yml')
9
9
  @install_bundler_command = @deployer.commands.grep(/gem install bundler/).first
10
- @bundle_install_command = @deployer.commands.grep(/bundle _#{version_pattern}_ install/).first
10
+ @bundle_install_command = @deployer.commands.grep(/bundle _#{VERSION_PATTERN}_ install/).first
11
11
  end
12
12
 
13
13
  it "runs the right bundler command" do
14
- @install_bundler_command.should_not be_nil
15
- @install_bundler_command.should =~ /install bundler .* -v "#{version_pattern}"/
14
+ expect(@install_bundler_command).not_to be_nil
15
+ expect(@install_bundler_command).to match(/install bundler .* -v "#{VERSION_PATTERN}"/)
16
16
  end
17
17
 
18
18
  it "runs 'bundle install' with --deployment" do
19
- @bundle_install_command.should_not be_nil
20
- @bundle_install_command.should include('--deployment')
19
+ expect(@bundle_install_command).not_to be_nil
20
+ expect(@bundle_install_command).to include('--deployment')
21
21
  end
22
22
 
23
23
  it "removes bundled_gems directory if the ruby or system version changed" do
24
24
  should_run_clear_bundle_cmd = @deployer.commands.grep(/diff/).first
25
- should_run_clear_bundle_cmd.should_not be_nil
25
+ expect(should_run_clear_bundle_cmd).not_to be_nil
26
26
  clear_bundle_cmd = @deployer.commands.grep(/rm -Rf \S+\/bundled_gems/).first
27
- clear_bundle_cmd.should_not be_nil
27
+ expect(clear_bundle_cmd).not_to be_nil
28
28
  end
29
29
 
30
30
  it "has the binstubs in the path when migrating" do
31
- deploy_dir.join('path-when-migrating').read.should include('ey_bundler_binstubs')
31
+ expect(deploy_dir.join('path-when-migrating').read).to include('ey_bundler_binstubs')
32
32
  end
33
33
 
34
34
  it "creates a ruby version file" do
35
- deploy_dir.join('shared', 'bundled_gems', 'RUBY_VERSION').should exist
35
+ expect(deploy_dir.join('shared', 'bundled_gems', 'RUBY_VERSION')).to exist
36
36
  end
37
37
 
38
38
  it "creates a system version file" do
39
- deploy_dir.join('shared', 'bundled_gems', 'SYSTEM_VERSION').should exist
39
+ expect(deploy_dir.join('shared', 'bundled_gems', 'SYSTEM_VERSION')).to exist
40
40
  end
41
41
 
42
42
  it "generates bundler binstubs" do
43
43
  pending "doesn't work with mocked bundler" do
44
- deploy_dir.join('current', 'ey_bundler_binstubs', 'rake').should exist
44
+ expect(deploy_dir.join('current', 'ey_bundler_binstubs', 'rake')).to exist
45
45
  end
46
46
  end
47
47
  end
@@ -53,9 +53,9 @@ describe "Deploying an application that uses Bundler" do
53
53
 
54
54
  it "removes bundled_gems directory if the ruby or system version changed" do
55
55
  should_run_clear_bundle_cmd = @deployer.commands.grep(/diff/).first
56
- should_run_clear_bundle_cmd.should be_nil
56
+ expect(should_run_clear_bundle_cmd).to be_nil
57
57
  clear_bundle_cmd = @deployer.commands.grep(/rm -Rf \S+\/bundled_gems/).first
58
- clear_bundle_cmd.should_not be_nil
58
+ expect(clear_bundle_cmd).not_to be_nil
59
59
  end
60
60
 
61
61
  end
@@ -66,13 +66,13 @@ describe "Deploying an application that uses Bundler" do
66
66
  end
67
67
 
68
68
  it "does not run bundler commands" do
69
- @deployer.commands.grep(/gem install bundler/).should be_empty
70
- @deployer.commands.grep(/bundle _.*_ install/).should be_empty
69
+ expect(@deployer.commands.grep(/gem install bundler/)).to be_empty
70
+ expect(@deployer.commands.grep(/bundle _.*_ install/)).to be_empty
71
71
  end
72
72
 
73
73
  it "still runs the hooks" do
74
- deploy_dir.join('current', 'before_bundle.ran' ).should exist
75
- deploy_dir.join('current', 'after_bundle.ran' ).should exist
74
+ expect(deploy_dir.join('current', 'before_bundle.ran' )).to exist
75
+ expect(deploy_dir.join('current', 'after_bundle.ran' )).to exist
76
76
  end
77
77
  end
78
78
 
@@ -80,45 +80,45 @@ describe "Deploying an application that uses Bundler" do
80
80
  before(:all) do
81
81
  deploy_test_application('no_gemfile_lock')
82
82
  @install_bundler_command = @deployer.commands.grep(/gem install bundler/).first
83
- @bundle_install_command = @deployer.commands.grep(/bundle _#{version_pattern}_ install/).first
83
+ @bundle_install_command = @deployer.commands.grep(/bundle _#{VERSION_PATTERN}_ install/).first
84
84
  end
85
85
 
86
86
  it "installs the proper Bundler version" do
87
- @install_bundler_command.should_not be_nil
88
- @install_bundler_command.should =~ /unset RUBYOPT && gem list bundler | grep "bundler " | egrep -q "#{version_pattern}[,)]" || gem install bundler -q --no-rdoc --no-ri -v "#{version_pattern}"/
87
+ expect(@install_bundler_command).not_to be_nil
88
+ 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}"/)
89
89
  end
90
90
 
91
91
  it "runs 'bundle install' without --deployment" do
92
- @bundle_install_command.should_not be_nil
93
- @bundle_install_command.should_not =~ /--deployment/
92
+ expect(@bundle_install_command).not_to be_nil
93
+ expect(@bundle_install_command).not_to match(/--deployment/)
94
94
  end
95
95
 
96
96
  it "exports GIT_SSH for the bundle install" do
97
- @bundle_install_command.should =~ /export GIT_SSH/
97
+ expect(@bundle_install_command).to match(/export GIT_SSH/)
98
98
  end
99
99
 
100
100
  it "puts down RUBY_VERSION and SYSTEM_VERSION" do
101
- deploy_dir.join('shared', 'bundled_gems', 'RUBY_VERSION').should exist
102
- deploy_dir.join('shared', 'bundled_gems', 'SYSTEM_VERSION').should exist
101
+ expect(deploy_dir.join('shared', 'bundled_gems', 'RUBY_VERSION')).to exist
102
+ expect(deploy_dir.join('shared', 'bundled_gems', 'SYSTEM_VERSION')).to exist
103
103
  end
104
104
 
105
105
  it "warns that using a lockfile is idiomatic" do
106
106
  out = read_output
107
- out.should =~ %r(WARNING: Gemfile found but Gemfile.lock is missing!)
107
+ expect(out).to match(/WARNING: Gemfile found but Gemfile.lock is missing!/)
108
108
  end
109
109
  end
110
110
 
111
111
  context "without a Gemfile.lock and ignoring the warning" do
112
112
  before(:all) do
113
113
  deploy_test_application('no_gemfile_lock', 'config' => {'ignore_gemfile_lock_warning' => true})
114
- @config.ignore_gemfile_lock_warning.should be_true
114
+ expect(@config.ignore_gemfile_lock_warning).to be_true
115
115
  @install_bundler_command = @deployer.commands.grep(/gem install bundler/).first
116
- @bundle_install_command = @deployer.commands.grep(/bundle _#{version_pattern}_ install/).first
116
+ @bundle_install_command = @deployer.commands.grep(/bundle _#{VERSION_PATTERN}_ install/).first
117
117
  end
118
118
 
119
119
  it "should not warn" do
120
120
  out = read_output
121
- out.should_not =~ %r(WARNING)
121
+ expect(out).not_to match(/WARNING/)
122
122
  end
123
123
  end
124
124
 
@@ -132,8 +132,8 @@ describe "Deploying an application that uses Bundler" do
132
132
 
133
133
  it "prints the failure to the log" do
134
134
  out = read_output
135
- out.should =~ %r|bundle install failure|
136
- deploy_dir.join('current', 'after_bundle.ran' ).should_not exist
135
+ expect(out).to match(%r|bundle install failure|)
136
+ expect(deploy_dir.join('current', 'after_bundle.ran' )).not_to exist
137
137
  end
138
138
  end
139
139
  end
@@ -9,31 +9,31 @@ describe EY::Serverside::Deploy::Configuration do
9
9
  'account_name' => 'acc',
10
10
  'framework_env' => 'production',
11
11
  })
12
- @config.app_name.should == "app_name"
13
- @config.environment_name.should == "env_name"
14
- @config.account_name.should == "acc"
15
- @config.migrate.should == nil
16
- @config.migrate?.should == false
17
- @config.branch.should == "master"
18
- @config.maintenance_on_migrate.should == true
19
- @config.maintenance_on_restart.should == true
20
- @config.required_downtime_stack?.should == true
21
- @config.framework_env.should == "production"
22
- @config.precompile_assets.should == "detect"
23
- @config.precompile_assets_inferred?.should == true
24
- @config.skip_precompile_assets?.should == false
25
- @config.precompile_assets?.should == false
26
- @config.asset_roles.should == [:app_master, :app, :solo]
27
- @config.user.should == ENV['USER']
28
- @config.group.should == ENV['USER']
29
- @config.verbose.should == false
30
- @config.copy_exclude.should == []
31
- @config.ignore_database_adapter_warning.should == false
32
- @config.ignore_gemfile_lock_warning.should == false
33
- @config.bundle_without.should == %w[test development]
34
- @config.extra_bundle_install_options.should == %w[--without test development]
35
- @config.deployed_by.should == "Automation (User name not available)"
36
- @config.input_ref.should == @config.branch
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.maintenance_on_migrate).to eq(true)
19
+ expect(@config.maintenance_on_restart).to eq(true)
20
+ expect(@config.required_downtime_stack?).to eq(true)
21
+ expect(@config.framework_env).to eq("production")
22
+ expect(@config.precompile_assets).to eq("detect")
23
+ expect(@config.precompile_assets_inferred?).to eq(true)
24
+ expect(@config.skip_precompile_assets?).to eq(false)
25
+ expect(@config.precompile_assets?).to eq(false)
26
+ expect(@config.asset_roles).to eq([:app_master, :app, :solo])
27
+ expect(@config.user).to eq(ENV['USER'])
28
+ expect(@config.group).to eq(ENV['USER'])
29
+ expect(@config.verbose).to eq(false)
30
+ expect(@config.copy_exclude).to eq([])
31
+ expect(@config.ignore_database_adapter_warning).to eq(false)
32
+ expect(@config.ignore_gemfile_lock_warning).to eq(false)
33
+ expect(@config.bundle_without).to eq(%w[test development])
34
+ expect(@config.extra_bundle_install_options).to eq(%w[--without test development])
35
+ expect(@config.deployed_by).to eq("Automation (User name not available)")
36
+ expect(@config.input_ref).to eq(@config.branch)
37
37
  end
38
38
 
39
39
  it "raises when required options are not given" do
@@ -57,7 +57,7 @@ describe EY::Serverside::Deploy::Configuration do
57
57
  capture do # deprecation warning
58
58
  expect(@config.source(test_shell)).to be_a_kind_of(EY::Serverside::Source::IntegrationSpec)
59
59
  end
60
- read_output.should include("DEPRECATION WARNING: The configuration key 'strategy' is deprecated in favor of 'source_class'.")
60
+ expect(read_output).to include("DEPRECATION WARNING: The configuration key 'strategy' is deprecated in favor of 'source_class'.")
61
61
  end
62
62
 
63
63
  it "uses source_class if set" do
@@ -98,28 +98,28 @@ describe EY::Serverside::Deploy::Configuration do
98
98
  end
99
99
 
100
100
  it "underrides options with config (directly supplied options take precedence over 'config' options)" do
101
- @config.maintenance_on_migrate.should == false
102
- @config.branch.should == "branch_from_command_line"
101
+ expect(@config.maintenance_on_migrate).to eq(false)
102
+ expect(@config.branch).to eq("branch_from_command_line")
103
103
  end
104
104
 
105
105
  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
106
- @config.skip_precompile_assets?.should == true
107
- @config.precompile_assets?.should == false
108
- @config.precompile_assets_inferred?.should == false
106
+ expect(@config.skip_precompile_assets?).to eq(true)
107
+ expect(@config.precompile_assets?).to eq(false)
108
+ expect(@config.precompile_assets_inferred?).to eq(false)
109
109
  end
110
110
 
111
111
  it "doesn't require downtime on restart for nginx_passenger" do
112
- @config.maintenance_on_migrate.should == false
113
- @config.maintenance_on_restart.should == false
112
+ expect(@config.maintenance_on_migrate).to eq(false)
113
+ expect(@config.maintenance_on_restart).to eq(false)
114
114
  end
115
115
 
116
116
  it "doesn't bundle --without the framework_env" do
117
- @config.bundle_without.should == %w[test]
117
+ expect(@config.bundle_without).to eq(%w[test])
118
118
  end
119
119
 
120
120
  it "gets deployed_by and input_ref correct" do
121
- @config.deployed_by.should == "Martin Emde"
122
- @config.input_ref.should == "input_branch"
121
+ expect(@config.deployed_by).to eq("Martin Emde")
122
+ expect(@config.input_ref).to eq("input_branch")
123
123
  end
124
124
  end
125
125
 
@@ -166,37 +166,37 @@ describe EY::Serverside::Deploy::Configuration do
166
166
  it "requires 'ey.yml' and adds any defined methods to the deploy" do
167
167
  write_ey_yml 'ey.yml', @yaml_data
168
168
  @deploy.load_ey_yml
169
- @deploy.config.copy_exclude.should == ['.git']
169
+ expect(@deploy.config.copy_exclude).to eq(['.git'])
170
170
  end
171
171
 
172
172
  it "falls back to 'config/ey.yml'" do
173
173
  write_ey_yml 'config/ey.yml', @yaml_data
174
174
  @deploy.load_ey_yml
175
- @deploy.config.copy_exclude.should == ['.git']
175
+ expect(@deploy.config.copy_exclude).to eq(['.git'])
176
176
  end
177
177
 
178
178
  it "loads at lower priority than command line options" do
179
179
  write_ey_yml 'ey.yml', @yaml_data
180
180
  @deploy.load_ey_yml
181
- @deploy.config.migrate?.should == false
181
+ expect(@deploy.config.migrate?).to eq(false)
182
182
  end
183
183
 
184
184
  it "loads at lower priority than json config option" do
185
185
  write_ey_yml 'ey.yml', @yaml_data
186
186
  @deploy.load_ey_yml
187
- @deploy.config.branch.should == 'branch_from_command_line'
187
+ expect(@deploy.config.branch).to eq('branch_from_command_line')
188
188
  end
189
189
 
190
190
  it "loads bundle_without from the config, which overrides the default" do
191
191
  write_ey_yml 'ey.yml', @yaml_data
192
192
  @deploy.load_ey_yml
193
- @deploy.config.bundle_without.should == 'only test'
193
+ expect(@deploy.config.bundle_without).to eq('only test')
194
194
  end
195
195
 
196
196
  it "overrides boolean ey.yml only options with --conifg strings" do
197
197
  write_ey_yml 'ey.yml', @yaml_data
198
198
  @deploy.load_ey_yml
199
- @deploy.config.should_not be_maintenance_on_migrate
199
+ expect(@deploy.config).not_to be_maintenance_on_migrate
200
200
  end
201
201
  end
202
202
  end