@@ -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 |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | } |
74 | 74 | $command = array_values(array_filter( |
75 | 75 | array_merge(['rsync', $flags], $options, $source, [$destination]), |
76 | - function (string $value) { |
|
76 | + function(string $value) { |
|
77 | 77 | return $value !== ''; |
78 | 78 | }, |
79 | 79 | )); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | $fullOutput = ''; |
98 | 98 | |
99 | - $callback = function ($type, $buffer) use ($host, $progressBar, &$fullOutput) { |
|
99 | + $callback = function($type, $buffer) use ($host, $progressBar, &$fullOutput) { |
|
100 | 100 | $fullOutput .= $buffer; |
101 | 101 | if ($progressBar) { |
102 | 102 | foreach (explode("\n", $buffer) as $line) { |
@@ -31,7 +31,7 @@ |
||
31 | 31 | |
32 | 32 | public function callback(Host $host): \Closure |
33 | 33 | { |
34 | - return function ($type, $buffer) use ($host) { |
|
34 | + return function($type, $buffer) use ($host) { |
|
35 | 35 | $this->printBuffer($host, $type, $buffer); |
36 | 36 | }; |
37 | 37 | } |
@@ -62,7 +62,7 @@ |
||
62 | 62 | $hosts = $this->selectHosts($input, $output); |
63 | 63 | $this->applyOverrides($hosts, $input->getOption('option')); |
64 | 64 | |
65 | - $task = new Task($command, function () use ($input, $command) { |
|
65 | + $task = new Task($command, function() use ($input, $command) { |
|
66 | 66 | if (has('current_path')) { |
67 | 67 | $path = get('current_path'); |
68 | 68 | if (test("[ -d $path ]")) { |
@@ -64,7 +64,7 @@ |
||
64 | 64 | $question->setErrorMessage('There is no "%s" host.'); |
65 | 65 | $answer = $helper->ask($input, $output, $question); |
66 | 66 | $answer = array_unique($answer); |
67 | - $hosts = $this->deployer->hosts->select(function (Host $host) use ($answer) { |
|
67 | + $hosts = $this->deployer->hosts->select(function(Host $host) use ($answer) { |
|
68 | 68 | return in_array($host->getAlias(), $answer, true); |
69 | 69 | }); |
70 | 70 | } |