engineyard-serverside 2.3.9 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
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 @@
1
+ Use an executable file for a hook, not a ruby one that uses the hook API.
@@ -0,0 +1,72 @@
1
+ #!/bin/sh
2
+
3
+ _TEST_NUMBER=1
4
+ _FAILED=0
5
+
6
+ run_tests() {
7
+ local _env_var
8
+
9
+ expect_env EY_DEPLOY_ACCOUNT_NAME acc
10
+ expect_env EY_DEPLOY_APP rails31
11
+ expect_env EY_DEPLOY_ENVIRONMENT_NAME env
12
+ expect_env EY_DEPLOY_FRAMEWORK_ENV staging
13
+ expect_env MERB_ENV staging
14
+ expect_env NODE_ENV staging
15
+ expect_env RACK_ENV staging
16
+ expect_env RAILS_ENV staging
17
+ for _env_var in EY_DEPLOY_CONFIG EY_DEPLOY_RELEASE_PATH EY_DEPLOY_VERBOSE; do
18
+ expect_env ${_env_var}
19
+ done
20
+
21
+ check_working_directory ${EY_DEPLOY_RELEASE_PATH}
22
+ }
23
+
24
+ ok() {
25
+ echo "ok ${_TEST_NUMBER} $*"
26
+ _TEST_NUMBER=$((${_TEST_NUMBER} + 1))
27
+ }
28
+
29
+ not_ok() {
30
+ echo "not ok ${_TEST_NUMBER} $*"
31
+ _FAILED=1
32
+ _TEST_NUMBER=$((${_TEST_NUMBER} + 1))
33
+ }
34
+
35
+ check_working_directory() {
36
+ local _dir=$1
37
+
38
+ if [ $(pwd) = ${_dir} ]; then
39
+ ok "Working directory is correct"
40
+ else
41
+ not_ok "Working directory is correct"
42
+ fi
43
+ }
44
+
45
+ expect_env() {
46
+ local _name=$1
47
+ local _value=${2:-}
48
+ local _var
49
+ local _test_name
50
+
51
+ _test_name="ENV[${_name}]"
52
+ if [ -n "${_value}" ]; then
53
+ _test_name="${_test_name}=${_value}"
54
+ else
55
+ _test_name="${_test_name} should be set"
56
+ fi
57
+
58
+ eval "_var=\$${_name}"
59
+ if [ -n "${_var}" ]; then
60
+ if [ -n "${_value}" -a "${_var}" != "${_value}" ]; then
61
+ not_ok ${_test_name}
62
+ else
63
+ ok ${_test_name}
64
+ fi
65
+ else
66
+ not_ok ${_test_name}
67
+ fi
68
+ }
69
+
70
+ run_tests
71
+ touch 'before_restart.ran'
72
+ exit ${_FAILED}
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rake'
4
+ gem 'ey_config'
@@ -0,0 +1,12 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ ey_config (0.0.5)
5
+ rake (0.9.2.2)
6
+
7
+ PLATFORMS
8
+ ruby
9
+
10
+ DEPENDENCIES
11
+ ey_config
12
+ rake
@@ -0,0 +1,5 @@
1
+ This is a simple bundled fake app for specs.
2
+
3
+ All the files in this directory are copied into a temporary git repository
4
+ during spec runs. The rest of the "git repository" stuff comes from
5
+ gitrepo.tar.gz which is copied first to create the repo.
@@ -0,0 +1,3 @@
1
+ environments:
2
+ env:
3
+ ignore_database_adapter_warning: true
@@ -0,0 +1,3 @@
1
+ This file should not be removed by serverside during a deploy.
2
+
3
+ If public/system exists in the repository, leave it alone and warn.
@@ -14,72 +14,72 @@ describe "the bundler version retrieved from the lockfile" do
14
14
  end
15
15
 
16
16
  it "raises an error with pre 0.9 bundler lockfiles" do
