@@ -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) |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | task('artisan:key:generate', artisan('key:generate')); |
103 | 103 | |
104 | 104 | desc('Generates the application key for new deployments'); |
105 | -task('artisan:create_key', function () { |
|
105 | +task('artisan:create_key', function() { |
|
106 | 106 | if (has('new_deployment')) { |
107 | 107 | invoke('artisan:key:generate'); |
108 | 108 | } |
@@ -4,13 +4,13 @@ discard block |
||
4 | 4 | |
5 | 5 | use function Deployer\Support\parse_home_dir; |
6 | 6 | |
7 | -set('sudo_password', function () { |
|
7 | +set('sudo_password', function() { |
|
8 | 8 | return askHiddenResponse(' Password for sudo: '); |
9 | 9 | }); |
10 | 10 | |
11 | 11 | |
12 | 12 | desc('Setups a deployer user'); |
13 | -task('provision:user', function () { |
|
13 | +task('provision:user', function() { |
|
14 | 14 | set('remote_user', get('provision_user')); |
15 | 15 | |
16 | 16 | if (test('id deployer >/dev/null 2>&1')) { |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | |
54 | 54 | desc('Copy public key to remote server'); |
55 | -task('provision:ssh_copy_id', function () { |
|
55 | +task('provision:ssh_copy_id', function() { |
|
56 | 56 | $defaultKeys = [ |
57 | 57 | '~/.ssh/id_rsa.pub', |
58 | 58 | '~/.ssh/id_ed25519.pub', |
@@ -8,7 +8,7 @@ |
||
8 | 8 | set('node_version', '23.x'); |
9 | 9 | |
10 | 10 | desc('Installs npm packages'); |
11 | -task('provision:node', function () { |
|
11 | +task('provision:node', function() { |
|
12 | 12 | set('remote_user', get('provision_user')); |
13 | 13 | |
14 | 14 | if (has('nodejs_version')) { |
@@ -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 | set('remote_user', get('provision_user')); |
15 | 15 | |
16 | 16 | $version = get('php_version'); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | ->limit(1); |
66 | 66 | |
67 | 67 | desc('Shows php-fpm logs'); |
68 | -task('logs:php-fpm', function () { |
|
68 | +task('logs:php-fpm', function() { |
|
69 | 69 | $fpmLogs = run("ls -1 /var/log | grep fpm"); |
70 | 70 | if (empty($fpmLogs)) { |
71 | 71 | throw new \RuntimeException('No PHP-FPM logs found.'); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | })->verbose(); |
75 | 75 | |
76 | 76 | desc('Installs Composer'); |
77 | -task('provision:composer', function () { |
|
77 | +task('provision:composer', function() { |
|
78 | 78 | run('curl -sS https://getcomposer.org/installer | php'); |
79 | 79 | run('mv composer.phar /usr/local/bin/composer'); |
80 | 80 | })->oncePerNode(); |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | // Defines "what" text for the 'deploy:info' task. |
6 | 6 | // Uses one of the following sources: |
7 | 7 | // 1. Repository name |
8 | -set('what', function () { |
|
8 | +set('what', function() { |
|
9 | 9 | $repo = get('repository'); |
10 | 10 | if (!empty($repo)) { |
11 | 11 | return preg_replace('/\.git$/', '', basename($repo)); |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | // Uses one of the following sources: |
18 | 18 | // 1. Host's stage label |
19 | 19 | // 2. Host's alias |
20 | -set('where', function () { |
|
20 | +set('where', function() { |
|
21 | 21 | $labels = get('labels'); |
22 | 22 | if (isset($labels['stage'])) { |
23 | 23 | return $labels['stage']; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | }); |
27 | 27 | |
28 | 28 | desc('Displays info about deployment'); |
29 | -task('deploy:info', function () { |
|
29 | +task('deploy:info', function() { |
|
30 | 30 | $releaseName = test('[ -d {{deploy_path}}/.dep ]') ? get('release_name') : 1; |
31 | 31 | |
32 | 32 | info("deploying <fg=green;options=bold>{{what}}</> to <fg=magenta;options=bold>{{where}}</> (release <fg=magenta;options=bold>{$releaseName}</>)"); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | use Deployer\Utility\Httpie; |
64 | 64 | |
65 | -set('rockchat_title', function () { |
|
65 | +set('rockchat_title', function() { |
|
66 | 66 | return get('application', 'Project'); |
67 | 67 | }); |
68 | 68 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | set('rocketchat_failure_text', 'Deploy to *{{where}}* failed'); |
84 | 84 | |
85 | 85 | desc('Notifies RocketChat'); |
86 | -task('rocketchat:notify', function () { |
|
86 | +task('rocketchat:notify', function() { |
|
87 | 87 | if (null === get('rocketchat_webhook')) { |
88 | 88 | return; |
89 | 89 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | }); |
114 | 114 | |
115 | 115 | desc('Notifies RocketChat about deploy finish'); |
116 | -task('rocketchat:notify:success', function () { |
|
116 | +task('rocketchat:notify:success', function() { |
|
117 | 117 | if (null === get('rocketchat_webhook')) { |
118 | 118 | return; |
119 | 119 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | }); |
144 | 144 | |
145 | 145 | desc('Notifies RocketChat about deploy failure'); |
146 | -task('rocketchat:notify:failure', function () { |
|
146 | +task('rocketchat:notify:failure', function() { |
|
147 | 147 | if (null === get('rocketchat_webhook')) { |
148 | 148 | return; |
149 | 149 | } |
@@ -27,7 +27,7 @@ |
||
27 | 27 | set('rollbar_comment', '_{{user}}_ deploying `{{what}}` to *{{where}}*'); |
28 | 28 | |
29 | 29 | desc('Notifies Rollbar of deployment'); |
30 | -task('rollbar:notify', function () { |
|
30 | +task('rollbar:notify', function() { |
|
31 | 31 | if (!get('rollbar_token', false)) { |
32 | 32 | return; |
33 | 33 | } |
@@ -51,22 +51,22 @@ discard block |
||
51 | 51 | use Deployer\Task\Context; |
52 | 52 | use Deployer\Utility\Httpie; |
53 | 53 | |
54 | -set('discord_webhook', function () { |
|
54 | +set('discord_webhook', function() { |
|
55 | 55 | return 'https://discordapp.com/api/webhooks/{{discord_channel}}/{{discord_token}}/slack'; |
56 | 56 | }); |
57 | 57 | |
58 | 58 | // Deploy messages |
59 | -set('discord_notify_text', function () { |
|
59 | +set('discord_notify_text', function() { |
|
60 | 60 | return [ |
61 | 61 | 'text' => parse(':information_source: **{{user}}** is deploying branch `{{what}}` to _{{where}}_'), |
62 | 62 | ]; |
63 | 63 | }); |
64 | -set('discord_success_text', function () { |
|
64 | +set('discord_success_text', function() { |
|
65 | 65 | return [ |
66 | 66 | 'text' => parse(':white_check_mark: Branch `{{what}}` deployed to _{{where}}_ successfully'), |
67 | 67 | ]; |
68 | 68 | }); |
69 | -set('discord_failure_text', function () { |
|
69 | +set('discord_failure_text', function() { |
|
70 | 70 | return [ |
71 | 71 | 'text' => parse(':no_entry_sign: Branch `{{what}}` has failed to deploy to _{{where}}_'), |
72 | 72 | ]; |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | set('discord_message', 'discord_notify_text'); |
77 | 77 | |
78 | 78 | // Helpers |
79 | -task('discord_send_message', function () { |
|
79 | +task('discord_send_message', function() { |
|
80 | 80 | $message = get(get('discord_message')); |
81 | 81 | |
82 | 82 | Httpie::post(get('discord_webhook'))->jsonBody($message)->send(); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | // Tasks |
86 | 86 | desc('Tests messages'); |
87 | -task('discord:test', function () { |
|
87 | +task('discord:test', function() { |
|
88 | 88 | set('discord_message', 'discord_notify_text'); |
89 | 89 | invoke('discord_send_message'); |
90 | 90 | set('discord_message', 'discord_success_text'); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | ->once(); |
96 | 96 | |
97 | 97 | desc('Notifies Discord'); |
98 | -task('discord:notify', function () { |
|
98 | +task('discord:notify', function() { |
|
99 | 99 | set('discord_message', 'discord_notify_text'); |
100 | 100 | invoke('discord_send_message'); |
101 | 101 | }) |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | ->isHidden(); |
104 | 104 | |
105 | 105 | desc('Notifies Discord about deploy finish'); |
106 | -task('discord:notify:success', function () { |
|
106 | +task('discord:notify:success', function() { |
|
107 | 107 | set('discord_message', 'discord_success_text'); |
108 | 108 | invoke('discord_send_message'); |
109 | 109 | }) |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | ->isHidden(); |
112 | 112 | |
113 | 113 | desc('Notifies Discord about deploy failure'); |
114 | -task('discord:notify:failure', function () { |
|
114 | +task('discord:notify:failure', function() { |
|
115 | 115 | set('discord_message', 'discord_failure_text'); |
116 | 116 | invoke('discord_send_message'); |
117 | 117 | }) |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | set('yammer_url', 'https://www.yammer.com/api/v1/messages.json'); |
56 | 56 | |
57 | 57 | // Title of project |
58 | -set('yammer_title', function () { |
|
58 | +set('yammer_title', function() { |
|
59 | 59 | return get('application', 'Project'); |
60 | 60 | }); |
61 | 61 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | set('yammer_failure_body', 'Deploy to <strong>{{where}}</strong> failed'); |
66 | 66 | |
67 | 67 | desc('Notifies Yammer'); |
68 | -task('yammer:notify', function () { |
|
68 | +task('yammer:notify', function() { |
|
69 | 69 | $params = [ |
70 | 70 | 'is_rich_text' => 'true', |
71 | 71 | 'message_type' => 'announcement', |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | ->hidden(); |
85 | 85 | |
86 | 86 | desc('Notifies Yammer about deploy finish'); |
87 | -task('yammer:notify:success', function () { |
|
87 | +task('yammer:notify:success', function() { |
|
88 | 88 | $params = [ |
89 | 89 | 'is_rich_text' => 'true', |
90 | 90 | 'message_type' => 'announcement', |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | ->hidden(); |
104 | 104 | |
105 | 105 | desc('Notifies Yammer about deploy failure'); |
106 | -task('yammer:notify:failure', function () { |
|
106 | +task('yammer:notify:failure', function() { |
|
107 | 107 | $params = [ |
108 | 108 | 'is_rich_text' => 'true', |
109 | 109 | 'message_type' => 'announcement', |