engineyard-serverside 2.6.14 → 2.6.15.alpha1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +13 -5
- data/bin/engineyard-serverside +1 -1
- data/lib/engineyard-serverside/cli.rb +4 -225
- data/lib/engineyard-serverside/cli/app.rb +136 -0
- data/lib/engineyard-serverside/cli/helpers.rb +58 -0
- data/lib/engineyard-serverside/cli/server_hash_extractor.rb +49 -0
- data/lib/engineyard-serverside/cli/workflows.rb +45 -0
- data/lib/engineyard-serverside/cli/workflows/base.rb +78 -0
- data/lib/engineyard-serverside/cli/workflows/calling_deploy_hooks.rb +31 -0
- data/lib/engineyard-serverside/cli/workflows/deploying_applications.rb +28 -0
- data/lib/engineyard-serverside/cli/workflows/disabling_maintenance.rb +29 -0
- data/lib/engineyard-serverside/cli/workflows/enabling_maintenance.rb +29 -0
- data/lib/engineyard-serverside/cli/workflows/errors.rb +13 -0
- data/lib/engineyard-serverside/cli/workflows/helpers.rb +21 -0
- data/lib/engineyard-serverside/cli/workflows/integrating_servers.rb +63 -0
- data/lib/engineyard-serverside/cli/workflows/restarting_applications.rb +36 -0
- data/lib/engineyard-serverside/cli/workflows/rolling_back_applications.rb +28 -0
- data/lib/engineyard-serverside/cli/workflows/showing_maintenance_status.rb +28 -0
- data/lib/engineyard-serverside/dependency_manager/bundler.rb +43 -14
- data/lib/engineyard-serverside/propagator.rb +59 -0
- data/lib/engineyard-serverside/rails_assets.rb +5 -2
- data/lib/engineyard-serverside/version.rb +1 -1
- metadata +66 -394
- data/lib/engineyard-serverside/cli_helpers.rb +0 -53
- data/spec/archive_deploy_spec.rb +0 -53
- data/spec/basic_deploy_spec.rb +0 -26
- data/spec/bundler_deploy_spec.rb +0 -139
- data/spec/configuration_spec.rb +0 -205
- data/spec/custom_deploy_spec.rb +0 -128
- data/spec/deploy_hook_spec.rb +0 -362
- 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/gitrepo/bar +0 -0
- data/spec/fixtures/gitrepo/foo +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.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_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/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_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 -122
- 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 -164
- 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 -153
- 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/spec_helper.rb +0 -355
- 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
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
module EY
|
|
2
|
-
module Serverside
|
|
3
|
-
module CLIHelpers
|
|
4
|
-
def account_app_env_options
|
|
5
|
-
method_option :app, :type => :string,
|
|
6
|
-
:required => true,
|
|
7
|
-
:desc => "Application to deploy",
|
|
8
|
-
:aliases => %w[-a --app-name]
|
|
9
|
-
method_option :environment_name, :type => :string,
|
|
10
|
-
:required => true,
|
|
11
|
-
:desc => "Environment name"
|
|
12
|
-
method_option :account_name, :type => :string,
|
|
13
|
-
:required => true,
|
|
14
|
-
:desc => "Account name"
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def framework_env_option
|
|
18
|
-
method_option :framework_env, :type => :string,
|
|
19
|
-
:required => true,
|
|
20
|
-
:desc => "Ruby web framework environment",
|
|
21
|
-
:aliases => ["-e"]
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def stack_option
|
|
25
|
-
method_option :stack, :type => :string,
|
|
26
|
-
:desc => "Web stack (so we can restart it correctly)"
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
def config_option
|
|
31
|
-
method_option :config, :type => :string,
|
|
32
|
-
:desc => "Additional configuration"
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def instances_options
|
|
36
|
-
method_option :instances, :type => :array,
|
|
37
|
-
:desc => "Hostnames of instances to deploy to, e.g. --instances localhost app1 app2"
|
|
38
|
-
method_option :instance_roles, :type => :hash,
|
|
39
|
-
:default => {},
|
|
40
|
-
:desc => "Roles of instances, keyed on hostname, comma-separated. e.g. instance1:app_master,etc instance2:db,memcached ..."
|
|
41
|
-
method_option :instance_names, :type => :hash,
|
|
42
|
-
:default => {},
|
|
43
|
-
:desc => "Instance names, keyed on hostname. e.g. instance1:name1 instance2:name2"
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def verbose_option
|
|
47
|
-
method_option :verbose, :type => :boolean,
|
|
48
|
-
:desc => "Verbose output",
|
|
49
|
-
:aliases => ["-v"]
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
end
|
data/spec/archive_deploy_spec.rb
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
class EY::Serverside::Source::Archive
|
|
4
|
-
def fetch_command
|
|
5
|
-
"cp #{uri} #{source_cache}"
|
|
6
|
-
end
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
describe "Deploying a simple application" do
|
|
10
|
-
|
|
11
|
-
before(:all) do
|
|
12
|
-
adapter = EY::Serverside::Adapter.new do |args|
|
|
13
|
-
args.account_name = "account"
|
|
14
|
-
args.app = "application_name"
|
|
15
|
-
args.stack = "nginx_unicorn"
|
|
16
|
-
args.environment_name = "environment_name"
|
|
17
|
-
args.framework_env = "production"
|
|
18
|
-
args.archive = FIXTURES_DIR.join('retwisj.war')
|
|
19
|
-
args.verbose = true
|
|
20
|
-
args.instances = [{ :hostname => "localhost", :roles => ["solo"], :name => "single" }]
|
|
21
|
-
args.serverside_version = Gem::Version.create(EY::Serverside::VERSION.dup).release
|
|
22
|
-
args.config = {
|
|
23
|
-
"deploy_to" => deploy_dir.to_s,
|
|
24
|
-
"group" => GROUP
|
|
25
|
-
}
|
|
26
|
-
end
|
|
27
|
-
argv = adapter.deploy.commands.last.to_argv[2..-1]
|
|
28
|
-
with_mocked_commands do
|
|
29
|
-
capture do
|
|
30
|
-
EY::Serverside::CLI.start(argv)
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
it "exploded the war" do
|
|
36
|
-
%w(META-INF WEB-INF).each {|dir|
|
|
37
|
-
File.exists?(deploy_dir.join('current', dir))
|
|
38
|
-
}
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
it "creates a REVISION file" do
|
|
42
|
-
path = deploy_dir.join('current', 'REVISION')
|
|
43
|
-
expect(path).to exist
|
|
44
|
-
checksum = File.read(path).strip
|
|
45
|
-
expect(checksum).to match(/7400dc058376745c11a98f768b799c6651428857\s+.*retwisj.war$/)
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
it "restarts the app servers" do
|
|
49
|
-
restart = deploy_dir.join('current', 'restart')
|
|
50
|
-
expect(restart).to exist
|
|
51
|
-
expect(restart.read.chomp).to eq(%|LANG="en_US.UTF-8" /engineyard/bin/app_application_name deploy|)
|
|
52
|
-
end
|
|
53
|
-
end
|
data/spec/basic_deploy_spec.rb
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe "Deploying a simple application" do
|
|
4
|
-
before(:all) do
|
|
5
|
-
deploy_test_application('not_bundled')
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
it "creates a REVISION file" do
|
|
9
|
-
expect(deploy_dir.join('current', 'REVISION')).to exist
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
it "restarts the app servers" do
|
|
13
|
-
restart = deploy_dir.join('current', 'restart')
|
|
14
|
-
expect(restart).to exist
|
|
15
|
-
expect(restart.read.chomp).to eq(%|LANG="en_US.UTF-8" /engineyard/bin/app_rails31 deploy|)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
it "reuses the same active_release directory if a release_path is specified (such as in integrate)" do
|
|
19
|
-
path = @config.paths.active_release
|
|
20
|
-
expect(path.parent.children.size).to eq(1)
|
|
21
|
-
|
|
22
|
-
redeploy_test_application('config' => {'release_path' => path.to_s})
|
|
23
|
-
|
|
24
|
-
expect(path.parent.children.size).to eq(1)
|
|
25
|
-
end
|
|
26
|
-
end
|
data/spec/bundler_deploy_spec.rb
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe "Deploying an application that uses Bundler" do
|
|
4
|
-
VERSION_PATTERN = Regexp.quote(::EY::Serverside::DependencyManager::Bundler.default_version)
|
|
5
|
-
|
|
6
|
-
context "with a Gemfile.lock" do
|
|
7
|
-
before(:all) do
|
|
8
|
-
deploy_test_application('ey_yml')
|
|
9
|
-
@install_bundler_command = @deployer.commands.grep(/gem install bundler/).first
|
|
10
|
-
@bundle_install_command = @deployer.commands.grep(/bundle _#{VERSION_PATTERN}_ install/).first
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
it "runs the right bundler command" do
|
|
14
|
-
expect(@install_bundler_command).not_to be_nil
|
|
15
|
-
expect(@install_bundler_command).to match(/install bundler .* -v "#{VERSION_PATTERN}"/)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
it "runs 'bundle install' with --deployment" do
|
|
19
|
-
expect(@bundle_install_command).not_to be_nil
|
|
20
|
-
expect(@bundle_install_command).to include('--deployment')
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
it "removes bundled_gems directory if the ruby or system version changed" do
|
|
24
|
-
should_run_clear_bundle_cmd = @deployer.commands.grep(/diff/).first
|
|
25
|
-
expect(should_run_clear_bundle_cmd).not_to be_nil
|
|
26
|
-
clear_bundle_cmd = @deployer.commands.grep(/rm -Rf \S+\/bundled_gems/).first
|
|
27
|
-
expect(clear_bundle_cmd).not_to be_nil
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
it "has the binstubs in the path when migrating" do
|
|
31
|
-
expect(deploy_dir.join('path-when-migrating').read).to include('ey_bundler_binstubs')
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
it "creates a ruby version file" do
|
|
35
|
-
expect(deploy_dir.join('shared', 'bundled_gems', 'RUBY_VERSION')).to exist
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
it "creates a system version file" do
|
|
39
|
-
expect(deploy_dir.join('shared', 'bundled_gems', 'SYSTEM_VERSION')).to exist
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
it "generates bundler binstubs" do
|
|
43
|
-
pending "doesn't work with mocked bundler"
|
|
44
|
-
expect(deploy_dir.join('current', 'ey_bundler_binstubs', 'rake')).to exist
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
context "with clean option" do
|
|
49
|
-
before(:all) do
|
|
50
|
-
deploy_test_application('ey_yml', 'clean' => true)
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
it "removes bundled_gems directory if the ruby or system version changed" do
|
|
54
|
-
should_run_clear_bundle_cmd = @deployer.commands.grep(/diff/).first
|
|
55
|
-
expect(should_run_clear_bundle_cmd).to be_nil
|
|
56
|
-
clear_bundle_cmd = @deployer.commands.grep(/rm -Rf \S+\/bundled_gems/).first
|
|
57
|
-
expect(clear_bundle_cmd).not_to be_nil
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
context "with bundler disabled in ey.yml" do
|
|
63
|
-
before(:all) do
|
|
64
|
-
deploy_test_application('bundler_disabled')
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
it "does not run bundler commands" do
|
|
68
|
-
expect(@deployer.commands.grep(/gem install bundler/)).to be_empty
|
|
69
|
-
expect(@deployer.commands.grep(/bundle _.*_ install/)).to be_empty
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
it "still runs the hooks" do
|
|
73
|
-
expect(deploy_dir.join('current', 'before_bundle.ran' )).to exist
|
|
74
|
-
expect(deploy_dir.join('current', 'after_bundle.ran' )).to exist
|
|
75
|
-
end
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
context "without a Gemfile.lock" do
|
|
79
|
-
before(:all) do
|
|
80
|
-
deploy_test_application('no_gemfile_lock')
|
|
81
|
-
@install_bundler_command = @deployer.commands.grep(/gem install bundler/).first
|
|
82
|
-
@bundle_install_command = @deployer.commands.grep(/bundle _#{VERSION_PATTERN}_ install/).first
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
it "installs the proper Bundler version" do
|
|
86
|
-
expect(@install_bundler_command).not_to be_nil
|
|
87
|
-
expect(@install_bundler_command).to match(/unset RUBYOPT && gem list bundler | grep "bundler " | egrep -q "#{VERSION_PATTERN}[,)]" || gem install bundler -q --no-rdoc --no-ri -v "#{VERSION_PATTERN}"/)
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
it "runs 'bundle install' without --deployment" do
|
|
91
|
-
expect(@bundle_install_command).not_to be_nil
|
|
92
|
-
expect(@bundle_install_command).not_to match(/--deployment/)
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
it "exports GIT_SSH for the bundle install" do
|
|
96
|
-
expect(@bundle_install_command).to match(/export GIT_SSH/)
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
it "puts down RUBY_VERSION and SYSTEM_VERSION" do
|
|
100
|
-
expect(deploy_dir.join('shared', 'bundled_gems', 'RUBY_VERSION')).to exist
|
|
101
|
-
expect(deploy_dir.join('shared', 'bundled_gems', 'SYSTEM_VERSION')).to exist
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
it "warns that using a lockfile is idiomatic" do
|
|
105
|
-
out = read_output
|
|
106
|
-
expect(out).to match(/WARNING: Gemfile found but Gemfile.lock is missing!/)
|
|
107
|
-
end
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
context "without a Gemfile.lock and ignoring the warning" do
|
|
111
|
-
before(:all) do
|
|
112
|
-
deploy_test_application('no_gemfile_lock', 'config' => {'ignore_gemfile_lock_warning' => true})
|
|
113
|
-
expect(@config.ignore_gemfile_lock_warning).to be_truthy
|
|
114
|
-
@install_bundler_command = @deployer.commands.grep(/gem install bundler/).first
|
|
115
|
-
@bundle_install_command = @deployer.commands.grep(/bundle _#{VERSION_PATTERN}_ install/).first
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
it "should not warn" do
|
|
119
|
-
out = read_output
|
|
120
|
-
expect(out).not_to match(/WARNING/)
|
|
121
|
-
end
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
context "with a failing Gemfile" do
|
|
125
|
-
before(:all) do
|
|
126
|
-
begin
|
|
127
|
-
deploy_test_application('bundle_fails', 'bundle_install_fails' => true, 'verbose' => false)
|
|
128
|
-
rescue EY::Serverside::RemoteFailure
|
|
129
|
-
end
|
|
130
|
-
end
|
|
131
|
-
|
|
132
|
-
it "prints the failure to the log" do
|
|
133
|
-
out = read_output
|
|
134
|
-
expect(out).to match(%r|bundle install failure|)
|
|
135
|
-
expect(deploy_dir.join('current', 'after_bundle.ran' )).not_to exist
|
|
136
|
-
end
|
|
137
|
-
end
|
|
138
|
-
end
|
|
139
|
-
|
data/spec/configuration_spec.rb
DELETED
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe EY::Serverside::Deploy::Configuration do
|
|
4
|
-
describe "default options" do
|
|
5
|
-
it "has defaults" do
|
|
6
|
-
@config = EY::Serverside::Deploy::Configuration.new({
|
|
7
|
-
'app' => 'app_name',
|
|
8
|
-
'environment_name' => 'env_name',
|
|
9
|
-
'account_name' => 'acc',
|
|
10
|
-
'framework_env' => 'production',
|
|
11
|
-
})
|
|
12
|
-
expect(@config.app_name).to eq("app_name")
|
|
13
|
-
expect(@config.environment_name).to eq("env_name")
|
|
14
|
-
expect(@config.account_name).to eq("acc")
|
|
15
|
-
expect(@config.migrate).to eq(nil)
|
|
16
|
-
expect(@config.migrate?).to eq(false)
|
|
17
|
-
expect(@config.branch).to eq("master")
|
|
18
|
-
expect(@config.ref).to eq("master")
|
|
19
|
-
expect(@config.maintenance_on_migrate).to eq(true)
|
|
20
|
-
expect(@config.maintenance_on_restart).to eq(true)
|
|
21
|
-
expect(@config.required_downtime_stack?).to eq(true)
|
|
22
|
-
expect(@config.framework_env).to eq("production")
|
|
23
|
-
expect(@config.precompile_assets).to eq("detect")
|
|
24
|
-
expect(@config.precompile_assets_inferred?).to eq(true)
|
|
25
|
-
expect(@config.skip_precompile_assets?).to eq(false)
|
|
26
|
-
expect(@config.precompile_assets?).to eq(false)
|
|
27
|
-
expect(@config.asset_roles).to eq([:app_master, :app, :solo])
|
|
28
|
-
expect(@config.user).to eq(ENV['USER'])
|
|
29
|
-
expect(@config.group).to eq(ENV['USER'])
|
|
30
|
-
expect(@config.verbose).to eq(false)
|
|
31
|
-
expect(@config.copy_exclude).to eq([])
|
|
32
|
-
expect(@config.ignore_database_adapter_warning).to eq(false)
|
|
33
|
-
expect(@config.ignore_gemfile_lock_warning).to eq(false)
|
|
34
|
-
expect(@config.bundle_without).to eq(%w[test development])
|
|
35
|
-
expect(@config.extra_bundle_install_options).to eq(%w[--without test development])
|
|
36
|
-
expect(@config.deployed_by).to eq("Automation (User name not available)")
|
|
37
|
-
expect(@config.input_ref).to eq(@config.branch)
|
|
38
|
-
expect(@config.keep_releases).to eq(3)
|
|
39
|
-
expect(@config.keep_failed_releases).to eq(3)
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
it "raises when required options are not given" do
|
|
43
|
-
@config = EY::Serverside::Deploy::Configuration.new({})
|
|
44
|
-
expect { @config.app_name }.to raise_error
|
|
45
|
-
expect { @config.environment_name }.to raise_error
|
|
46
|
-
expect { @config.account_name }.to raise_error
|
|
47
|
-
expect { @config.framework_env }.to raise_error
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
context "strategies" do
|
|
52
|
-
let(:options) do
|
|
53
|
-
{ "app" => "serverside" }
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
it "uses strategy if set" do
|
|
57
|
-
@config = EY::Serverside::Deploy::Configuration.new(
|
|
58
|
-
options.merge({'strategy' => 'IntegrationSpec', 'git' => 'git@github.com:engineyard/todo.git'})
|
|
59
|
-
)
|
|
60
|
-
capture do # deprecation warning
|
|
61
|
-
expect(@config.source(test_shell)).to be_a_kind_of(EY::Serverside::Source::IntegrationSpec)
|
|
62
|
-
end
|
|
63
|
-
expect(read_output).to include("DEPRECATION WARNING: The configuration key 'strategy' is deprecated in favor of 'source_class'.")
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
it "uses source_class if set" do
|
|
67
|
-
@config = EY::Serverside::Deploy::Configuration.new(
|
|
68
|
-
options.merge({'source_class' => 'IntegrationSpec', 'git' => 'git@github.com:engineyard/todo.git'})
|
|
69
|
-
)
|
|
70
|
-
expect(@config.source(test_shell)).to be_a_kind_of(EY::Serverside::Source::IntegrationSpec)
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
it "infers a git source" do
|
|
74
|
-
@config = EY::Serverside::Deploy::Configuration.new(
|
|
75
|
-
options.merge({ 'git' => 'git@github.com:engineyard/todo.git' })
|
|
76
|
-
)
|
|
77
|
-
expect(@config.source(test_shell)).to be_a_kind_of(EY::Serverside::Source::Git)
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
it "infers a archive source" do
|
|
81
|
-
@config = EY::Serverside::Deploy::Configuration.new(
|
|
82
|
-
options.merge({'archive' => 'https://github.com/engineyard/todo/archive/master.zip'})
|
|
83
|
-
)
|
|
84
|
-
|
|
85
|
-
expect(@config.source(test_shell)).to be_a_kind_of(EY::Serverside::Source::Archive)
|
|
86
|
-
end
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
context "command line options" do
|
|
90
|
-
before do
|
|
91
|
-
@config = EY::Serverside::Deploy::Configuration.new({
|
|
92
|
-
'repository_cache' => @tempdir,
|
|
93
|
-
'app' => 'app_name',
|
|
94
|
-
'stack' => 'nginx_passenger',
|
|
95
|
-
'framework_env' => 'development',
|
|
96
|
-
'environment_name' => 'env_name',
|
|
97
|
-
'account_name' => 'acc',
|
|
98
|
-
'branch' => 'branch_from_command_line',
|
|
99
|
-
'config' => MultiJson.dump({'custom' => 'custom_from_extra_config', 'maintenance_on_migrate' => 'false', 'precompile_assets' => 'false', 'deployed_by' => 'Martin Emde', 'input_ref' => 'input_branch'})
|
|
100
|
-
})
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
it "underrides options with config (directly supplied options take precedence over 'config' options)" do
|
|
104
|
-
expect(@config.maintenance_on_migrate).to eq(false)
|
|
105
|
-
expect(@config.branch).to eq("branch_from_command_line")
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
it "corrects command line supplied precompile_assets string (which relies on having a special not-set value of nil, so can't be a boolean)" do
|
|
109
|
-
expect(@config.skip_precompile_assets?).to eq(true)
|
|
110
|
-
expect(@config.precompile_assets?).to eq(false)
|
|
111
|
-
expect(@config.precompile_assets_inferred?).to eq(false)
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
it "doesn't require downtime on restart for nginx_passenger" do
|
|
115
|
-
expect(@config.maintenance_on_migrate).to eq(false)
|
|
116
|
-
expect(@config.maintenance_on_restart).to eq(false)
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
it "doesn't bundle --without the framework_env" do
|
|
120
|
-
expect(@config.bundle_without).to eq(%w[test])
|
|
121
|
-
end
|
|
122
|
-
|
|
123
|
-
it "gets deployed_by and input_ref correct" do
|
|
124
|
-
expect(@config.deployed_by).to eq("Martin Emde")
|
|
125
|
-
expect(@config.input_ref).to eq("input_branch")
|
|
126
|
-
end
|
|
127
|
-
end
|
|
128
|
-
|
|
129
|
-
describe "ey.yml loading" do
|
|
130
|
-
before(:each) do
|
|
131
|
-
@tempdir = `mktemp -d -t ey_yml_spec.XXXXX`.strip
|
|
132
|
-
@config = EY::Serverside::Deploy::Configuration.new({
|
|
133
|
-
'repository_cache' => @tempdir,
|
|
134
|
-
'app' => 'app_name',
|
|
135
|
-
'environment_name' => 'env_name',
|
|
136
|
-
'account_name' => 'acc',
|
|
137
|
-
'migrate' => nil,
|
|
138
|
-
'branch' => 'branch_from_command_line',
|
|
139
|
-
'config' => MultiJson.dump({'custom' => 'custom_from_extra_config', 'maintenance_on_migrate' => 'false'})
|
|
140
|
-
})
|
|
141
|
-
|
|
142
|
-
@deploy = FullTestDeploy.new(test_servers, @config, test_shell)
|
|
143
|
-
|
|
144
|
-
@yaml_data = {
|
|
145
|
-
'environments' => {
|
|
146
|
-
'env_name' => {
|
|
147
|
-
'copy_exclude' => ['.git'],
|
|
148
|
-
'migrate' => true,
|
|
149
|
-
'migration_command' => 'uh oh',
|
|
150
|
-
'branch' => 'branch_from_ey_yml',
|
|
151
|
-
'custom' => 'custom_from_ey_yml',
|
|
152
|
-
'bundle_without' => 'only test',
|
|
153
|
-
'maintenance_on_migrate' => true,
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
end
|
|
158
|
-
|
|
159
|
-
def write_ey_yml(relative_path, data)
|
|
160
|
-
FileUtils.mkdir_p(File.join(
|
|
161
|
-
@tempdir,
|
|
162
|
-
File.dirname(relative_path)))
|
|
163
|
-
|
|
164
|
-
File.open(File.join(@tempdir, relative_path), 'w') do |f|
|
|
165
|
-
f.write data.to_yaml
|
|
166
|
-
end
|
|
167
|
-
end
|
|
168
|
-
|
|
169
|
-
it "requires 'ey.yml' and adds any defined methods to the deploy" do
|
|
170
|
-
write_ey_yml 'ey.yml', @yaml_data
|
|
171
|
-
@deploy.load_ey_yml
|
|
172
|
-
expect(@deploy.config.copy_exclude).to eq(['.git'])
|
|
173
|
-
end
|
|
174
|
-
|
|
175
|
-
it "falls back to 'config/ey.yml'" do
|
|
176
|
-
write_ey_yml 'config/ey.yml', @yaml_data
|
|
177
|
-
@deploy.load_ey_yml
|
|
178
|
-
expect(@deploy.config.copy_exclude).to eq(['.git'])
|
|
179
|
-
end
|
|
180
|
-
|
|
181
|
-
it "loads at lower priority than command line options" do
|
|
182
|
-
write_ey_yml 'ey.yml', @yaml_data
|
|
183
|
-
@deploy.load_ey_yml
|
|
184
|
-
expect(@deploy.config.migrate?).to eq(false)
|
|
185
|
-
end
|
|
186
|
-
|
|
187
|
-
it "loads at lower priority than json config option" do
|
|
188
|
-
write_ey_yml 'ey.yml', @yaml_data
|
|
189
|
-
@deploy.load_ey_yml
|
|
190
|
-
expect(@deploy.config.branch).to eq('branch_from_command_line')
|
|
191
|
-
end
|
|
192
|
-
|
|
193
|
-
it "loads bundle_without from the config, which overrides the default" do
|
|
194
|
-
write_ey_yml 'ey.yml', @yaml_data
|
|
195
|
-
@deploy.load_ey_yml
|
|
196
|
-
expect(@deploy.config.bundle_without).to eq('only test')
|
|
197
|
-
end
|
|
198
|
-
|
|
199
|
-
it "overrides boolean ey.yml only options with --conifg strings" do
|
|
200
|
-
write_ey_yml 'ey.yml', @yaml_data
|
|
201
|
-
@deploy.load_ey_yml
|
|
202
|
-
expect(@deploy.config).not_to be_maintenance_on_migrate
|
|
203
|
-
end
|
|
204
|
-
end
|
|
205
|
-
end
|