17
- lambda { get_version('0.9-no-bundler') }.should raise_error(RuntimeError, /Malformed or pre bundler-1.0.0 Gemfile.lock/)
18
- lambda { get_version('0.9-with-bundler') }.should raise_error(RuntimeError, /Malformed or pre bundler-1.0.0 Gemfile.lock/)
17
+ expect { get_version('0.9-no-bundler') }.to raise_error(RuntimeError, /Malformed or pre bundler-1.0.0 Gemfile.lock/)
18
+ expect { get_version('0.9-with-bundler') }.to raise_error(RuntimeError, /Malformed or pre bundler-1.0.0 Gemfile.lock/)
19
19
  end
20
20
 
21
21
  it "has a default version" do
22
- EY::Serverside::DependencyManager::Bundler.default_version.should_not be_nil
23
- EY::Serverside::DependencyManager::Bundler::DEFAULT_VERSION.should_not be_nil
22
+ expect(EY::Serverside::DependencyManager::Bundler.default_version).not_to be_nil
23
+ expect(EY::Serverside::DependencyManager::Bundler::DEFAULT_VERSION).not_to be_nil
24
24
  end
25
25
 
26
26
  it "returns the default version for a 1.0 lockfile without a bundler dependency" do
27
- get_version('1.0-no-bundler').should == EY::Serverside::DependencyManager::Bundler.default_version
27
+ expect(get_version('1.0-no-bundler')).to eq(EY::Serverside::DependencyManager::Bundler.default_version)
28
28
  end
29
29
 
30
30
  it "gets the version from a 1.0.0.rc.1 lockfile w/dependency on 1.0.0.rc.1" do
31
- get_version('1.0.0.rc.1-with-bundler').should == '1.0.0.rc.1'
31
+ expect(get_version('1.0.0.rc.1-with-bundler')).to eq('1.0.0.rc.1')
32
32
  end
33
33
 
34
34
  it "gets the version from a 1.0.6 lockfile w/dependency on 1.0.6" do
35
- get_version('1.0.6-with-bundler').should == '1.0.6'
35
+ expect(get_version('1.0.6-with-bundler')).to eq('1.0.6')
36
36
  end
37
37
 
38
38
  it "gets the version from a 1.0.6 lockfile w/dependency on 1.0.6 (bundled ~> 1.0.0)" do
39
- get_version('1.0.6-with-any-bundler').should == '1.0.6'
39
+ expect(get_version('1.0.6-with-any-bundler')).to eq('1.0.6')
40
40
  end
41
41
 
42
42
  it "gets the version from a 1.0.6 lockfile w/o dependency" do
43
- get_version('1.0.6-no-bundler').should == '1.0.6'
43
+ expect(get_version('1.0.6-no-bundler')).to eq('1.0.6')
44
44
  end
45
45
 
46
46
  it "raises an error if it can't parse the file" do
47
- lambda { get_version('not-a-lockfile') }.should raise_error(RuntimeError, /Malformed or pre bundler-1.0.0 Gemfile.lock/)
47
+ expect { get_version('not-a-lockfile') }.to raise_error(RuntimeError, /Malformed or pre bundler-1.0.0 Gemfile.lock/)
48
48
  end
49
49
 
50
50
  context "rails version" do
51
51
  it "retrieves rails version" do
52
- get_parser('1.3.1-rails-3.2.13').rails_version.should == "3.2.13"
52
+ expect(get_parser('1.3.1-rails-3.2.13').rails_version).to eq("3.2.13")
53
53
  end
54
54
 
55
55
  it "finds no rails version" do
56
- get_parser('1.0.18-mysql2').rails_version.should == nil
56
+ expect(get_parser('1.0.18-mysql2').rails_version).to eq(nil)
57
57
  end
58
58
  end
59
59
 
60
60
  context "checking for gems in the dependencies" do
61
61
  it "does not have any database adapters in a gemfile lock without them" do
62
- get_parser('1.0.6-no-bundler').any_database_adapter?.should be_false
62
+ expect(get_parser('1.0.6-no-bundler').any_database_adapter?).to be_false
63
63
  end
64
64
 
65
65
  it "has a database adapter in a Gemfile.lock with do_mysql" do
66
- get_parser('1.0.18-do_mysql').any_database_adapter?.should be_true
66
+ expect(get_parser('1.0.18-do_mysql').any_database_adapter?).to be_true
67
67
  end
68
68
 
