diff --git a/composer.json b/composer.json index c22ae39..5f7f3d7 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ "php": ">=7.4" }, "require-dev": { - "deployer/deployer": "^7.0.0@beta" + "deployer/deployer": "^7.0.0-rc.5@beta" }, "autoload": { "files": [ diff --git a/recipe/contao.php b/recipe/contao.php deleted file mode 100644 index e0f3f9a..0000000 --- a/recipe/contao.php +++ /dev/null @@ -1,100 +0,0 @@ -<?php - -// Remove when <https://github.com/deployphp/deployer/pull/2851> is represented in a tagged version - -namespace Deployer; - -import('recipe/symfony.php'); - -add('recipes', ['contao']); - -// The public path is the path to be set as DocumentRoot and is defined in the `composer.json` of the project -// but defaults to `public` from Contao 5.0 on. -// This path is relative from the {{current_path}}, see [`recipe/provision/website.php`](/docs/recipe/provision/website.php#public_path). -set('public_path', function () { - $composerConfig = json_decode(file_get_contents('./composer.json'), true, 512, JSON_THROW_ON_ERROR); - - return $composerConfig['extra']['public-dir'] ?? 'public'; -}); - -add('shared_files', ['config/parameters.yml']); - -add('shared_dirs', [ - 'assets/images', - 'contao-manager', - 'files', - '{{public_path}}/share', - 'system/config', - 'var/backups', - 'var/logs', -]); - -set('bin/console', function () { - return '{{release_or_current_path}}/vendor/bin/contao-console'; -}); - -set('contao_version', function () { - return run('{{bin/console}} contao:version'); -}); - -// This task updates the database. A database backup is saved automatically as a default. -desc('Run Contao migrations'); -task('contao:migrate', function () { - run('{{bin/php}} {{bin/console}} contao:migrate {{console_options}}'); -}); - -// Downloads the `contao-manager.phar.php` into the public path. -desc('Download the Contao Manager'); -task('contao:manager:download', function () { - run('curl -LsO https://download.contao.org/contao-manager/stable/contao-manager.phar && mv contao-manager.phar {{release_or_current_path}}/{{public_path}}/contao-manager.phar.php'); -}); - -// Locks the Contao install tool which is useful if you don't use it. -desc('Lock the Contao Install Tool'); -task('contao:install:lock', function () { - run('{{bin/php}} {{bin/console}} contao:install:lock {{console_options}}'); -}); - -// Locks the Contao Manager which is useful if you only need the API of the Manager rather than the UI. -desc('Lock the Contao Manager'); -task('contao:manager:lock', function () { - cd('{{release_or_current_path}}'); - run('echo "99" > contao-manager/login.lock'); -}); - -desc('Enable maintenance mode'); -task('contao:maintenance:enable', function () { - // Enable maintenance mode in both the current and release build, so that the maintenance mode will be enabled - // for the current installation before the symlink changes and the new installation after the symlink changed. - foreach (array_unique([parse('{{current_path}}'), parse('{{release_or_current_path}}')]) as $path) { - // The current path might not be present during first deploy. - if (!test("[ -d $path ]")) { - continue; - } - - cd($path); - run('{{bin/php}} {{bin/console}} contao:maintenance-mode enable {{console_options}}'); - } -}); - -desc('Disable maintenance mode'); -task('contao:maintenance:disable', function () { - foreach (array_unique([parse('{{current_path}}'), parse('{{release_or_current_path}}')]) as $path) { - if (!test("[ -d $path ]")) { - continue; - } - - cd($path); - run('{{bin/php}} {{bin/console}} contao:maintenance-mode disable {{console_options}}'); - } -}); - -desc('Deploy the project'); -task('deploy', [ - 'deploy:prepare', - 'deploy:vendors', - 'contao:maintenance:enable', - 'contao:migrate', - 'contao:maintenance:disable', - 'deploy:publish', -]); diff --git a/recipe/project.php b/recipe/project.php index e76be4f..e7b80aa 100644 --- a/recipe/project.php +++ b/recipe/project.php @@ -2,9 +2,7 @@ namespace Deployer; -// Switch when <https://github.com/deployphp/deployer/pull/2851> is represented in a tagged version -import(__DIR__ . '/contao.php'); -//import('recipe/contao.php'); +import('recipe/contao.php'); import(__DIR__ . '/contao-rsync.php'); import(__DIR__ . '/database.php'); import(__DIR__ . '/files.php');