@@ -28,13 +28,13 @@ discard block |
||
28 | 28 | set('rsync_src', __DIR__); |
29 | 29 | set('rsync_dest', '{{release_path}}'); |
30 | 30 | |
31 | -set('rsync_excludes', function () { |
|
31 | +set('rsync_excludes', function() { |
|
32 | 32 | $config = get('rsync'); |
33 | 33 | $excludes = $config['exclude']; |
34 | 34 | $excludeFile = $config['exclude-file']; |
35 | 35 | $excludesRsync = ''; |
36 | 36 | foreach ($excludes as $exclude) { |
37 | - $excludesRsync.=' --exclude=' . escapeshellarg($exclude); |
|
37 | + $excludesRsync .= ' --exclude=' . escapeshellarg($exclude); |
|
38 | 38 | } |
39 | 39 | if (!empty($excludeFile) && file_exists($excludeFile) && is_file($excludeFile) && is_readable($excludeFile)) { |
40 | 40 | $excludesRsync .= ' --exclude-from=' . escapeshellarg($excludeFile); |
@@ -43,13 +43,13 @@ discard block |
||
43 | 43 | return $excludesRsync; |
44 | 44 | }); |
45 | 45 | |
46 | -set('rsync_includes', function () { |
|
46 | +set('rsync_includes', function() { |
|
47 | 47 | $config = get('rsync'); |
48 | 48 | $includes = $config['include']; |
49 | 49 | $includeFile = $config['include-file']; |
50 | 50 | $includesRsync = ''; |
51 | 51 | foreach ($includes as $include) { |
52 | - $includesRsync.=' --include=' . escapeshellarg($include); |
|
52 | + $includesRsync .= ' --include=' . escapeshellarg($include); |
|
53 | 53 | } |
54 | 54 | if (!empty($includeFile) && file_exists($includeFile) && is_file($includeFile) && is_readable($includeFile)) { |
55 | 55 | $includesRsync .= ' --include-from=' . escapeshellarg($includeFile); |
@@ -58,14 +58,14 @@ discard block |
||
58 | 58 | return $includesRsync; |
59 | 59 | }); |
60 | 60 | |
61 | -set('rsync_filter', function () { |
|
61 | +set('rsync_filter', function() { |
|
62 | 62 | $config = get('rsync'); |
63 | 63 | $filters = $config['filter']; |
64 | 64 | $filterFile = $config['filter-file']; |
65 | 65 | $filterPerDir = $config['filter-perdir']; |
66 | 66 | $filtersRsync = ''; |
67 | 67 | foreach ($filters as $filter) { |
68 | - $filtersRsync.=" --filter='$filter'"; |
|
68 | + $filtersRsync .= " --filter='$filter'"; |
|
69 | 69 | } |
70 | 70 | if (!empty($filterFile)) { |
71 | 71 | $filtersRsync .= " --filter='merge $filterFile'"; |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | return $filtersRsync; |
77 | 77 | }); |
78 | 78 | |
79 | -set('rsync_options', function () { |
|
79 | +set('rsync_options', function() { |
|
80 | 80 | $config = get('rsync'); |
81 | 81 | $options = $config['options']; |
82 | 82 | $optionsRsync = []; |
@@ -17,8 +17,8 @@ |
||
17 | 17 | }); |
18 | 18 | set('cimonitor_user', function () { |
19 | 19 | return [ |
20 | - 'name' => runLocally('git config --get user.name'), |
|
21 | - 'email' => runLocally('git config --get user.email'), |
|
20 | + 'name' => runLocally('git config --get user.name'), |
|
21 | + 'email' => runLocally('git config --get user.email'), |
|
22 | 22 | ]; |
23 | 23 | }); |
24 | 24 |
@@ -60,12 +60,12 @@ discard block |
||
60 | 60 | use Deployer\Utility\Httpie; |
61 | 61 | |
62 | 62 | // Title of project based on git repo |
63 | -set('cimonitor_title', function () { |
|
63 | +set('cimonitor_title', function() { |
|
64 | 64 | $repo = get('repository'); |
65 | 65 | $pattern = '/\w+\/\w+/'; |
66 | 66 | return preg_match($pattern, $repo, $titles) ? $titles[0] : $repo; |
67 | 67 | }); |
68 | -set('cimonitor_user', function () { |
|
68 | +set('cimonitor_user', function() { |
|
69 | 69 | return [ |
70 | 70 | 'name' => runLocally('git config --get user.name'), |
71 | 71 | 'email' => runLocally('git config --get user.email'), |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | set('cimonitor_job_state_success', get('cimonitor_status_success')); |
86 | 86 | |
87 | 87 | desc('Notifies CIMonitor'); |
88 | -task('cimonitor:notify', function () { |
|
88 | +task('cimonitor:notify', function() { |
|
89 | 89 | if (!get('cimonitor_webhook', false)) { |
90 | 90 | return; |
91 | 91 | } |
@@ -111,12 +111,12 @@ discard block |
||
111 | 111 | ->hidden(); |
112 | 112 | |
113 | 113 | desc('Notifies CIMonitor about deploy finish'); |
114 | -task('cimonitor:notify:success', function () { |
|
114 | +task('cimonitor:notify:success', function() { |
|
115 | 115 | if (!get('cimonitor_webhook', false)) { |
116 | 116 | return; |
117 | 117 | } |
118 | 118 | |
119 | - $depstage = 'Deployed to '.get('stage', ''); |
|
119 | + $depstage = 'Deployed to ' . get('stage', ''); |
|
120 | 120 | |
121 | 121 | $body = [ |
122 | 122 | 'state' => get('cimonitor_status_success'), |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | ->hidden(); |
140 | 140 | |
141 | 141 | desc('Notifies CIMonitor about deploy failure'); |
142 | -task('cimonitor:notify:failure', function () { |
|
142 | +task('cimonitor:notify:failure', function() { |
|
143 | 143 | if (!get('cimonitor_webhook', false)) { |
144 | 144 | return; |
145 | 145 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | |
44 | 44 | //Create and upload Drupal 7 settings.php using values from secrets |
45 | -task('drupal:settings', function () { |
|
45 | +task('drupal:settings', function() { |
|
46 | 46 | if (askConfirmation('Are you sure to generate and upload settings.php file?')) { |
47 | 47 | |
48 | 48 | //Get template |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $replacements = []; |
60 | 60 | foreach ($iterator as $key => $value) { |
61 | 61 | $keys = []; |
62 | - for ($i = $iterator->getDepth(); $i > 0; $i --) { |
|
62 | + for ($i = $iterator->getDepth(); $i > 0; $i--) { |
|
63 | 63 | $keys[] = $iterator->getSubIterator($i - 1)->key(); |
64 | 64 | } |
65 | 65 | $keys[] = $key; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | }); |
85 | 85 | |
86 | 86 | //Upload Drupal 7 files folder |
87 | -task('drupal:upload_files', function () { |
|
87 | +task('drupal:upload_files', function() { |
|
88 | 88 | if (askConfirmation('Are you sure?')) { |
89 | 89 | upload('sites/{{drupal_site}}/files', '{{deploy_path}}/shared/sites/{{drupal_site}}/files'); |
90 | 90 | } |
@@ -75,7 +75,7 @@ |
||
75 | 75 | if (is_closure($rawValue)) { |
76 | 76 | return $this->values[$name] = $this->parse(call_user_func($rawValue)); |
77 | 77 | } else { |
78 | - return $this->values[$name]= $this->parse($rawValue); |
|
78 | + return $this->values[$name] = $this->parse($rawValue); |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | } |
@@ -36,13 +36,13 @@ |
||
36 | 36 | */ |
37 | 37 | function craft($command, $options = []) |
38 | 38 | { |
39 | - return function () use ($command, $options) { |
|
40 | - if (! test('[ -s {{release_path}}/.env ]')) { |
|
39 | + return function() use ($command, $options) { |
|
40 | + if (!test('[ -s {{release_path}}/.env ]')) { |
|
41 | 41 | throw new \Exception('Your .env file is empty! Cannot proceed.'); |
42 | 42 | } |
43 | 43 | |
44 | 44 | // By default we don't want any command to be interactive |
45 | - if(! in_array('interactive', $options)) { |
|
45 | + if (!in_array('interactive', $options)) { |
|
46 | 46 | $command .= ' --interactive=0'; |
47 | 47 | } |
48 | 48 |
@@ -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(); |