69
69
  it "has a database adapter in a Gemfile.lock with mysql" do
70
- get_parser('1.0.18-mysql').any_database_adapter?.should be_true
70
+ expect(get_parser('1.0.18-mysql').any_database_adapter?).to be_true
71
71
  end
72
72
 
73
73
  it "has a database adapter in a Gemfile.lock with mysql2" do
74
- get_parser('1.0.18-mysql2').any_database_adapter?.should be_true
74
+ expect(get_parser('1.0.18-mysql2').any_database_adapter?).to be_true
75
75
  end
76
76
 
77
77
  it "has a database adapter in a Gemfile.lock with pg" do
78
- get_parser('1.0.18-pg').any_database_adapter?.should be_true
78
+ expect(get_parser('1.0.18-pg').any_database_adapter?).to be_true
79
79
  end
80
80
 
81
81
  it "has a database adapter in a Gemfile.lock with do_postgres" do
82
- get_parser('1.0.18-do_postgres').any_database_adapter?.should be_true
82
+ expect(get_parser('1.0.18-do_postgres').any_database_adapter?).to be_true
83
83
  end
84
84
  end
85
85
 
@@ -87,36 +87,36 @@ describe "the bundler version retrieved from the lockfile" do
87
87
  subject { get_parser('1.0.6-no-bundler') }
88
88
 
89
89
  it "uses the default version when there is no bundler version" do
90
- subject.fetch_version(nil, nil).should == EY::Serverside::DependencyManager::Bundler.default_version
90
+ expect(subject.fetch_version(nil, nil)).to eq(EY::Serverside::DependencyManager::Bundler.default_version)
91
91
  end
92
92
 
93
93
  it "uses the given version when there is no operator" do
94
- subject.fetch_version(nil, '1.0.1').should == '1.0.1'
94
+ expect(subject.fetch_version(nil, '1.0.1')).to eq('1.0.1')
95
95
  end
96
96
 
97
97
  it "uses the given version when the qualifier is `='" do
98
- subject.fetch_version('=', '1.0.1').should == '1.0.1'
98
+ expect(subject.fetch_version('=', '1.0.1')).to eq('1.0.1')
99
99
  end
100
100
 
101
101
  it "uses the default version when we get a pessimistic qualifier and is lower than the default version" do
102
- subject.fetch_version('~>', '1.3.1').should == EY::Serverside::DependencyManager::Bundler.default_version
102
+ expect(subject.fetch_version('~>', '1.3.1')).to eq(EY::Serverside::DependencyManager::Bundler.default_version)
103
103
  end
104
104
 
105
105
  it "uses the given version when we get a pessimistic qualifier that doesn't match the default version" do
106
- subject.fetch_version('~>', '1.0.0').should == '1.0.0'
106
+ expect(subject.fetch_version('~>', '1.0.0')).to eq('1.0.0')
107
107
  end
108
108
 
109
109
  it "uses the given version when it's geater of equal than the default version" do
110
- subject.fetch_version('>=', '1.100.0').should == '1.100.0'
110
+ expect(subject.fetch_version('>=', '1.100.0')).to eq('1.100.0')
111
111
  end
112
112
 
113
113
  it "uses the default version when the given version is lower" do
114
- subject.fetch_version('>=', '1.0.1').should == EY::Serverside::DependencyManager::Bundler.default_version
114
+ expect(subject.fetch_version('>=', '1.0.1')).to eq(EY::Serverside::DependencyManager::Bundler.default_version)
115
115
  end
116
116
 
117
117
  it "selects only the first version expression" do
118
118
  scan = subject.scan_gem('bundler', 'bundler (>=1.0.1, <2.0.0)')
119
- scan.last.should == '1.0.1'
119
+ expect(scan.last).to eq('1.0.1')
120
120
  end
121
121
  end
122
122
  end
@@ -12,13 +12,13 @@ describe "Deploying an application that uses Node.js and NPM" do
12
12
 
13
13
  it "runs 'npm install' and 'composer install'" do
14
14
  npm_cmd = @deployer.commands.grep(/npm install/).first
15
- npm_cmd.should_not be_nil
15
+ expect(npm_cmd).not_to be_nil
16
16
 
