engineyard-serverside 2.8.0.pre → 3.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/engineyard-serverside-execute-service-hook +1 -1
- data/features/hook/running-a-deploy-hook.feature +277 -0
- data/features/hook/step_definitions/running-a-deploy-hook-steps.rb +200 -0
- data/features/step_definitions/command_steps.rb +8 -0
- data/features/step_definitions/version_steps.rb +5 -0
- data/features/support/env.rb +63 -0
- data/features/support/error_codes.rb +17 -0
- data/features/support/fs_helpers.rb +82 -0
- data/features/support/output_helpers.rb +7 -0
- data/features/support/runner.rb +41 -0
- data/features/version.feature +7 -0
- data/lib/engineyard-serverside.rb +2 -5
- data/lib/engineyard-serverside/callbacks/collection/base.rb +12 -5
- data/lib/engineyard-serverside/callbacks/distributor.rb +2 -7
- data/lib/engineyard-serverside/callbacks/executor/executable.rb +2 -0
- data/lib/engineyard-serverside/cli/app.rb +6 -0
- data/lib/engineyard-serverside/cli/workflows/calling_deploy_hooks.rb +1 -2
- data/lib/engineyard-serverside/configuration.rb +3 -3
- data/lib/engineyard-serverside/deploy.rb +4 -8
- data/lib/engineyard-serverside/shell.rb +38 -10
- data/lib/engineyard-serverside/version.rb +1 -1
- data/spec/engineyard-serverside/callbacks/collection/combined_spec.rb +232 -0
- data/spec/engineyard-serverside/callbacks/collection/deploy_hooks_spec.rb +170 -0
- data/spec/engineyard-serverside/callbacks/collection/service_hooks/collection_spec.rb +171 -0
- data/spec/engineyard-serverside/callbacks/collection/service_hooks/combined_spec.rb +174 -0
- data/spec/engineyard-serverside/callbacks/collection/service_hooks_spec.rb +31 -0
- data/spec/engineyard-serverside/callbacks/collection_spec.rb +49 -0
- data/spec/engineyard-serverside/callbacks/distributor/remote_spec.rb +135 -0
- data/spec/engineyard-serverside/callbacks/distributor/viability_filter_spec.rb +208 -0
- data/spec/engineyard-serverside/callbacks/distributor_spec.rb +43 -0
- data/spec/engineyard-serverside/callbacks/executor/executable_spec.rb +386 -0
- data/spec/engineyard-serverside/callbacks/executor/ruby/context_spec.rb +538 -0
- data/spec/engineyard-serverside/callbacks/executor/ruby/executor_spec.rb +313 -0
- data/spec/engineyard-serverside/callbacks/executor/ruby_spec.rb +35 -0
- data/spec/engineyard-serverside/callbacks/executor_spec.rb +45 -0
- data/spec/engineyard-serverside/callbacks_spec.rb +31 -0
- data/spec/engineyard-serverside/cli/workflows/base_spec.rb +237 -0
- data/spec/engineyard-serverside/cli/workflows/calling_deploy_hooks_spec.rb +65 -0
- data/spec/engineyard-serverside/cli/workflows/deploying_applications_spec.rb +61 -0
- data/spec/engineyard-serverside/cli/workflows/disabling_maintenance_spec.rb +61 -0
- data/spec/engineyard-serverside/cli/workflows/enabling_maintenance_spec.rb +61 -0
- data/spec/engineyard-serverside/cli/workflows/helpers_spec.rb +64 -0
- data/spec/engineyard-serverside/cli/workflows/rolling_back_applications_spec.rb +61 -0
- data/spec/engineyard-serverside/cli/workflows/showing_maintenance_status_spec.rb +60 -0
- data/spec/engineyard-serverside/cli/workflows_spec.rb +87 -0
- data/spec/engineyard-serverside/dependency_manager/base_spec.rb +139 -0
- data/spec/engineyard-serverside/paths_spec.rb +820 -0
- data/spec/engineyard-serverside/propagator_spec.rb +56 -0
- data/spec/engineyard-serverside/server_spec.rb +390 -0
- data/spec/engineyard-serverside/shell/helpers_spec.rb +98 -0
- data/spec/engineyard-serverside/shell/yieldio_spec.rb +33 -0
- data/spec/engineyard-serverside/shell_spec.rb +543 -0
- data/spec/engineyard-serverside/slug/distributor_spec.rb +199 -0
- data/spec/engineyard-serverside/slug/enabler_spec.rb +191 -0
- data/spec/engineyard-serverside/slug/failure_handler_spec.rb +114 -0
- data/spec/engineyard-serverside/slug/finalizer_spec.rb +191 -0
- data/spec/engineyard-serverside/slug/generator_spec.rb +82 -0
- data/spec/engineyard-serverside/slug/migrator_spec.rb +137 -0
- data/spec/engineyard-serverside/slug/restarter_spec.rb +226 -0
- data/spec/engineyard-serverside/slug/source/updater_spec.rb +710 -0
- data/spec/engineyard-serverside/slug/source_spec.rb +40 -0
- data/spec/engineyard-serverside/source_spec.rb +171 -0
- data/spec/railway_spec.rb +130 -0
- data/spec/result/failure_spec.rb +113 -0
- data/spec/result/success_spec.rb +109 -0
- data/spec/result_spec.rb +23 -0
- data/spec/spec_helper.rb +3 -349
- metadata +327 -602
- data/lib/vendor/json_pure/COPYING +0 -57
- data/lib/vendor/json_pure/GPL +0 -340
- data/lib/vendor/json_pure/README.rdoc +0 -358
- data/lib/vendor/json_pure/VERSION +0 -1
- data/lib/vendor/json_pure/lib/json.rb +0 -62
- data/lib/vendor/json_pure/lib/json/add/bigdecimal.rb +0 -28
- data/lib/vendor/json_pure/lib/json/add/complex.rb +0 -22
- data/lib/vendor/json_pure/lib/json/add/core.rb +0 -11
- data/lib/vendor/json_pure/lib/json/add/date.rb +0 -34
- data/lib/vendor/json_pure/lib/json/add/date_time.rb +0 -48
- data/lib/vendor/json_pure/lib/json/add/exception.rb +0 -31
- data/lib/vendor/json_pure/lib/json/add/ostruct.rb +0 -31
- data/lib/vendor/json_pure/lib/json/add/range.rb +0 -29
- data/lib/vendor/json_pure/lib/json/add/rational.rb +0 -22
- data/lib/vendor/json_pure/lib/json/add/regexp.rb +0 -30
- data/lib/vendor/json_pure/lib/json/add/struct.rb +0 -30
- data/lib/vendor/json_pure/lib/json/add/symbol.rb +0 -25
- data/lib/vendor/json_pure/lib/json/add/time.rb +0 -38
- data/lib/vendor/json_pure/lib/json/common.rb +0 -484
- data/lib/vendor/json_pure/lib/json/ext.rb +0 -21
- data/lib/vendor/json_pure/lib/json/generic_object.rb +0 -70
- data/lib/vendor/json_pure/lib/json/pure.rb +0 -21
- data/lib/vendor/json_pure/lib/json/pure/generator.rb +0 -522
- data/lib/vendor/json_pure/lib/json/pure/parser.rb +0 -359
- data/lib/vendor/json_pure/lib/json/version.rb +0 -8
- data/lib/vendor/multi_json/CHANGELOG.md +0 -121
- data/lib/vendor/multi_json/CONTRIBUTING.md +0 -46
- data/lib/vendor/multi_json/Gemfile +0 -31
- data/lib/vendor/multi_json/LICENSE.md +0 -20
- data/lib/vendor/multi_json/README.md +0 -105
- data/lib/vendor/multi_json/Rakefile +0 -12
- data/lib/vendor/multi_json/lib/multi_json.rb +0 -137
- data/lib/vendor/multi_json/lib/multi_json/adapters/gson.rb +0 -20
- data/lib/vendor/multi_json/lib/multi_json/adapters/json_common.rb +0 -35
- data/lib/vendor/multi_json/lib/multi_json/adapters/json_gem.rb +0 -12
- data/lib/vendor/multi_json/lib/multi_json/adapters/json_pure.rb +0 -12
- data/lib/vendor/multi_json/lib/multi_json/adapters/nsjsonserialization.rb +0 -35
- data/lib/vendor/multi_json/lib/multi_json/adapters/oj.rb +0 -29
- data/lib/vendor/multi_json/lib/multi_json/adapters/ok_json.rb +0 -58
- data/lib/vendor/multi_json/lib/multi_json/adapters/yajl.rb +0 -20
- data/lib/vendor/multi_json/lib/multi_json/vendor/okjson.rb +0 -602
- data/lib/vendor/multi_json/lib/multi_json/version.rb +0 -3
- data/lib/vendor/multi_json/spec/adapter_shared_example.rb +0 -162
- data/lib/vendor/multi_json/spec/helper.rb +0 -45
- data/lib/vendor/multi_json/spec/json_common_shared_example.rb +0 -36
- data/lib/vendor/multi_json/spec/multi_json_spec.rb +0 -151
- data/spec/archive_deploy_spec.rb +0 -53
- data/spec/basic_deploy_spec.rb +0 -26
- data/spec/bundler_deploy_spec.rb +0 -160
- data/spec/configuration_spec.rb +0 -206
- data/spec/custom_deploy_spec.rb +0 -128
- data/spec/deploy_hook_spec.rb +0 -378
- data/spec/deprecation_spec.rb +0 -23
- data/spec/ey_yml_customized_deploy_spec.rb +0 -99
- data/spec/fixtures/gitrepo.tar.gz +0 -0
- data/spec/fixtures/invalid_hook.rb +0 -1
- data/spec/fixtures/lockfiles/0.9-no-bundler +0 -111
- data/spec/fixtures/lockfiles/0.9-with-bundler +0 -117
- data/spec/fixtures/lockfiles/1.0-no-bundler +0 -54
- data/spec/fixtures/lockfiles/1.0.0.rc.1-with-bundler +0 -162
- data/spec/fixtures/lockfiles/1.0.18-do_mysql +0 -88
- data/spec/fixtures/lockfiles/1.0.18-do_postgres +0 -79
- data/spec/fixtures/lockfiles/1.0.18-mysql +0 -43
- data/spec/fixtures/lockfiles/1.0.18-mysql2 +0 -43
- data/spec/fixtures/lockfiles/1.0.18-pg +0 -43
- data/spec/fixtures/lockfiles/1.0.6-no-bundler +0 -51
- data/spec/fixtures/lockfiles/1.0.6-with-any-bundler +0 -52
- data/spec/fixtures/lockfiles/1.0.6-with-bundler +0 -52
- data/spec/fixtures/lockfiles/1.15.1-no-bundler +0 -51
- data/spec/fixtures/lockfiles/1.3.1-rails-3.2.13 +0 -112
- data/spec/fixtures/lockfiles/not-a-lockfile +0 -1
- data/spec/fixtures/repos/assets_detected/Gemfile +0 -5
- data/spec/fixtures/repos/assets_detected/Gemfile.lock +0 -88
- data/spec/fixtures/repos/assets_detected/README +0 -1
- data/spec/fixtures/repos/assets_detected/Rakefile +0 -5
- data/spec/fixtures/repos/assets_detected/app/assets/empty +0 -0
- data/spec/fixtures/repos/assets_detected/config/application.rb +0 -5
- data/spec/fixtures/repos/assets_detected/config/ey.yml +0 -3
- data/spec/fixtures/repos/assets_disabled/Gemfile +0 -5
- data/spec/fixtures/repos/assets_disabled/Gemfile.lock +0 -88
- data/spec/fixtures/repos/assets_disabled/README +0 -1
- data/spec/fixtures/repos/assets_disabled/Rakefile +0 -6
- data/spec/fixtures/repos/assets_disabled/app/assets/empty +0 -0
- data/spec/fixtures/repos/assets_disabled/config/application.rb +0 -5
- data/spec/fixtures/repos/assets_disabled/config/ey.yml +0 -3
- data/spec/fixtures/repos/assets_disabled_in_ey_yml/Gemfile +0 -5
- data/spec/fixtures/repos/assets_disabled_in_ey_yml/Gemfile.lock +0 -88
- data/spec/fixtures/repos/assets_disabled_in_ey_yml/README +0 -1
- data/spec/fixtures/repos/assets_disabled_in_ey_yml/Rakefile +0 -6
- data/spec/fixtures/repos/assets_disabled_in_ey_yml/app/assets/empty +0 -0
- data/spec/fixtures/repos/assets_disabled_in_ey_yml/config/application.rb +0 -5
- data/spec/fixtures/repos/assets_disabled_in_ey_yml/config/ey.yml +0 -5
- data/spec/fixtures/repos/assets_disabled_utf8/Gemfile +0 -5
- data/spec/fixtures/repos/assets_disabled_utf8/Gemfile.lock +0 -88
- data/spec/fixtures/repos/assets_disabled_utf8/README +0 -3
- data/spec/fixtures/repos/assets_disabled_utf8/Rakefile +0 -5
- data/spec/fixtures/repos/assets_disabled_utf8/app/assets/empty +0 -0
- data/spec/fixtures/repos/assets_disabled_utf8/config/application.rb +0 -7
- data/spec/fixtures/repos/assets_disabled_utf8/config/ey.yml +0 -3
- data/spec/fixtures/repos/assets_enabled_all/Gemfile +0 -5
- data/spec/fixtures/repos/assets_enabled_all/Gemfile.lock +0 -88
- data/spec/fixtures/repos/assets_enabled_all/README +0 -1
- data/spec/fixtures/repos/assets_enabled_all/app/assets/empty +0 -0
- data/spec/fixtures/repos/assets_enabled_all/config/application.rb +0 -5
- data/spec/fixtures/repos/assets_enabled_all/config/ey.yml +0 -6
- data/spec/fixtures/repos/assets_enabled_all/script/assets +0 -5
- data/spec/fixtures/repos/assets_enabled_all/tmp/obstruction +0 -1
- data/spec/fixtures/repos/assets_enabled_in_ey_yml/Gemfile +0 -3
- data/spec/fixtures/repos/assets_enabled_in_ey_yml/Gemfile.lock +0 -10
- data/spec/fixtures/repos/assets_enabled_in_ey_yml/README +0 -1
- data/spec/fixtures/repos/assets_enabled_in_ey_yml/Rakefile +0 -8
- data/spec/fixtures/repos/assets_enabled_in_ey_yml/config/ey.yml +0 -4
- data/spec/fixtures/repos/assets_enabled_util_only/Gemfile +0 -5
- data/spec/fixtures/repos/assets_enabled_util_only/Gemfile.lock +0 -88
- data/spec/fixtures/repos/assets_enabled_util_only/README +0 -1
- data/spec/fixtures/repos/assets_enabled_util_only/Rakefile +0 -6
- data/spec/fixtures/repos/assets_enabled_util_only/app/assets/empty +0 -0
- data/spec/fixtures/repos/assets_enabled_util_only/config/application.rb +0 -5
- data/spec/fixtures/repos/assets_enabled_util_only/config/ey.yml +0 -6
- data/spec/fixtures/repos/assets_error/Gemfile +0 -5
- data/spec/fixtures/repos/assets_error/Gemfile.lock +0 -88
- data/spec/fixtures/repos/assets_error/README +0 -1
- data/spec/fixtures/repos/assets_error/Rakefile +0 -4
- data/spec/fixtures/repos/assets_error/app/assets/empty +0 -0
- data/spec/fixtures/repos/assets_error/config/application.rb +0 -5
- data/spec/fixtures/repos/assets_error/config/ey.yml +0 -4
- data/spec/fixtures/repos/assets_in_hook/Gemfile +0 -5
- data/spec/fixtures/repos/assets_in_hook/Gemfile.lock +0 -88
- data/spec/fixtures/repos/assets_in_hook/README +0 -2
- data/spec/fixtures/repos/assets_in_hook/Rakefile +0 -5
- data/spec/fixtures/repos/assets_in_hook/app/assets/empty +0 -0
- data/spec/fixtures/repos/assets_in_hook/config/application.rb +0 -5
- data/spec/fixtures/repos/assets_in_hook/config/ey.yml +0 -3
- data/spec/fixtures/repos/assets_in_hook/deploy/before_compile_assets.rb +0 -2
- data/spec/fixtures/repos/bundle_fails/Gemfile +0 -1
- data/spec/fixtures/repos/bundle_fails/README +0 -1
- data/spec/fixtures/repos/bundle_fails/deploy/after_bundle.rb +0 -1
- data/spec/fixtures/repos/bundler_disabled/Gemfile +0 -4
- data/spec/fixtures/repos/bundler_disabled/Gemfile.lock +0 -12
- data/spec/fixtures/repos/bundler_disabled/README +0 -1
- data/spec/fixtures/repos/bundler_disabled/config/ey.yml +0 -2
- data/spec/fixtures/repos/bundler_disabled/deploy/after_bundle.rb +0 -1
- data/spec/fixtures/repos/bundler_disabled/deploy/before_bundle.rb +0 -1
- data/spec/fixtures/repos/bundler_old/Gemfile +0 -5
- data/spec/fixtures/repos/bundler_old/Gemfile.lock +0 -15
- data/spec/fixtures/repos/bundler_old/README +0 -1
- data/spec/fixtures/repos/default/Gemfile +0 -4
- data/spec/fixtures/repos/default/Gemfile.lock +0 -12
- data/spec/fixtures/repos/default/README +0 -5
- data/spec/fixtures/repos/default/ey.yml +0 -3
- data/spec/fixtures/repos/executable_hooks/README +0 -1
- data/spec/fixtures/repos/executable_hooks/deploy/before_restart +0 -72
- data/spec/fixtures/repos/executable_hooks_not_executable/README +0 -3
- data/spec/fixtures/repos/executable_hooks_not_executable/deploy/before_restart +0 -3
- data/spec/fixtures/repos/ey_yml/Gemfile +0 -4
- data/spec/fixtures/repos/ey_yml/Gemfile.lock +0 -12
- data/spec/fixtures/repos/ey_yml/README +0 -1
- data/spec/fixtures/repos/ey_yml/config/ey.yml +0 -18
- data/spec/fixtures/repos/ey_yml/deploy/before_migrate.rb +0 -6
- data/spec/fixtures/repos/ey_yml_alt/Gemfile +0 -4
- data/spec/fixtures/repos/ey_yml_alt/Gemfile.lock +0 -12
- data/spec/fixtures/repos/ey_yml_alt/README +0 -1
- data/spec/fixtures/repos/ey_yml_alt/deploy/before_migrate.rb +0 -6
- data/spec/fixtures/repos/ey_yml_alt/ey.yml +0 -12
- data/spec/fixtures/repos/hook_fails/README +0 -1
- data/spec/fixtures/repos/hook_fails/deploy/before_deploy.rb +0 -1
- data/spec/fixtures/repos/hooks/README +0 -1
- data/spec/fixtures/repos/hooks/deploy/after_bundle.rb +0 -1
- data/spec/fixtures/repos/hooks/deploy/after_compile_assets.rb +0 -1
- data/spec/fixtures/repos/hooks/deploy/after_deploy.rb +0 -1
- data/spec/fixtures/repos/hooks/deploy/after_migrate.rb +0 -1
- data/spec/fixtures/repos/hooks/deploy/after_restart.rb +0 -1
- data/spec/fixtures/repos/hooks/deploy/after_symlink.rb +0 -1
- data/spec/fixtures/repos/hooks/deploy/before_bundle.rb +0 -1
- data/spec/fixtures/repos/hooks/deploy/before_compile_assets.rb +0 -1
- data/spec/fixtures/repos/hooks/deploy/before_deploy.rb +0 -1
- data/spec/fixtures/repos/hooks/deploy/before_migrate.rb +0 -1
- data/spec/fixtures/repos/hooks/deploy/before_restart.rb +0 -1
- data/spec/fixtures/repos/hooks/deploy/before_symlink.rb +0 -1
- data/spec/fixtures/repos/multi_dep_manager/README +0 -1
- data/spec/fixtures/repos/multi_dep_manager/composer.json +0 -5
- data/spec/fixtures/repos/multi_dep_manager/composer.lock +0 -462
- data/spec/fixtures/repos/multi_dep_manager/package.json +0 -7
- data/spec/fixtures/repos/multi_dep_manager/public/index.php +0 -4
- data/spec/fixtures/repos/no_ey_config/Gemfile +0 -3
- data/spec/fixtures/repos/no_ey_config/Gemfile.lock +0 -10
- data/spec/fixtures/repos/no_ey_config/README +0 -1
- data/spec/fixtures/repos/no_ey_config/ey.yml +0 -3
- data/spec/fixtures/repos/no_ey_config_no_warning/Gemfile +0 -3
- data/spec/fixtures/repos/no_ey_config_no_warning/Gemfile.lock +0 -10
- data/spec/fixtures/repos/no_ey_config_no_warning/README +0 -1
- data/spec/fixtures/repos/no_ey_config_no_warning/ey.yml +0 -5
- data/spec/fixtures/repos/no_gemfile_lock/Gemfile +0 -4
- data/spec/fixtures/repos/no_gemfile_lock/README +0 -1
- data/spec/fixtures/repos/no_gemfile_lock/ey.yml +0 -3
- data/spec/fixtures/repos/nodejs/README +0 -1
- data/spec/fixtures/repos/nodejs/package.json +0 -7
- data/spec/fixtures/repos/not_bundled/README +0 -1
- data/spec/fixtures/repos/npm_disabled/README +0 -1
- data/spec/fixtures/repos/npm_disabled/config/ey.yml +0 -2
- data/spec/fixtures/repos/npm_disabled/package.json +0 -7
- data/spec/fixtures/repos/php_composer_disabled/README +0 -1
- data/spec/fixtures/repos/php_composer_disabled/composer.json +0 -5
- data/spec/fixtures/repos/php_composer_disabled/composer.lock +0 -462
- data/spec/fixtures/repos/php_composer_disabled/config/ey.yml +0 -2
- data/spec/fixtures/repos/php_composer_disabled/public/index.php +0 -4
- data/spec/fixtures/repos/php_composer_lock/README +0 -1
- data/spec/fixtures/repos/php_composer_lock/composer.json +0 -5
- data/spec/fixtures/repos/php_composer_lock/composer.lock +0 -462
- data/spec/fixtures/repos/php_composer_lock/public/index.php +0 -4
- data/spec/fixtures/repos/php_no_composer_lock/README +0 -1
- data/spec/fixtures/repos/php_no_composer_lock/composer.json +0 -21
- data/spec/fixtures/repos/php_no_composer_lock/public/index.php +0 -4
- data/spec/fixtures/repos/public_system/Gemfile +0 -4
- data/spec/fixtures/repos/public_system/Gemfile.lock +0 -12
- data/spec/fixtures/repos/public_system/README +0 -5
- data/spec/fixtures/repos/public_system/ey.yml +0 -3
- data/spec/fixtures/repos/public_system/public/system/cant_touch_this.txt +0 -3
- data/spec/fixtures/repos/sqlite3/Gemfile +0 -4
- data/spec/fixtures/repos/sqlite3/Gemfile.lock +0 -89
- data/spec/fixtures/repos/sqlite3/README +0 -1
- data/spec/fixtures/retwisj.war +0 -0
- data/spec/fixtures/valid_hook.rb +0 -1
- data/spec/git_strategy_spec.rb +0 -34
- data/spec/lockfile_parser_spec.rb +0 -126
- data/spec/maintenance_spec.rb +0 -44
- data/spec/multi_dependency_manager_spec.rb +0 -25
- data/spec/nodejs_deploy_spec.rb +0 -30
- data/spec/php_deploy_spec.rb +0 -81
- data/spec/platform_configure_spec.rb +0 -61
- data/spec/rails31_deploy_spec.rb +0 -172
- data/spec/restart_spec.rb +0 -43
- data/spec/rollback_spec.rb +0 -87
- data/spec/server_spec.rb +0 -70
- data/spec/services_deploy_spec.rb +0 -165
- data/spec/shell_spec.rb +0 -57
- data/spec/source/archive_spec.rb +0 -33
- data/spec/source/git_spec.rb +0 -44
- data/spec/sqlite3_deploy_spec.rb +0 -38
- data/spec/support/integration.rb +0 -103
- data/spec/support/source_doubles.rb +0 -28
- data/spec/support/timecop.rb +0 -5
- data/spec/symlink_spec.rb +0 -15
@@ -0,0 +1,139 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
require 'engineyard-serverside/dependency_manager/base'
|
4
|
+
|
5
|
+
module EY
|
6
|
+
module Serverside
|
7
|
+
class DependencyManager
|
8
|
+
|
9
|
+
describe Base do
|
10
|
+
let(:servers) {Object.new}
|
11
|
+
let(:config) {Object.new}
|
12
|
+
let(:shell) {Object.new}
|
13
|
+
let(:runner) {Object.new}
|
14
|
+
|
15
|
+
let(:manager) {described_class.new(servers, config, shell, runner)}
|
16
|
+
|
17
|
+
describe '.detect' do
|
18
|
+
let(:manager) {Object.new}
|
19
|
+
let(:detected) {false}
|
20
|
+
let(:result) {described_class.detect(servers, config, shell, runner)}
|
21
|
+
|
22
|
+
before(:each) do
|
23
|
+
allow(described_class).to receive(:new).and_return(manager)
|
24
|
+
allow(manager).to receive(:detected?).and_return(detected)
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'when the manager can detect its dependency signature' do
|
28
|
+
let(:detected) {true}
|
29
|
+
|
30
|
+
it 'is a new instance of the class' do
|
31
|
+
expect(result).to eql(manager)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'when the manager cannot detect its dependency signature' do
|
36
|
+
let(:detected) {false}
|
37
|
+
|
38
|
+
it 'is nil' do
|
39
|
+
expect(result).to eql(nil)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
describe '#detected?' do
|
46
|
+
let(:result) {manager.detected?}
|
47
|
+
|
48
|
+
it 'is false' do
|
49
|
+
expect(result).to eql(false)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe '#check' do
|
54
|
+
let(:result) {manager.check}
|
55
|
+
|
56
|
+
it 'is nil' do
|
57
|
+
expect(result).to eql(nil)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe '#install' do
|
62
|
+
let(:result) {manager.install}
|
63
|
+
|
64
|
+
it 'is nil' do
|
65
|
+
expect(result).to eql(nil)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
describe '#uses_sqlite3?' do
|
70
|
+
let(:result) {manager.uses_sqlite3?}
|
71
|
+
|
72
|
+
it 'is nil' do
|
73
|
+
expect(result).to eql(nil)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
describe '#rails_version' do
|
78
|
+
let(:result) {manager.rails_version}
|
79
|
+
|
80
|
+
it 'is nil' do
|
81
|
+
expect(result).to eql(nil)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
describe '#show_ey_config_instructions' do
|
86
|
+
let(:result) {manager.show_ey_config_instructions}
|
87
|
+
|
88
|
+
it 'is nil' do
|
89
|
+
expect(result).to eql(nil)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
describe '#paths' do
|
94
|
+
let(:paths) {Object.new}
|
95
|
+
let(:result) {manager.instance_eval {paths}}
|
96
|
+
|
97
|
+
before(:each) do
|
98
|
+
allow(config).to receive(:paths).and_return(paths)
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'is the config paths' do
|
102
|
+
expect(result).to eql(paths)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
describe '#on_roles' do
|
107
|
+
let(:result) {manager.instance_eval {on_roles}}
|
108
|
+
|
109
|
+
it 'is an array' do
|
110
|
+
expect(result).to be_a(Array)
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'applies to app masters' do
|
114
|
+
expect(result).to include(:app_master)
|
115
|
+
end
|
116
|
+
|
117
|
+
it 'applies to app instances' do
|
118
|
+
expect(result).to include(:app)
|
119
|
+
end
|
120
|
+
|
121
|
+
it 'applies to solo instances' do
|
122
|
+
expect(result).to include(:solo)
|
123
|
+
end
|
124
|
+
|
125
|
+
it 'applies to util instances' do
|
126
|
+
expect(result).to include(:util)
|
127
|
+
end
|
128
|
+
|
129
|
+
it 'does not apply to database instances' do
|
130
|
+
expect(result).not_to include(:db_master)
|
131
|
+
expect(result).not_to include(:db_slave)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
end
|
136
|
+
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
@@ -0,0 +1,820 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
require 'timecop'
|
4
|
+
|
5
|
+
require 'engineyard-serverside/paths'
|
6
|
+
|
7
|
+
module EY
|
8
|
+
module Serverside
|
9
|
+
|
10
|
+
describe Paths do
|
11
|
+
let(:release_1) {Pathname.new('20200201001000')}
|
12
|
+
let(:release_2) {Pathname.new('20200201002000')}
|
13
|
+
let(:release_3) {Pathname.new('20200201003000')}
|
14
|
+
let(:all_release_paths) {[release_1, release_2, release_3]}
|
15
|
+
let(:home) {'/some/dir/home'}
|
16
|
+
let(:app_name) {'some_app'}
|
17
|
+
let(:active_release) {'/some/dir/active_release'}
|
18
|
+
let(:repository_cache) {'/some/dir/repository_cache'}
|
19
|
+
let(:deploy_root) {'/some/dir/deploy_root'}
|
20
|
+
let(:opts) {{
|
21
|
+
:home => home,
|
22
|
+
:app_name => app_name,
|
23
|
+
:active_release => active_release,
|
24
|
+
:repository_cache => repository_cache,
|
25
|
+
:deploy_root => deploy_root
|
26
|
+
}}
|
27
|
+
|
28
|
+
let(:now) {Time.utc(2020, 1, 15, 1, 27, 0)}
|
29
|
+
|
30
|
+
let(:paths) {described_class.new(opts)}
|
31
|
+
|
32
|
+
before(:each) do
|
33
|
+
Timecop.freeze(now)
|
34
|
+
|
35
|
+
# What say we avoid creating a bunch of files on the file system just
|
36
|
+
# to test some of these methods?
|
37
|
+
allow(Pathname).to receive(:glob).and_return(all_release_paths)
|
38
|
+
end
|
39
|
+
|
40
|
+
after(:each) do
|
41
|
+
Timecop.return
|
42
|
+
end
|
43
|
+
|
44
|
+
describe '#home' do
|
45
|
+
let(:result) {paths.home}
|
46
|
+
|
47
|
+
it 'is a Pathmame' do
|
48
|
+
expect(result).to be_a(Pathname)
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'resolves to the home opt provided at initializetion' do
|
52
|
+
expect(result.to_s).to eql(home)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe '#deploy_root' do
|
57
|
+
let(:result) {paths.deploy_root}
|
58
|
+
|
59
|
+
it 'is a Pathname' do
|
60
|
+
expect(result).to be_a(Pathname)
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'resolves to the deploy_root opt provided at initialization' do
|
64
|
+
expect(result.to_s).to eql(deploy_root)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
describe '#internal_key' do
|
69
|
+
let(:result) {paths.internal_key}
|
70
|
+
|
71
|
+
it 'is a Pathname' do
|
72
|
+
expect(result).to be_a(Pathname)
|
73
|
+
end
|
74
|
+
|
75
|
+
it 'resolves to the internal ssh key within the home directory' do
|
76
|
+
expect(result.to_s).to eql("#{home}/.ssh/internal")
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
describe '#current' do
|
81
|
+
let(:result) {paths.current}
|
82
|
+
|
83
|
+
it 'is a Pathname' do
|
84
|
+
expect(result).to be_a(Pathname)
|
85
|
+
end
|
86
|
+
|
87
|
+
it 'resolves to the "current" directory under the deploy root' do
|
88
|
+
expect(result.to_s).to eql("#{deploy_root}/current")
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
describe '#releases' do
|
93
|
+
let(:result) {paths.releases}
|
94
|
+
|
95
|
+
it 'is a Pathanme' do
|
96
|
+
expect(result).to be_a(Pathname)
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'resolves to the releases directory under the deploy root' do
|
100
|
+
expect(result.to_s).to eql("#{deploy_root}/releases")
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
describe '#releases_failed' do
|
105
|
+
let(:result) {paths.releases_failed}
|
106
|
+
|
107
|
+
it 'is a Pathanme' do
|
108
|
+
expect(result).to be_a(Pathname)
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'resolves to the failed releases directory under the deploy root' do
|
112
|
+
expect(result.to_s).to eql("#{deploy_root}/releases_failed")
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
describe '#shared' do
|
117
|
+
let(:result) {paths.shared}
|
118
|
+
|
119
|
+
it 'is a Pathname' do
|
120
|
+
expect(result).to be_a(Pathname)
|
121
|
+
end
|
122
|
+
|
123
|
+
it 'resolves to the shared directory under the deploy root' do
|
124
|
+
expect(result.to_s).to eql("#{deploy_root}/shared")
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
describe '#shared_log' do
|
129
|
+
let(:result) {paths.shared_log}
|
130
|
+
|
131
|
+
it 'is a Pathname' do
|
132
|
+
expect(result).to be_a(Pathname)
|
133
|
+
end
|
134
|
+
|
135
|
+
it 'resolves to the log directory under the shared path' do
|
136
|
+
expect(result.to_s).to eql("#{paths.shared}/log")
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
describe '#shared_tmp' do
|
141
|
+
let(:result) {paths.shared_tmp}
|
142
|
+
|
143
|
+
it 'is a Pathname' do
|
144
|
+
expect(result).to be_a(Pathname)
|
145
|
+
end
|
146
|
+
|
147
|
+
it 'resolves to the tmp directory under the shared path' do
|
148
|
+
expect(result.to_s).to eql("#{paths.shared}/tmp")
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
describe '#shared_config' do
|
153
|
+
let(:result) {paths.shared_config}
|
154
|
+
|
155
|
+
it 'is a Pathname' do
|
156
|
+
expect(result).to be_a(Pathname)
|
157
|
+
end
|
158
|
+
|
159
|
+
it 'resolves to the config directory under the shared path' do
|
160
|
+
expect(result.to_s).to eql("#{paths.shared}/config")
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
describe '#shared_hooks' do
|
165
|
+
let(:result) {paths.shared_hooks}
|
166
|
+
|
167
|
+
it 'is a Pathname' do
|
168
|
+
expect(result).to be_a(Pathname)
|
169
|
+
end
|
170
|
+
|
171
|
+
it 'resolves to the hooks directory under the shared path' do
|
172
|
+
expect(result.to_s).to eql("#{paths.shared}/hooks")
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
describe '#shared_node_modules' do
|
177
|
+
let(:result) {paths.shared_node_modules}
|
178
|
+
|
179
|
+
it 'is a Pathname' do
|
180
|
+
expect(result).to be_a(Pathname)
|
181
|
+
end
|
182
|
+
|
183
|
+
it 'resolves to the node_modules directory under the shared path' do
|
184
|
+
expect(result.to_s).to eql("#{paths.shared}/node_modules")
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
describe '#shared_system' do
|
189
|
+
let(:result) {paths.shared_system}
|
190
|
+
|
191
|
+
it 'is a Pathname' do
|
192
|
+
expect(result).to be_a(Pathname)
|
193
|
+
end
|
194
|
+
|
195
|
+
it 'resolves to the system directory under the shared path' do
|
196
|
+
expect(result.to_s).to eql("#{paths.shared}/system")
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
describe '#default_repository_cache' do
|
201
|
+
let(:result) {paths.default_repository_cache}
|
202
|
+
|
203
|
+
it 'is a Pathname' do
|
204
|
+
expect(result).to be_a(Pathname)
|
205
|
+
end
|
206
|
+
|
207
|
+
it 'resolves to the cached-copy directory under the shared path' do
|
208
|
+
expect(result.to_s).to eql("#{paths.shared}/cached-copy")
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
describe '#enabled_maintenance_page' do
|
213
|
+
let(:result) {paths.enabled_maintenance_page}
|
214
|
+
|
215
|
+
it 'is a Pathname' do
|
216
|
+
expect(result).to be_a(Pathname)
|
217
|
+
end
|
218
|
+
|
219
|
+
it 'resolves to the maintenance.html file in the shared system path' do
|
220
|
+
expect(result.to_s).to eql("#{paths.shared_system}/maintenance.html")
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
describe '#shared_assets' do
|
225
|
+
let(:result) {paths.shared_assets}
|
226
|
+
|
227
|
+
it 'is a Pathname' do
|
228
|
+
expect(result).to be_a(Pathname)
|
229
|
+
end
|
230
|
+
|
231
|
+
it 'resolves to the assets directory under the shared path' do
|
232
|
+
expect(result.to_s).to eql("#{paths.shared}/assets")
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
describe '#bundled_gems' do
|
237
|
+
let(:result) {paths.bundled_gems}
|
238
|
+
|
239
|
+
it 'is a Pathname' do
|
240
|
+
expect(result).to be_a(Pathname)
|
241
|
+
end
|
242
|
+
|
243
|
+
it 'resolves to the bundled_gems directory under the shared path' do
|
244
|
+
expect(result.to_s).to eql("#{paths.shared}/bundled_gems")
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
describe '#shared_services_yml' do
|
249
|
+
let(:result) {paths.shared_services_yml}
|
250
|
+
|
251
|
+
it 'is a Pathmame' do
|
252
|
+
expect(result).to be_a(Pathname)
|
253
|
+
end
|
254
|
+
|
255
|
+
it 'resolves to the ey_services_config_deploy.yml file under the share config path' do
|
256
|
+
expect(result.to_s).
|
257
|
+
to eql("#{paths.shared_config}/ey_services_config_deploy.yml")
|
258
|
+
end
|
259
|
+
end
|
260
|
+
|
261
|
+
describe '#ruby_version' do
|
262
|
+
let(:result) {paths.ruby_version}
|
263
|
+
|
264
|
+
it 'is a Pathanme' do
|
265
|
+
expect(result).to be_a(Pathname)
|
266
|
+
end
|
267
|
+
|
268
|
+
it 'resolves to the RUBY_VERSION file under the bundled gems path' do
|
269
|
+
expect(result.to_s).to eql("#{paths.bundled_gems}/RUBY_VERSION")
|
270
|
+
end
|
271
|
+
end
|
272
|
+
|
273
|
+
describe '#system_version' do
|
274
|
+
let(:result) {paths.system_version}
|
275
|
+
|
276
|
+
it 'is a Pathname' do
|
277
|
+
expect(result).to be_a(Pathname)
|
278
|
+
end
|
279
|
+
|
280
|
+
it 'resolves to the SYSTEM_VERSION file under the bundled gems path' do
|
281
|
+
expect(result.to_s).to eql("#{paths.bundled_gems}/SYSTEM_VERSION")
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
285
|
+
describe '#latest_revision' do
|
286
|
+
let(:result) {paths.latest_revision}
|
287
|
+
|
288
|
+
it 'is a Pathname' do
|
289
|
+
expect(result).to be_a(Pathname)
|
290
|
+
end
|
291
|
+
|
292
|
+
it 'resolves to the REVISION file under the latest release path' do
|
293
|
+
expect(result.to_s).to eql("#{paths.latest_release}/REVISION")
|
294
|
+
end
|
295
|
+
end
|
296
|
+
|
297
|
+
describe '#active_revision' do
|
298
|
+
let(:result) {paths.active_revision}
|
299
|
+
|
300
|
+
it 'is a Pathname' do
|
301
|
+
expect(result).to be_a(Pathname)
|
302
|
+
end
|
303
|
+
|
304
|
+
it 'resolves to the REVISION file under the active release path' do
|
305
|
+
expect(result.to_s).to eql("#{paths.active_release}/REVISION")
|
306
|
+
end
|
307
|
+
end
|
308
|
+
|
309
|
+
describe '#binstubs' do
|
310
|
+
let(:result) {paths.binstubs}
|
311
|
+
|
312
|
+
it 'is a Pathname' do
|
313
|
+
expect(result).to be_a(Pathname)
|
314
|
+
end
|
315
|
+
|
316
|
+
it 'resolves to the ey_bundler_binstubs directory under the active release paath' do
|
317
|
+
expect(result.to_s).to eql("#{paths.active_release}/ey_bundler_binstubs")
|
318
|
+
end
|
319
|
+
end
|
320
|
+
|
321
|
+
describe '#gemfile' do
|
322
|
+
let(:result) {paths.gemfile}
|
323
|
+
|
324
|
+
it 'is a Pathname' do
|
325
|
+
expect(result).to be_a(Pathname)
|
326
|
+
end
|
327
|
+
|
328
|
+
it 'resolves to the Gemfile file under the active release path' do
|
329
|
+
expect(result.to_s).to eql("#{paths.active_release}/Gemfile")
|
330
|
+
end
|
331
|
+
end
|
332
|
+
|
333
|
+
describe '#gemfile_lock' do
|
334
|
+
let(:result) {paths.gemfile_lock}
|
335
|
+
|
336
|
+
it 'is a Pathname' do
|
337
|
+
expect(result).to be_a(Pathname)
|
338
|
+
end
|
339
|
+
|
340
|
+
it 'resolves to the Gemfile.lock file under the active release path' do
|
341
|
+
expect(result.to_s).to eql("#{paths.active_release}/Gemfile.lock")
|
342
|
+
end
|
343
|
+
end
|
344
|
+
|
345
|
+
describe '#public' do
|
346
|
+
let(:result) {paths.public}
|
347
|
+
|
348
|
+
it 'is a Pathname' do
|
349
|
+
expect(result).to be_a(Pathname)
|
350
|
+
end
|
351
|
+
|
352
|
+
it 'resolves to the public directory under the active release path' do
|
353
|
+
expect(result.to_s).to eql("#{paths.active_release}/public")
|
354
|
+
end
|
355
|
+
end
|
356
|
+
|
357
|
+
describe '#deploy_hooks' do
|
358
|
+
let(:result) {paths.deploy_hooks}
|
359
|
+
|
360
|
+
it 'is a Pathname' do
|
361
|
+
expect(result).to be_a(Pathname)
|
362
|
+
end
|
363
|
+
|
364
|
+
it 'resolves to the deploy directory under the active release path' do
|
365
|
+
expect(result.to_s).to eql("#{paths.active_release}/deploy")
|
366
|
+
end
|
367
|
+
end
|
368
|
+
|
369
|
+
describe '#public_assets' do
|
370
|
+
let(:result) {paths.public_assets}
|
371
|
+
|
372
|
+
it 'is a Pathname' do
|
373
|
+
expect(result).to be_a(Pathname)
|
374
|
+
end
|
375
|
+
|
376
|
+
it 'resolves to the assets directory under the public path' do
|
377
|
+
expect(result.to_s).to eql("#{paths.public}/assets")
|
378
|
+
end
|
379
|
+
end
|
380
|
+
|
381
|
+
describe '#public_system' do
|
382
|
+
let(:result) {paths.public_system}
|
383
|
+
|
384
|
+
it 'is a Pathname' do
|
385
|
+
expect(result).to be_a(Pathname)
|
386
|
+
end
|
387
|
+
|
388
|
+
it 'resolves to the system directory under the public path' do
|
389
|
+
expect(result.to_s).to eql("#{paths.public}/system")
|
390
|
+
end
|
391
|
+
end
|
392
|
+
|
393
|
+
describe '#package_json' do
|
394
|
+
let(:result) {paths.package_json}
|
395
|
+
|
396
|
+
it 'is a Pathname' do
|
397
|
+
expect(result).to be_a(Pathname)
|
398
|
+
end
|
399
|
+
|
400
|
+
it 'resolves to the package.json file in the active relase path' do
|
401
|
+
expect(result.to_s).to eql("#{paths.active_release}/package.json")
|
402
|
+
end
|
403
|
+
end
|
404
|
+
|
405
|
+
describe '#composer_json' do
|
406
|
+
let(:result) {paths.composer_json}
|
407
|
+
|
408
|
+
it 'is a Pathname' do
|
409
|
+
expect(result).to be_a(Pathname)
|
410
|
+
end
|
411
|
+
|
412
|
+
it 'resolves to the composer.json file in the active release path' do
|
413
|
+
expect(result.to_s).to eql("#{paths.active_release}/composer.json")
|
414
|
+
end
|
415
|
+
end
|
416
|
+
|
417
|
+
describe '#composer_lock' do
|
418
|
+
let(:result) {paths.composer_lock}
|
419
|
+
|
420
|
+
it 'is a Pathname' do
|
421
|
+
expect(result).to be_a(Pathname)
|
422
|
+
end
|
423
|
+
|
424
|
+
it 'resolves to the composer.lock file in the active release path' do
|
425
|
+
expect(result.to_s).to eql("#{paths.active_release}/composer.lock")
|
426
|
+
end
|
427
|
+
end
|
428
|
+
|
429
|
+
describe '#active_release_config' do
|
430
|
+
let(:result) {paths.active_release_config}
|
431
|
+
|
432
|
+
it 'is a Pathname' do
|
433
|
+
expect(result).to be_a(Pathname)
|
434
|
+
end
|
435
|
+
|
436
|
+
it 'resolves to the config directory in the active release path' do
|
437
|
+
expect(result.to_s).to eql("#{paths.active_release}/config")
|
438
|
+
end
|
439
|
+
end
|
440
|
+
|
441
|
+
describe '#active_log' do
|
442
|
+
let(:result) {paths.active_log}
|
443
|
+
|
444
|
+
it 'is a Pathname' do
|
445
|
+
expect(result).to be_a(Pathname)
|
446
|
+
end
|
447
|
+
|
448
|
+
it 'resolves to the log directory in the active release path' do
|
449
|
+
expect(result.to_s).to eql("#{paths.active_release}/log")
|
450
|
+
end
|
451
|
+
end
|
452
|
+
|
453
|
+
describe '#active_node_modules' do
|
454
|
+
let(:result) {paths.active_node_modules}
|
455
|
+
|
456
|
+
it 'is a Pathname' do
|
457
|
+
expect(result).to be_a(Pathname)
|
458
|
+
end
|
459
|
+
|
460
|
+
it 'resolves to the node_modules directory under the active release path' do
|
461
|
+
expect(result.to_s).to eql("#{paths.active_release}/node_modules")
|
462
|
+
end
|
463
|
+
end
|
464
|
+
|
465
|
+
describe '#active_tmp' do
|
466
|
+
let(:result) {paths.active_tmp}
|
467
|
+
|
468
|
+
it 'is a Pathname' do
|
469
|
+
expect(result).to be_a(Pathname)
|
470
|
+
end
|
471
|
+
|
472
|
+
it 'resolves to the tmp directory under the active release path' do
|
473
|
+
expect(result.to_s).to eql("#{paths.active_release}/tmp")
|
474
|
+
end
|
475
|
+
end
|
476
|
+
|
477
|
+
describe '#release_dirname' do
|
478
|
+
let(:result) {paths.release_dirname}
|
479
|
+
|
480
|
+
it 'is the current timestamp' do
|
481
|
+
expect(result).to eql(now.strftime('%Y%m%d%H%M%S'))
|
482
|
+
end
|
483
|
+
end
|
484
|
+
|
485
|
+
describe '#new_release!' do
|
486
|
+
let(:result) {paths.new_release!}
|
487
|
+
|
488
|
+
it 'is a Pathname' do
|
489
|
+
expect(result).to be_a(Pathname)
|
490
|
+
end
|
491
|
+
|
492
|
+
context 'when the active release is known' do
|
493
|
+
it 'resolves to the active release path' do
|
494
|
+
expect(result.to_s).to eql(active_release)
|
495
|
+
end
|
496
|
+
end
|
497
|
+
|
498
|
+
context 'when the active release is not known' do
|
499
|
+
let(:active_release) {nil}
|
500
|
+
|
501
|
+
it 'resolves to the current release dirname under the releases path' do
|
502
|
+
expect(result.to_s).
|
503
|
+
to eql("#{paths.releases}/#{paths.release_dirname}")
|
504
|
+
end
|
505
|
+
end
|
506
|
+
end
|
507
|
+
|
508
|
+
describe '#active_release' do
|
509
|
+
let(:result) {paths.active_release}
|
510
|
+
|
511
|
+
it 'is a Pathname' do
|
512
|
+
expect(result).to be_a(Pathname)
|
513
|
+
end
|
514
|
+
|
515
|
+
context 'when the active release is already known' do
|
516
|
+
it 'resolves to that active release' do
|
517
|
+
expect(result.to_s).to eql(active_release)
|
518
|
+
end
|
519
|
+
end
|
520
|
+
|
521
|
+
context 'when the active release is not yet known' do
|
522
|
+
let(:active_release) {nil}
|
523
|
+
|
524
|
+
it 'resolves to the latest release' do
|
525
|
+
expect(result).to eql(paths.latest_release)
|
526
|
+
end
|
527
|
+
end
|
528
|
+
end
|
529
|
+
|
530
|
+
describe '#deploy_key' do
|
531
|
+
let(:result) {paths.deploy_key}
|
532
|
+
|
533
|
+
it 'is a Pathname' do
|
534
|
+
expect(result).to be_a(Pathname)
|
535
|
+
end
|
536
|
+
|
537
|
+
it 'resovles to the deply key for the application' do
|
538
|
+
expect(result.to_s).to eql("#{paths.home}/.ssh/#{app_name}-deploy-key")
|
539
|
+
end
|
540
|
+
end
|
541
|
+
|
542
|
+
describe '#ssh_wrapper' do
|
543
|
+
let(:result) {paths.ssh_wrapper}
|
544
|
+
|
545
|
+
it 'is a Pathname' do
|
546
|
+
expect(result).to be_a(Pathname)
|
547
|
+
end
|
548
|
+
|
549
|
+
it 'resolves to the ssh wrapper for the application under the shared config path' do
|
550
|
+
expect(result.to_s).
|
551
|
+
to eql("#{paths.shared_config}/#{app_name}-ssh-wrapper")
|
552
|
+
end
|
553
|
+
end
|
554
|
+
|
555
|
+
describe '#deploy_hook' do
|
556
|
+
let(:hook_name) {'james'}
|
557
|
+
let(:result) {paths.deploy_hook(hook_name)}
|
558
|
+
|
559
|
+
it 'is a Pathname' do
|
560
|
+
expect(result).to be_a(Pathname)
|
561
|
+
end
|
562
|
+
|
563
|
+
it 'resolves to the requested ruby deploy hook under the deploy hooks path' do
|
564
|
+
expect(result.to_s).to eql("#{paths.deploy_hooks}/#{hook_name}.rb")
|
565
|
+
end
|
566
|
+
end
|
567
|
+
|
568
|
+
describe '#service_hook' do
|
569
|
+
let(:service_name) {'superawesomeservice'}
|
570
|
+
let(:hook_name) {'henry'}
|
571
|
+
let(:result) {paths.service_hook(service_name, hook_name)}
|
572
|
+
|
573
|
+
it 'is a Pathname' do
|
574
|
+
expect(result).to be_a(Pathname)
|
575
|
+
end
|
576
|
+
|
577
|
+
it 'resolves to the requested ruby service hook under the shared hooks path' do
|
578
|
+
expect(result.to_s).
|
579
|
+
to eql("#{paths.shared_hooks}/#{service_name}/#{hook_name}.rb")
|
580
|
+
end
|
581
|
+
end
|
582
|
+
|
583
|
+
describe '#executable_deploy_hook' do
|
584
|
+
let(:hook_name) {'mikey'}
|
585
|
+
let(:result) {paths.executable_deploy_hook(hook_name)}
|
586
|
+
|
587
|
+
it 'is a Pathname' do
|
588
|
+
expect(result).to be_a(Pathname)
|
589
|
+
end
|
590
|
+
|
591
|
+
it 'resovlves to the requested deploy hook script under the deploy hooks path' do
|
592
|
+
expect(result.to_s).
|
593
|
+
to eql("#{paths.deploy_hooks}/#{hook_name}")
|
594
|
+
end
|
595
|
+
end
|
596
|
+
|
597
|
+
describe '#executable_service_hook' do
|
598
|
+
let(:service_name) {'someotherservice'}
|
599
|
+
let(:hook_name) {'george'}
|
600
|
+
let(:result) {paths.executable_service_hook(service_name, hook_name)}
|
601
|
+
|
602
|
+
it 'is a Pathname' do
|
603
|
+
expect(result).to be_a(Pathname)
|
604
|
+
end
|
605
|
+
|
606
|
+
it 'resolves to the requsted service hook script under the shared hooks path' do
|
607
|
+
expect(result.to_s).
|
608
|
+
to eql("#{paths.shared_hooks}/#{service_name}/#{hook_name}")
|
609
|
+
end
|
610
|
+
end
|
611
|
+
|
612
|
+
describe '#repository_cache' do
|
613
|
+
let(:result) {paths.repository_cache}
|
614
|
+
|
615
|
+
it 'is a Pathname' do
|
616
|
+
expect(result).to be_a(Pathname)
|
617
|
+
end
|
618
|
+
|
619
|
+
context 'when the repository cache is known' do
|
620
|
+
it 'resolves to that repository cache path' do
|
621
|
+
expect(result.to_s).to eql(repository_cache)
|
622
|
+
end
|
623
|
+
end
|
624
|
+
|
625
|
+
context 'when the repository cache is not known' do
|
626
|
+
let(:repository_cache) {nil}
|
627
|
+
|
628
|
+
it 'respoves to the default repository cache' do
|
629
|
+
expect(result.to_s).to eql("#{paths.shared}/cached-copy")
|
630
|
+
end
|
631
|
+
end
|
632
|
+
end
|
633
|
+
|
634
|
+
describe '#all_releases' do
|
635
|
+
let(:all_release_paths) {[release_3, release_1, release_2]}
|
636
|
+
let(:result) {paths.all_releases}
|
637
|
+
|
638
|
+
it 'is the sorted result of globbing the releases path' do
|
639
|
+
expect(Pathname).
|
640
|
+
to receive(:glob).
|
641
|
+
with(paths.releases.join('*')).
|
642
|
+
and_return(all_release_paths)
|
643
|
+
|
644
|
+
expect(result).to eql(all_release_paths.sort)
|
645
|
+
end
|
646
|
+
end
|
647
|
+
|
648
|
+
describe '#previous_release' do
|
649
|
+
let(:from_release) {release_3}
|
650
|
+
let(:result) {paths.previous_release(from_release)}
|
651
|
+
|
652
|
+
context 'when a release is specified' do
|
653
|
+
it 'is the release immediately before the specified release' do
|
654
|
+
expect(paths.previous_release(release_3)).to eql(release_2)
|
655
|
+
expect(paths.previous_release(release_2)).to eql(release_1)
|
656
|
+
end
|
657
|
+
end
|
658
|
+
|
659
|
+
context 'when no release is specified' do
|
660
|
+
it 'is the release immediately before the latest release' do
|
661
|
+
expect(paths.previous_release).to eql(release_2)
|
662
|
+
end
|
663
|
+
end
|
664
|
+
|
665
|
+
context 'when there are no releases' do
|
666
|
+
let(:all_release_paths) {[]}
|
667
|
+
|
668
|
+
it 'is nil' do
|
669
|
+
expect(result).to be_nil
|
670
|
+
end
|
671
|
+
end
|
672
|
+
|
673
|
+
context 'when there are releases' do
|
674
|
+
context 'but there is no release before the release in question' do
|
675
|
+
let(:all_release_paths) {[release_3]}
|
676
|
+
|
677
|
+
it 'is nil' do
|
678
|
+
expect(result).to be_nil
|
679
|
+
end
|
680
|
+
end
|
681
|
+
|
682
|
+
context 'and there are releases before the release in question' do
|
683
|
+
let(:all_release_paths) {[release_1, release_3]}
|
684
|
+
|
685
|
+
it 'is the last release before the specified release' do
|
686
|
+
expect(result).to eql(release_1)
|
687
|
+
end
|
688
|
+
end
|
689
|
+
end
|
690
|
+
end
|
691
|
+
|
692
|
+
describe '#previous_revision' do
|
693
|
+
let(:active_release) {release_3}
|
694
|
+
let(:result) {paths.previous_revision}
|
695
|
+
|
696
|
+
context 'when there are not previous releases' do
|
697
|
+
let(:all_release_paths) {[]}
|
698
|
+
|
699
|
+
it 'is nil' do
|
700
|
+
expect(result).to be_nil
|
701
|
+
end
|
702
|
+
end
|
703
|
+
|
704
|
+
context 'when there are previous releases' do
|
705
|
+
it 'is a Pathname' do
|
706
|
+
expect(result).to be_a(Pathname)
|
707
|
+
end
|
708
|
+
|
709
|
+
it 'resolves to the REVISION file under the previous release path' do
|
710
|
+
expect(result.to_s).to eql("#{release_2}/REVISION")
|
711
|
+
end
|
712
|
+
end
|
713
|
+
end
|
714
|
+
|
715
|
+
describe '#latest_release' do
|
716
|
+
let(:result) {paths.latest_release}
|
717
|
+
|
718
|
+
context 'when there are no releases' do
|
719
|
+
let(:all_release_paths) {[]}
|
720
|
+
|
721
|
+
it 'is nil' do
|
722
|
+
expect(result).to be_nil
|
723
|
+
end
|
724
|
+
end
|
725
|
+
|
726
|
+
context 'when there are releases' do
|
727
|
+
it 'is the most recent release' do
|
728
|
+
expect(result).to eql(release_3)
|
729
|
+
end
|
730
|
+
end
|
731
|
+
end
|
732
|
+
|
733
|
+
describe '#deployed?' do
|
734
|
+
let(:result) {paths.deployed?}
|
735
|
+
|
736
|
+
context 'when there are no releases' do
|
737
|
+
let(:all_release_paths) {[]}
|
738
|
+
|
739
|
+
it 'is false' do
|
740
|
+
expect(result).to eql(false)
|
741
|
+
end
|
742
|
+
end
|
743
|
+
|
744
|
+
context 'when there are releases' do
|
745
|
+
it 'is true' do
|
746
|
+
expect(result).to eql(true)
|
747
|
+
end
|
748
|
+
end
|
749
|
+
end
|
750
|
+
|
751
|
+
describe '#maintenance_page_candidates' do
|
752
|
+
let(:result) {paths.maintenance_page_candidates}
|
753
|
+
|
754
|
+
it 'is an Array' do
|
755
|
+
expect(result).to be_a(Array)
|
756
|
+
end
|
757
|
+
|
758
|
+
context 'when there are no releases' do
|
759
|
+
let(:all_release_paths) {[]}
|
760
|
+
|
761
|
+
it 'contains only the default maintenance page' do
|
762
|
+
expect(result.length).to eql(1)
|
763
|
+
|
764
|
+
expect(result.first).to eql(described_class::DEFAULT_MAINTENANCE_PAGE)
|
765
|
+
end
|
766
|
+
end
|
767
|
+
|
768
|
+
context 'when there are releases' do
|
769
|
+
it 'contains each candidate for the latest release' do
|
770
|
+
described_class::MAINTENANCE_CANDIDATES.each do |candidate|
|
771
|
+
expect(result).to include(release_3.join(candidate))
|
772
|
+
end
|
773
|
+
end
|
774
|
+
|
775
|
+
it 'contains the default maintenance page' do
|
776
|
+
expect(result).to include(described_class::DEFAULT_MAINTENANCE_PAGE)
|
777
|
+
end
|
778
|
+
|
779
|
+
it 'contains only the specific items discussed' do
|
780
|
+
expect(result.length).
|
781
|
+
to eql(described_class::MAINTENANCE_CANDIDATES.length + 1)
|
782
|
+
end
|
783
|
+
end
|
784
|
+
end
|
785
|
+
|
786
|
+
describe '#rollback' do
|
787
|
+
let(:result) {paths.rollback}
|
788
|
+
|
789
|
+
context 'when there is a previous release' do
|
790
|
+
let(:all_release_paths) {[release_2, release_3]}
|
791
|
+
|
792
|
+
it 'is a Paths object' do
|
793
|
+
expect(result).to be_a(described_class)
|
794
|
+
end
|
795
|
+
|
796
|
+
it 'has its active release set to the previous release' do
|
797
|
+
expect(result.active_release).to eql(release_2)
|
798
|
+
end
|
799
|
+
end
|
800
|
+
|
801
|
+
context 'when there is not a previous release' do
|
802
|
+
let(:all_release_paths) {[release_3]}
|
803
|
+
|
804
|
+
it 'is nil' do
|
805
|
+
expect(result).to be_nil
|
806
|
+
end
|
807
|
+
end
|
808
|
+
|
809
|
+
context 'when there are no releases' do
|
810
|
+
let(:all_release_paths) {[]}
|
811
|
+
|
812
|
+
it 'is nil' do
|
813
|
+
expect(result).to be_nil
|
814
|
+
end
|
815
|
+
end
|
816
|
+
end
|
817
|
+
end
|
818
|
+
|
819
|
+
end
|
820
|
+
end
|