@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | |
| 6 | 6 | add('recipes', ['symfony']); |
| 7 | 7 | |
| 8 | -set('symfony_version', function () { |
|
| 8 | +set('symfony_version', function() { |
|
| 9 | 9 | $result = run('{{bin/console}} --version'); |
| 10 | 10 | preg_match_all('/(\d+\.?)+/', $result, $matches); |
| 11 | 11 | return $matches[0][0] ?? 5.0; |
@@ -34,12 +34,12 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | set('bin/console', '{{bin/php}} {{release_or_current_path}}/bin/console'); |
| 36 | 36 | |
| 37 | -set('console_options', function () { |
|
| 37 | +set('console_options', function() { |
|
| 38 | 38 | return '--no-interaction'; |
| 39 | 39 | }); |
| 40 | 40 | |
| 41 | 41 | desc('Migrates database'); |
| 42 | -task('database:migrate', function () { |
|
| 42 | +task('database:migrate', function() { |
|
| 43 | 43 | $options = '--allow-no-migration'; |
| 44 | 44 | if (get('migrations_config') !== '') { |
| 45 | 45 | $options = "$options --configuration={{release_or_current_path}}/{{migrations_config}}"; |
@@ -49,12 +49,12 @@ discard block |
||
| 49 | 49 | }); |
| 50 | 50 | |
| 51 | 51 | desc('Validate the Doctrine mapping files'); |
| 52 | -task('doctrine:schema:validate', function () { |
|
| 52 | +task('doctrine:schema:validate', function() { |
|
| 53 | 53 | run("cd {{release_or_current_path}} && {{bin/console}} doctrine:schema:validate {{doctrine_schema_validate_config}} {{console_options}}"); |
| 54 | 54 | }); |
| 55 | 55 | |
| 56 | 56 | desc('Clears cache'); |
| 57 | -task('deploy:cache:clear', function () { |
|
| 57 | +task('deploy:cache:clear', function() { |
|
| 58 | 58 | // composer install scripts usually clear and warmup symfony cache |
| 59 | 59 | // so we only need to do it if composer install was run with --no-scripts |
| 60 | 60 | if (false !== strpos(get('composer_options', ''), '--no-scripts')) { |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | }); |
| 64 | 64 | |
| 65 | 65 | desc('Optimize environment variables'); |
| 66 | -task('deploy:env', function () { |
|
| 67 | - within('{{release_or_current_path}}', function () { |
|
| 66 | +task('deploy:env', function() { |
|
| 67 | + within('{{release_or_current_path}}', function() { |
|
| 68 | 68 | run('{{bin/composer}} dump-env "${APP_ENV:-prod}"'); |
| 69 | 69 | }); |
| 70 | 70 | }); |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | set('log_files', 'writable/logs/*.log'); |
| 25 | 25 | |
| 26 | -set('codeigniter4_version', function () { |
|
| 26 | +set('codeigniter4_version', function() { |
|
| 27 | 27 | $result = run('{{bin/php}} {{release_or_current_path}}/spark'); |
| 28 | 28 | preg_match_all('/(\d+\.?)+/', $result, $matches); |
| 29 | 29 | return $matches[0][0] ?? 5.5; |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | function spark($command, $options = []) |
| 47 | 47 | { |
| 48 | - return function () use ($command, $options) { |
|
| 48 | + return function() use ($command, $options) { |
|
| 49 | 49 | |
| 50 | 50 | // Ensure the spark command is available on the current version. |
| 51 | 51 | $versionTooEarly = array_key_exists('min', $options) |
@@ -4,16 +4,16 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | namespace Deployer; |
| 6 | 6 | |
| 7 | -set('domain', function () { |
|
| 7 | +set('domain', function() { |
|
| 8 | 8 | return ask(' Domain: '); |
| 9 | 9 | }); |
| 10 | 10 | |
| 11 | -set('public_path', function () { |
|
| 11 | +set('public_path', function() { |
|
| 12 | 12 | return ask(' Public path: ', 'public'); |
| 13 | 13 | }); |
| 14 | 14 | |
| 15 | 15 | desc('Provision website'); |
| 16 | -task('provision:website', function () { |
|
| 16 | +task('provision:website', function() { |
|
| 17 | 17 | run("[ -d {{deploy_path}} ] || mkdir -p {{deploy_path}}"); |
| 18 | 18 | run("chown -R deployer:deployer {{deploy_path}}"); |
| 19 | 19 | |
@@ -53,11 +53,11 @@ discard block |
||
| 53 | 53 | })->limit(1); |
| 54 | 54 | |
| 55 | 55 | desc('Shows caddy logs'); |
| 56 | -task('logs:caddy', function () { |
|
| 56 | +task('logs:caddy', function() { |
|
| 57 | 57 | run('tail -f {{deploy_path}}/log/access.log'); |
| 58 | 58 | })->verbose(); |
| 59 | 59 | |
| 60 | 60 | desc('Shows caddy syslog'); |
| 61 | -task('logs:caddy:syslog', function () { |
|
| 61 | +task('logs:caddy:syslog', function() { |
|
| 62 | 62 | run('sudo journalctl -u caddy -f'); |
| 63 | 63 | })->verbose(); |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | namespace Deployer; |
| 4 | 4 | |
| 5 | -set('php_version', function () { |
|
| 5 | +set('php_version', function() { |
|
| 6 | 6 | $defaultphpVersion = file_exists('composer.json') |
| 7 | 7 | ? explode('|', preg_replace('/[^0-9.|]+/', '', json_decode(file_get_contents('composer.json'), true)['require']['php'] ?? '8.3'))[0] |
| 8 | 8 | : '8.3'; |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | }); |
| 11 | 11 | |
| 12 | 12 | desc('Installs PHP packages'); |
| 13 | -task('provision:php', function () { |
|
| 13 | +task('provision:php', function() { |
|
| 14 | 14 | $version = get('php_version'); |
| 15 | 15 | info("Installing PHP $version"); |
| 16 | 16 | $packages = [ |
@@ -63,12 +63,12 @@ discard block |
||
| 63 | 63 | ->limit(1); |
| 64 | 64 | |
| 65 | 65 | desc('Shows php-fpm logs'); |
| 66 | -task('logs:php-fpm', function () { |
|
| 66 | +task('logs:php-fpm', function() { |
|
| 67 | 67 | run('tail -f /var/log/fpm-php.www.log'); |
| 68 | 68 | })->verbose(); |
| 69 | 69 | |
| 70 | 70 | desc('Installs Composer'); |
| 71 | -task('provision:composer', function () { |
|
| 71 | +task('provision:composer', function() { |
|
| 72 | 72 | run('curl -sS https://getcomposer.org/installer | php'); |
| 73 | 73 | run('mv composer.phar /usr/local/bin/composer'); |
| 74 | 74 | })->oncePerNode(); |
@@ -5,7 +5,7 @@ |
||
| 5 | 5 | set('nodejs_version', 'node_20.x'); |
| 6 | 6 | |
| 7 | 7 | desc('Installs npm packages'); |
| 8 | -task('provision:npm', function () { |
|
| 8 | +task('provision:npm', function() { |
|
| 9 | 9 | run('npm install -g fx zx pm2'); |
| 10 | 10 | run('pm2 startup'); |
| 11 | 11 | }) |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | 'storage/statamic', |
| 13 | 13 | ]); |
| 14 | 14 | |
| 15 | -set('statamic_version', function () { |
|
| 15 | +set('statamic_version', function() { |
|
| 16 | 16 | $result = run('{{bin/php}} {{release_or_current_path}}/please --version'); |
| 17 | 17 | preg_match_all('/(\d+\.?)+/', $result, $matches); |
| 18 | 18 | return $matches[0][0] ?? 'unknown'; |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | set('roadrunner_path', '{{release_or_current_path}}'); |
| 17 | 17 | |
| 18 | 18 | desc('Create .env file if it doesn\'t exist'); |
| 19 | -task('deploy:environment', function (): void { |
|
| 19 | +task('deploy:environment', function(): void { |
|
| 20 | 20 | run('cd {{release_or_current_path}} && [ ! -f .env ] && cp .env.sample .env'); |
| 21 | 21 | }); |
| 22 | 22 | |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | function command(string $command, array $options = []): \Closure |
| 30 | 30 | { |
| 31 | - return function () use ($command, $options): void { |
|
| 31 | + return function() use ($command, $options): void { |
|
| 32 | 32 | $output = run("cd {{release_or_current_path}} && {{bin/php}} app.php $command"); |
| 33 | 33 | |
| 34 | 34 | if (\in_array('showOutput', $options, true)) { |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | function rr(string $command, array $options = []): \Closure |
| 47 | 47 | { |
| 48 | - return function () use ($command, $options): void { |
|
| 48 | + return function() use ($command, $options): void { |
|
| 49 | 49 | $output = run("cd {{roadrunner_path}} && ./rr $command"); |
| 50 | 50 | |
| 51 | 51 | if (\in_array('showOutput', $options, true)) { |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | * RoadRunner console commands |
| 113 | 113 | */ |
| 114 | 114 | desc('Start RoadRunner server'); |
| 115 | -task('roadrunner:serve', function (): void { |
|
| 115 | +task('roadrunner:serve', function(): void { |
|
| 116 | 116 | exec(parse('cd {{roadrunner_path}} && ./rr serve -p > /dev/null 2>&1 &')); |
| 117 | 117 | }); |
| 118 | 118 | |
@@ -126,13 +126,13 @@ discard block |
||
| 126 | 126 | * Download and restart RoadRunner |
| 127 | 127 | */ |
| 128 | 128 | desc('Download RoadRunner'); |
| 129 | -task('deploy:download-rr', function (): void { |
|
| 129 | +task('deploy:download-rr', function(): void { |
|
| 130 | 130 | $output = run("cd {{release_or_current_path}} && {{bin/php}} ./vendor/bin/rr get-binary -l {{roadrunner_path}}"); |
| 131 | 131 | writeln("<info>$output</info>"); |
| 132 | 132 | }); |
| 133 | 133 | |
| 134 | 134 | desc('Restart RoadRunner'); |
| 135 | -task('deploy:restart-rr', function (): void { |
|
| 135 | +task('deploy:restart-rr', function(): void { |
|
| 136 | 136 | try { |
| 137 | 137 | invoke('roadrunner:reset'); |
| 138 | 138 | writeln("<info>Roadrunner successfully restarted.</info>"); |
@@ -24,14 +24,14 @@ |
||
| 24 | 24 | /** |
| 25 | 25 | * Create plugins' symlinks |
| 26 | 26 | */ |
| 27 | -task('deploy:init', function () { |
|
| 27 | +task('deploy:init', function() { |
|
| 28 | 28 | run('{{bin/php}} {{release_or_current_path}}/bin/cake.php plugin assets symlink'); |
| 29 | 29 | })->desc('Initialization'); |
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * Run migrations |
| 33 | 33 | */ |
| 34 | -task('deploy:run_migrations', function () { |
|
| 34 | +task('deploy:run_migrations', function() { |
|
| 35 | 35 | run('{{bin/php}} {{release_or_current_path}}/bin/cake.php migrations migrate --no-lock'); |
| 36 | 36 | run('{{bin/php}} {{release_or_current_path}}/bin/cake.php schema_cache build'); |
| 37 | 37 | })->desc('Run migrations'); |
@@ -22,14 +22,14 @@ |
||
| 22 | 22 | * Clear cache |
| 23 | 23 | */ |
| 24 | 24 | desc('Clears cache'); |
| 25 | -task('deploy:cache:clear', function () { |
|
| 25 | +task('deploy:cache:clear', function() { |
|
| 26 | 26 | run("cd {{release_or_current_path}} && php -r \"require_once 'app/Mage.php'; umask(0); Mage::app()->cleanCache();\""); |
| 27 | 27 | }); |
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | 30 | * Remove files that can be used to compromise Magento |
| 31 | 31 | */ |
| 32 | -task('deploy:clear_version', function () { |
|
| 32 | +task('deploy:clear_version', function() { |
|
| 33 | 33 | run("rm -f {{release_or_current_path}}/LICENSE.html"); |
| 34 | 34 | run("rm -f {{release_or_current_path}}/LICENSE.txt"); |
| 35 | 35 | run("rm -f {{release_or_current_path}}/LICENSE_AFL.txt"); |