17
17
  update_cmd = @deployer.commands.grep(/composer.*self-update/).first
18
- update_cmd.should_not be_nil
18
+ expect(update_cmd).not_to be_nil
19
19
 
20
20
  composer_cmd = @deployer.commands.grep(/composer install/).first
21
- composer_cmd.should_not be_nil
21
+ expect(composer_cmd).not_to be_nil
22
22
  end
23
23
  end
24
24
  end
@@ -13,7 +13,7 @@ describe "Deploying an application that uses Node.js and NPM" do
13
13
 
14
14
  it "runs 'npm install'" do
15
15
  install_cmd = @deployer.commands.grep(/npm install/).first
16
- install_cmd.should_not be_nil
16
+ expect(install_cmd).not_to be_nil
17
17
  end
18
18
  end
19
19
 
@@ -23,7 +23,7 @@ describe "Deploying an application that uses Node.js and NPM" do
23
23
  end
24
24
 
25
25
  it "does not run 'npm install'" do
26
- @deployer.commands.grep(/npm/).should be_empty
26
+ expect(@deployer.commands.grep(/npm/)).to be_empty
27
27
  end
28
28
  end
29
29
  end
@@ -13,7 +13,7 @@ describe "Deploying an application that uses PHP and Composer" do
13
13
 
14
14
  it "runs 'composer install'" do
15
15
  install_cmd = @deployer.commands.grep(/composer install/).first
16
- install_cmd.should_not be_nil
16
+ expect(install_cmd).not_to be_nil
17
17
  end
18
18
 
19
19
  it "attempts to run 'composer self-update' before 'composer install'" do
@@ -21,7 +21,7 @@ describe "Deploying an application that uses PHP and Composer" do
21
21
  @deployer.commands.each do |cmd|
22
22
  update_cmd ||= /composer.*self-update/.match(cmd)
23
23
  if /composer install/.match(cmd)
24
- update_cmd.should_not be nil
24
+ expect(update_cmd).not_to be nil
25
25
  end
26
26
  end
27
27
  end
@@ -33,7 +33,7 @@ describe "Deploying an application that uses PHP and Composer" do
33
33
  end
34
34
 
35
35
  it "does not run composer" do
36
- @deployer.commands.grep(/composer/).should be_empty
36
+ expect(@deployer.commands.grep(/composer/)).to be_empty
37
37
  end
38
38
  end
39
39
 
@@ -43,13 +43,13 @@ describe "Deploying an application that uses PHP and Composer" do
43
43
  end
44
44
 
45
45
  it "outputs a warning about deploying without a .lock" do
46
- warning_out = read_output.should include("WARNING: composer.json found but composer.lock missing!")
47
- warning_out.should_not be_nil
46
+ warning_out = expect(read_output).to include("WARNING: composer.json found but composer.lock missing!")
47
+ expect(warning_out).not_to be_nil
48
48
  end
49
49
 
50
50
  it "runs 'composer install'" do
51
51
  install_cmd = @deployer.commands.grep(/composer install/).first
52
- install_cmd.should_not be_nil
52
+ expect(install_cmd).not_to be_nil
53
53
  end
54
54
 
55
55
  it "attempts to run 'composer self-update' before 'composer install'" do
@@ -57,7 +57,7 @@ describe "Deploying an application that uses PHP and Composer" do
57
57
  @deployer.commands.each do |cmd|
58
58
  update_cmd ||= /composer.*self-update/.match(cmd)
59
59
  if /composer install/.match(cmd)
60
- update_cmd.should_not be nil
60
+ expect(update_cmd).not_to be nil
61
61
  end
62
62
  end
63
63
  end
@@ -4,73 +4,73 @@ describe "Deploying a Rails 3.1 application" do
4
4
  context "with default production settings" do
5
5
  it "precompiles assets when asset compilation is detected" do
6
6
  deploy_test_application('assets_detected')
