@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | option('branch', null, InputOption::VALUE_REQUIRED, 'Branch to deploy'); |
| 16 | 16 | |
| 17 | 17 | // The deploy target: a branch, a tag or a revision. |
| 18 | -set('target', function () { |
|
| 18 | +set('target', function() { |
|
| 19 | 19 | $target = ''; |
| 20 | 20 | |
| 21 | 21 | $branch = get('branch'); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * Update code at {{release_path}} on host. |
| 69 | 69 | */ |
| 70 | 70 | desc('Updates code'); |
| 71 | -task('deploy:update_code', function () { |
|
| 71 | +task('deploy:update_code', function() { |
|
| 72 | 72 | $git = get('bin/git'); |
| 73 | 73 | $repository = get('repository'); |
| 74 | 74 | $target = get('target'); |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * ``` |
| 17 | 17 | * ::: |
| 18 | 18 | */ |
| 19 | -set('rollback_candidate', function () { |
|
| 19 | +set('rollback_candidate', function() { |
|
| 20 | 20 | $currentRelease = basename(run('readlink {{current_path}}')); |
| 21 | 21 | $releases = get('releases_list'); |
| 22 | 22 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | * ``` |
| 60 | 60 | * ::: |
| 61 | 61 | */ |
| 62 | -task('rollback', function () { |
|
| 62 | +task('rollback', function() { |
|
| 63 | 63 | cd('{{deploy_path}}'); |
| 64 | 64 | |
| 65 | 65 | $currentRelease = basename(run('readlink {{current_path}}')); |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | set('shared_files', []); |
| 20 | 20 | |
| 21 | 21 | desc('Creates symlinks for shared files and dirs'); |
| 22 | -task('deploy:shared', function () { |
|
| 22 | +task('deploy:shared', function() { |
|
| 23 | 23 | $sharedPath = "{{deploy_path}}/shared"; |
| 24 | 24 | |
| 25 | 25 | // Validate shared_dir, find duplicates |
@@ -6,22 +6,22 @@ discard block |
||
| 6 | 6 | use function Deployer\Support\escape_shell_argument; |
| 7 | 7 | |
| 8 | 8 | // The name of the release. |
| 9 | -set('release_name', function () { |
|
| 10 | - return within('{{deploy_path}}', function () { |
|
| 9 | +set('release_name', function() { |
|
| 10 | + return within('{{deploy_path}}', function() { |
|
| 11 | 11 | $latest = run('cat .dep/latest_release || echo 0'); |
| 12 | 12 | return strval(intval($latest) + 1); |
| 13 | 13 | }); |
| 14 | 14 | }); |
| 15 | 15 | |
| 16 | 16 | // Holds releases log from `.dep/releases_log` file. |
| 17 | -set('releases_log', function () { |
|
| 17 | +set('releases_log', function() { |
|
| 18 | 18 | cd('{{deploy_path}}'); |
| 19 | 19 | |
| 20 | 20 | if (!test('[ -f .dep/releases_log ]')) { |
| 21 | 21 | return []; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - $releaseLogs = array_map(function ($line) { |
|
| 24 | + $releaseLogs = array_map(function($line) { |
|
| 25 | 25 | return json_decode($line, true); |
| 26 | 26 | }, explode("\n", run('tail -n 300 .dep/releases_log'))); |
| 27 | 27 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | }); |
| 30 | 30 | |
| 31 | 31 | // Return list of release names on host. |
| 32 | -set('releases_list', function () { |
|
| 32 | +set('releases_list', function() { |
|
| 33 | 33 | cd('{{deploy_path}}'); |
| 34 | 34 | |
| 35 | 35 | // If there is no releases return empty list. |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | // Will list only dirs in releases. |
| 41 | 41 | $ll = explode("\n", run('cd releases && ls -t -1 -d */')); |
| 42 | - $ll = array_map(function ($release) { |
|
| 42 | + $ll = array_map(function($release) { |
|
| 43 | 43 | return basename(rtrim(trim($release), '/')); |
| 44 | 44 | }, $ll); |
| 45 | 45 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | }); |
| 57 | 57 | |
| 58 | 58 | // Return release path. |
| 59 | -set('release_path', function () { |
|
| 59 | +set('release_path', function() { |
|
| 60 | 60 | $releaseExists = test('[ -h {{deploy_path}}/release ]'); |
| 61 | 61 | if ($releaseExists) { |
| 62 | 62 | $link = run("readlink {{deploy_path}}/release"); |
@@ -67,20 +67,20 @@ discard block |
||
| 67 | 67 | }); |
| 68 | 68 | |
| 69 | 69 | // Current release revision. Usually a git hash. |
| 70 | -set('release_revision', function () { |
|
| 70 | +set('release_revision', function() { |
|
| 71 | 71 | return run('cat {{release_path}}/REVISION'); |
| 72 | 72 | }); |
| 73 | 73 | |
| 74 | 74 | // Return the release path during a deployment |
| 75 | 75 | // but fallback to the current path otherwise. |
| 76 | -set('release_or_current_path', function () { |
|
| 76 | +set('release_or_current_path', function() { |
|
| 77 | 77 | $releaseExists = test('[ -h {{deploy_path}}/release ]'); |
| 78 | 78 | return $releaseExists ? get('release_path') : get('current_path'); |
| 79 | 79 | }); |
| 80 | 80 | |
| 81 | 81 | // Clean up unfinished releases and prepare next release |
| 82 | 82 | desc('Prepares release'); |
| 83 | -task('deploy:release', function () { |
|
| 83 | +task('deploy:release', function() { |
|
| 84 | 84 | cd('{{deploy_path}}'); |
| 85 | 85 | |
| 86 | 86 | // Clean up if there is unfinished release. |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | * +---------------------+-------------+----------------+--------+-----------+ |
| 156 | 156 | * ``` |
| 157 | 157 | */ |
| 158 | -task('releases', function () { |
|
| 158 | +task('releases', function() { |
|
| 159 | 159 | cd('{{deploy_path}}'); |
| 160 | 160 | |
| 161 | 161 | $releasesLog = get('releases_log'); |
@@ -2,12 +2,12 @@ |
||
| 2 | 2 | namespace Deployer; |
| 3 | 3 | |
| 4 | 4 | // Use mv -T if available. Will check automatically. |
| 5 | -set('use_atomic_symlink', function () { |
|
| 5 | +set('use_atomic_symlink', function() { |
|
| 6 | 6 | return commandSupportsOption('mv', '--no-target-directory'); |
| 7 | 7 | }); |
| 8 | 8 | |
| 9 | 9 | desc('Creates symlink to release'); |
| 10 | -task('deploy:symlink', function () { |
|
| 10 | +task('deploy:symlink', function() { |
|
| 11 | 11 | if (get('use_atomic_symlink')) { |
| 12 | 12 | run("mv -T {{deploy_path}}/release {{current_path}}"); |
| 13 | 13 | } else { |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | set('clear_use_sudo', false); |
| 9 | 9 | |
| 10 | 10 | desc('Cleanup files and/or directories'); |
| 11 | -task('deploy:clear_paths', function () { |
|
| 11 | +task('deploy:clear_paths', function() { |
|
| 12 | 12 | $paths = get('clear_paths'); |
| 13 | 13 | $sudo = get('clear_use_sudo') ? 'sudo' : ''; |
| 14 | 14 | $batch = 100; |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | // The public path is the path to be set as DocumentRoot and is defined in the `composer.json` of the project |
| 9 | 9 | // but defaults to `public` from Contao 5.0 on. |
| 10 | 10 | // This path is relative from the {{current_path}}, see [`recipe/provision/website.php`](/docs/recipe/provision/website.php#public_path). |
| 11 | -set('public_path', function () { |
|
| 11 | +set('public_path', function() { |
|
| 12 | 12 | $composerConfig = json_decode(file_get_contents('./composer.json'), true, 512, JSON_THROW_ON_ERROR); |
| 13 | 13 | |
| 14 | 14 | return $composerConfig['extra']['public-dir'] ?? 'public'; |
@@ -26,17 +26,17 @@ discard block |
||
| 26 | 26 | 'var/logs', |
| 27 | 27 | ]); |
| 28 | 28 | |
| 29 | -set('bin/console', function () { |
|
| 29 | +set('bin/console', function() { |
|
| 30 | 30 | return '{{bin/php}} {{release_or_current_path}}/vendor/bin/contao-console'; |
| 31 | 31 | }); |
| 32 | 32 | |
| 33 | -set('contao_version', function () { |
|
| 33 | +set('contao_version', function() { |
|
| 34 | 34 | $result = run('{{bin/console}} --version'); |
| 35 | 35 | preg_match_all('/(\d+\.?)+/', $result, $matches); |
| 36 | 36 | return $matches[0][0] ?? 'n/a'; |
| 37 | 37 | }); |
| 38 | 38 | |
| 39 | -set('symfony_version', function () { |
|
| 39 | +set('symfony_version', function() { |
|
| 40 | 40 | $result = run('{{bin/console}} about'); |
| 41 | 41 | preg_match_all('/(\d+\.?)+/', $result, $matches); |
| 42 | 42 | return $matches[0][0] ?? 5.0; |
@@ -52,31 +52,31 @@ discard block |
||
| 52 | 52 | // }); |
| 53 | 53 | // ``` |
| 54 | 54 | desc('Run Contao migrations'); |
| 55 | -task('contao:migrate', function () { |
|
| 55 | +task('contao:migrate', function() { |
|
| 56 | 56 | run('{{bin/console}} contao:migrate {{console_options}}'); |
| 57 | 57 | }); |
| 58 | 58 | |
| 59 | 59 | // Downloads the `contao-manager.phar.php` into the public path. |
| 60 | 60 | desc('Download the Contao Manager'); |
| 61 | -task('contao:manager:download', function () { |
|
| 61 | +task('contao:manager:download', function() { |
|
| 62 | 62 | 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'); |
| 63 | 63 | }); |
| 64 | 64 | |
| 65 | 65 | // Locks the Contao install tool which is useful if you don't use it. |
| 66 | 66 | desc('Lock the Contao Install Tool'); |
| 67 | -task('contao:install:lock', function () { |
|
| 67 | +task('contao:install:lock', function() { |
|
| 68 | 68 | run('{{bin/console}} contao:install:lock {{console_options}}'); |
| 69 | 69 | }); |
| 70 | 70 | |
| 71 | 71 | // Locks the Contao Manager which is useful if you only need the API of the Manager rather than the UI. |
| 72 | 72 | desc('Lock the Contao Manager'); |
| 73 | -task('contao:manager:lock', function () { |
|
| 73 | +task('contao:manager:lock', function() { |
|
| 74 | 74 | cd('{{release_or_current_path}}'); |
| 75 | 75 | run('echo "99" > contao-manager/login.lock'); |
| 76 | 76 | }); |
| 77 | 77 | |
| 78 | 78 | desc('Enable maintenance mode'); |
| 79 | -task('contao:maintenance:enable', function () { |
|
| 79 | +task('contao:maintenance:enable', function() { |
|
| 80 | 80 | // Enable maintenance mode in both the current and release build, so that the maintenance mode will be enabled |
| 81 | 81 | // for the current installation before the symlink changes and the new installation after the symlink changed. |
| 82 | 82 | foreach (array_unique([parse('{{current_path}}'), parse('{{release_or_current_path}}')]) as $path) { |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | }); |
| 92 | 92 | |
| 93 | 93 | desc('Disable maintenance mode'); |
| 94 | -task('contao:maintenance:disable', function () { |
|
| 94 | +task('contao:maintenance:disable', function() { |
|
| 95 | 95 | foreach (array_unique([parse('{{current_path}}'), parse('{{release_or_current_path}}')]) as $path) { |
| 96 | 96 | if (!test("[ -d $path ]")) { |
| 97 | 97 | continue; |
@@ -12,12 +12,12 @@ |
||
| 12 | 12 | add('writable_dirs', ['public/var', 'var/cache/dev']); |
| 13 | 13 | |
| 14 | 14 | desc('Rebuilds Pimcore Classes'); |
| 15 | -task('pimcore:rebuild-classes', function () { |
|
| 15 | +task('pimcore:rebuild-classes', function() { |
|
| 16 | 16 | run('{{bin/console}} pimcore:deployment:classes-rebuild --create-classes --delete-classes --no-interaction'); |
| 17 | 17 | }); |
| 18 | 18 | |
| 19 | 19 | desc('Removes cache'); |
| 20 | -task('pimcore:cache_clear', function () { |
|
| 20 | +task('pimcore:cache_clear', function() { |
|
| 21 | 21 | run('rm -rf {{release_or_current_path}}/var/cache/dev/*'); |
| 22 | 22 | }); |
| 23 | 23 | |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | 'storage/logs', |
| 22 | 22 | ]); |
| 23 | 23 | set('log_files', 'storage/logs/*.log'); |
| 24 | -set('laravel_version', function () { |
|
| 24 | +set('laravel_version', function() { |
|
| 25 | 25 | $result = run('{{bin/php}} {{release_or_current_path}}/artisan --version'); |
| 26 | 26 | preg_match_all('/(\d+\.?)+/', $result, $matches); |
| 27 | 27 | return $matches[0][0] ?? 5.5; |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | function artisan($command, $options = []) |
| 46 | 46 | { |
| 47 | - return function () use ($command, $options) { |
|
| 47 | + return function() use ($command, $options) { |
|
| 48 | 48 | |
| 49 | 49 | // Ensure the artisan command is available on the current version. |
| 50 | 50 | $versionTooEarly = array_key_exists('min', $options) |