7
- deploy_dir.join('current', 'precompiled').should exist
8
- deploy_dir.join('current', 'public', 'assets').should exist
9
- deploy_dir.join('current', 'public', 'assets', 'compiled_asset').should exist
10
- read_output.should include("Precompiling assets. ('app/assets' exists, 'public/assets' not found, not disabled in config.)")
7
+ expect(deploy_dir.join('current', 'precompiled')).to exist
8
+ expect(deploy_dir.join('current', 'public', 'assets')).to exist
9
+ expect(deploy_dir.join('current', 'public', 'assets', 'compiled_asset')).to exist
10
+ expect(read_output).to include("Precompiling assets. ('app/assets' exists, 'public/assets' not found, not disabled in config.)")
11
11
  end
12
12
 
13
13
  it "precompiles assets, then reuses them on the next deploy if nothing has changed" do
14
14
  deploy_test_application('assets_enabled_in_ey_yml')
15
- deploy_dir.join('current', 'precompiled').should exist
16
- deploy_dir.join('current', 'public', 'assets').should exist
17
- deploy_dir.join('current', 'public', 'assets', 'compiled_asset').should exist
15
+ expect(deploy_dir.join('current', 'precompiled')).to exist
16
+ expect(deploy_dir.join('current', 'public', 'assets')).to exist
17
+ expect(deploy_dir.join('current', 'public', 'assets', 'compiled_asset')).to exist
18
18
 
19
19
  redeploy_test_application
20
- deploy_dir.join('current', 'precompiled').should_not exist # doesn't run the task
21
- deploy_dir.join('current', 'public', 'assets').should exist # but the assets are there
22
- deploy_dir.join('current', 'public', 'assets', 'compiled_asset').should exist
23
- read_output.should =~ %r#Reusing existing assets\. \(configured asset_dependencies unchanged from \w{7}..\w{7}\)#
20
+ expect(deploy_dir.join('current', 'precompiled')).not_to exist # doesn't run the task
21
+ expect(deploy_dir.join('current', 'public', 'assets')).to exist # but the assets are there
22
+ expect(deploy_dir.join('current', 'public', 'assets', 'compiled_asset')).to exist
23
+ expect(read_output).to match(%r#Reusing existing assets\. \(configured asset_dependencies unchanged from \w{7}..\w{7}\)#)
24
24
 
25
25
  redeploy_test_application('config' => {'precompile_unchanged_assets' => 'true'})
26
- deploy_dir.join('current', 'precompiled').should exist # doesn't run the task
27
- deploy_dir.join('current', 'public', 'assets').should exist # but the assets are there
28
- deploy_dir.join('current', 'public', 'assets', 'compiled_asset').should exist
29
- read_output.should_not include("Reusing existing assets")
26
+ expect(deploy_dir.join('current', 'precompiled')).to exist # doesn't run the task
27
+ expect(deploy_dir.join('current', 'public', 'assets')).to exist # but the assets are there
28
+ expect(deploy_dir.join('current', 'public', 'assets', 'compiled_asset')).to exist
29
+ expect(read_output).not_to include("Reusing existing assets")
30
30
  end
31
31
 
32
32
  it "precompile assets again when redeploying a ref with changes" do
33
33
  deploy_test_application('assets_enabled_in_ey_yml')
34
- deploy_dir.join('current', 'precompiled').should exist
35
- deploy_dir.join('current', 'public', 'assets').should exist
36
- deploy_dir.join('current', 'public', 'assets', 'compiled_asset').should exist
37
- read_output.should include("Precompiling assets. (precompile_assets: true)")
34
+ expect(deploy_dir.join('current', 'precompiled')).to exist
35
+ expect(deploy_dir.join('current', 'public', 'assets')).to exist
36
+ expect(deploy_dir.join('current', 'public', 'assets', 'compiled_asset')).to exist
37
+ expect(read_output).to include("Precompiling assets. (precompile_assets: true)")
38
38
 
39
39
  # changing the ref stands in for actually having assets change (see Strategies::IntegrationSpec#same?)
40
40
  redeploy_test_application('branch' => 'somenewref')
41
- deploy_dir.join('current', 'precompiled').should exist # it does runs the task
42
- deploy_dir.join('current', 'public', 'assets').should exist
43
- deploy_dir.join('current', 'public', 'assets', 'compiled_asset').should exist
44
- read_output.should_not =~ %r#Reusing existing assets#
41
+ expect(deploy_dir.join('current', 'precompiled')).to exist # it does runs the task
42
+ expect(deploy_dir.join('current', 'public', 'assets')).to exist
43
+ expect(deploy_dir.join('current', 'public', 'assets', 'compiled_asset')).to exist
44
+ expect(read_output).not_to match(%r#Reusing existing assets#)
45
45
  end
46
46
 
47
47
  it "precompile assets when redeploying the same ref, but assets were turned off the first time" do
48
48
  deploy_test_application('assets_enabled_in_ey_yml', 'config' => {'precompile_assets' => 'false'})
49
- deploy_dir.join('current', 'precompiled').should_not exist
50
- deploy_dir.join('current', 'public', 'assets').should_not exist
51
- deploy_dir.join('current', 'public', 'assets', 'compiled_asset').should_not exist
52
- read_output.should_not include("Precompiling assets. (precompile_assets: true)")
49
+ expect(deploy_dir.join('current', 'precompiled')).not_to exist
50
+ expect(deploy_dir.join('current', 'public', 'assets')).not_to exist
51
+ expect(deploy_dir.join('current', 'public', 'assets', 'compiled_asset')).not_to exist
52
+ expect(read_output).not_to include("Precompiling assets. (precompile_assets: true)")
53
53
 
54
54
  # assets will show as unchanged, but it should compile them fresh anyway.
55
55
  redeploy_test_application('config' => {'precompile_assets' => 'true'})
56
- deploy_dir.join('current', 'precompiled').should exist # it does runs the task
57
- deploy_dir.join('current', 'public', 'assets').should exist
58
- deploy_dir.join('current', 'public', 'assets', 'compiled_asset').should exist
59
- read_output.should_not =~ %r#Reusing existing assets#
56
+ expect(deploy_dir.join('current', 'precompiled')).to exist # it does runs the task
57
+ expect(deploy_dir.join('current', 'public', 'assets')).to exist
58
+ expect(deploy_dir.join('current', 'public', 'assets', 'compiled_asset')).to exist
59
+ expect(read_output).not_to match(%r#Reusing existing assets#)
60
60
  end
61
61
 
62
62
  %w[cleaning shared private].each do |strategy|
63
63
  it "precompiles assets with asset_strategy '#{strategy}', then reuses them on the next deploy if nothing has changed" do
64
64
  deploy_test_application('assets_enabled_in_ey_yml', 'config' => {'asset_strategy' => strategy})
65
- deploy_dir.join('current', 'precompiled').should exist
66
- deploy_dir.join('current', 'public', 'assets').should exist
67
- deploy_dir.join('current', 'public', 'assets', 'compiled_asset').should exist
65
+ expect(deploy_dir.join('current', 'precompiled')).to exist
66
+ expect(deploy_dir.join('current', 'public', 'assets')).to exist
67
+ expect(deploy_dir.join('current', 'public', 'assets', 'compiled_asset')).to exist
68
68
 
69
69
  redeploy_test_application
70
- deploy_dir.join('current', 'precompiled').should_not exist # doesn't run the task
71
- deploy_dir.join('current', 'public', 'assets').should exist # but the assets are there
72
- deploy_dir.join('current', 'public', 'assets', 'compiled_asset').should exist
73
- read_output.should =~ %r#Reusing existing assets\. \(configured asset_dependencies unchanged from \w{7}..\w{7}\)#
70
+ expect(deploy_dir.join('current', 'precompiled')).not_to exist # doesn't run the task
71
+ expect(deploy_dir.join('current', 'public', 'assets')).to exist # but the assets are there
72
+ expect(deploy_dir.join('current', 'public', 'assets', 'compiled_asset')).to exist
73
+ expect(read_output).to match(%r#Reusing existing assets\. \(configured asset_dependencies unchanged from \w{7}..\w{7}\)#)
74
74
  end
75
75
  end
76
76
  end
@@ -81,8 +81,8 @@ describe "Deploying a Rails 3.1 application" do
81
81
  end
82
82
 
83
83
  it "precompiles assets" do
84
- deploy_dir.join('current', 'precompiled').should exist
85
- read_output.should include("Precompiling assets. (precompile_assets: true)")
84
+ expect(deploy_dir.join('current', 'precompiled')).to exist
85
+ expect(read_output).to include("Precompiling assets. (precompile_assets: true)")
86
86
  end
87
87
  end
88
88
 
@@ -92,8 +92,8 @@ describe "Deploying a Rails 3.1 application" do
92
92
  end
93
93
 
94
94
  it "precompiles assets" do
95
- deploy_dir.join('current', 'precompiled').should_not exist
96
- read_output.should include("Precompiling assets. (precompile_assets: true)")
95
+ expect(deploy_dir.join('current', 'precompiled')).not_to exist
96
+ expect(read_output).to include("Precompiling assets. (precompile_assets: true)")
97
97
  end
98
98
  end
99
99
 
@@ -103,22 +103,22 @@ describe "Deploying a Rails 3.1 application" do
103
103
  end
104
104
 
105
105
  it "precompiles assets" do
106
- deploy_dir.join('current', 'precompiled').should exist
107
- read_output.should include("Precompiling assets. (precompile_assets: true)")
106
+ expect(deploy_dir.join('current', 'precompiled')).to exist
107
+ expect(read_output).to include("Precompiling assets. (precompile_assets: true)")
108
108
  end
109
109
  end
110
110
 
111
111
  context "with asset support disabled in config/application.rb" do
112
112
  it "does not precompile assets" do
113
113
  deploy_test_application('assets_disabled')
114
- deploy_dir.join('current', 'precompiled').should_not exist
115
- read_output.should include("Skipping asset precompilation. ('config/application.rb' disables assets.)")
114
+ expect(deploy_dir.join('current', 'precompiled')).not_to exist
115
+ expect(read_output).to include("Skipping asset precompilation. ('config/application.rb' disables assets.)")
116
116
  end
117
117
 
118
118
  it "deploys successfully when application.rb has utf-8 encoding" do
119
119
  deploy_test_application('assets_disabled_utf8')
120
- deploy_dir.join('current', 'precompiled').should_not exist
121
- read_output.should include("Skipping asset precompilation. ('config/application.rb' disables assets.)")
120
+ expect(deploy_dir.join('current', 'precompiled')).not_to exist
121
+ expect(read_output).to include("Skipping asset precompilation. ('config/application.rb' disables assets.)")
122
122
  end
123
123
  end
124
124
 
@@ -128,8 +128,8 @@ describe "Deploying a Rails 3.1 application" do
128
128
  end
129
129
 
130
130
  it "does not precompile assets" do
131
- deploy_dir.join('current', 'precompiled').should_not exist
132
- read_output.should include("Skipping asset precompilation. (precompile_assets: false)")
131
+ expect(deploy_dir.join('current', 'precompiled')).not_to exist
132
+ expect(read_output).to include("Skipping asset precompilation. (precompile_assets: false)")
133
133
  end
134
134
  end
135
135
 
@@ -139,12 +139,12 @@ describe "Deploying a Rails 3.1 application" do
139
139
  end
140
140
 
141
141
  it "does not replace the public/assets directory" do
142
- deploy_dir.join('current', 'custom_compiled').should exist
143
- deploy_dir.join('current', 'precompiled').should_not exist
144
- deploy_dir.join('current', 'public', 'assets').should be_directory
145
- deploy_dir.join('current', 'public', 'assets').should_not be_symlink
146
- deploy_dir.join('current', 'public', 'assets', 'custom_compiled_asset').should exist
147
- read_output.should include("Skipping asset precompilation. ('public/assets' directory already exists.)")
142
+ expect(deploy_dir.join('current', 'custom_compiled')).to exist
143
+ expect(deploy_dir.join('current', 'precompiled')).not_to exist
144
+ expect(deploy_dir.join('current', 'public', 'assets')).to be_directory
145
+ expect(deploy_dir.join('current', 'public', 'assets')).not_to be_symlink
146
+ expect(deploy_dir.join('current', 'public', 'assets', 'custom_compiled_asset')).to exist
147
+ expect(read_output).to include("Skipping asset precompilation. ('public/assets' directory already exists.)")
148
148
  end
149
149
  end
150
150
  end