@@ -57,15 +57,15 @@ discard block |
||
57 | 57 | */ |
58 | 58 | set('cachetool_url', 'https://github.com/gordalina/cachetool/releases/download/9.0.0/cachetool.phar'); |
59 | 59 | set('cachetool_args', ''); |
60 | -set('bin/cachetool', function () { |
|
60 | +set('bin/cachetool', function() { |
|
61 | 61 | if (!test('[ -f {{release_or_current_path}}/cachetool.phar ]')) { |
62 | 62 | run("cd {{release_or_current_path}} && curl -sLO {{cachetool_url}}"); |
63 | 63 | } |
64 | 64 | return '{{release_or_current_path}}/cachetool.phar'; |
65 | 65 | }); |
66 | -set('cachetool_options', function () { |
|
67 | - $options = (array)get('cachetool'); |
|
68 | - $fullOptions = (string)get('cachetool_args'); |
|
66 | +set('cachetool_options', function() { |
|
67 | + $options = (array) get('cachetool'); |
|
68 | + $fullOptions = (string) get('cachetool_args'); |
|
69 | 69 | $return = []; |
70 | 70 | |
71 | 71 | if ($fullOptions !== '') { |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * Clear opcache cache |
86 | 86 | */ |
87 | 87 | desc('Clears OPcode cache'); |
88 | -task('cachetool:clear:opcache', function () { |
|
88 | +task('cachetool:clear:opcache', function() { |
|
89 | 89 | $options = get('cachetool_options'); |
90 | 90 | foreach ($options as $option) { |
91 | 91 | run("cd {{release_or_current_path}} && {{bin/php}} {{bin/cachetool}} opcache:reset $option"); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * Clear APCu cache |
97 | 97 | */ |
98 | 98 | desc('Clears APCu system cache'); |
99 | -task('cachetool:clear:apcu', function () { |
|
99 | +task('cachetool:clear:apcu', function() { |
|
100 | 100 | $options = get('cachetool_options'); |
101 | 101 | foreach ($options as $option) { |
102 | 102 | run("cd {{release_or_current_path}} && {{bin/php}} {{bin/cachetool}} apcu:cache:clear $option"); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * Clear file status cache, including the realpath cache |
108 | 108 | */ |
109 | 109 | desc('Clears file status and realpath caches'); |
110 | -task('cachetool:clear:stat', function () { |
|
110 | +task('cachetool:clear:stat', function() { |
|
111 | 111 | $options = get('cachetool_options'); |
112 | 112 | foreach ($options as $option) { |
113 | 113 | run("cd {{release_or_current_path}} && {{bin/php}} {{bin/cachetool}} stat:clear $option"); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | desc('Notifies Sentry of deployment'); |
65 | 65 | task( |
66 | 66 | 'deploy:sentry', |
67 | - static function () { |
|
67 | + static function() { |
|
68 | 68 | $now = date('c'); |
69 | 69 | |
70 | 70 | $defaultConfig = [ |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $config = array_merge($defaultConfig, (array) get('sentry')); |
87 | 87 | array_walk( |
88 | 88 | $config, |
89 | - static function (&$value) use ($config) { |
|
89 | + static function(&$value) use ($config) { |
|
90 | 90 | if (is_callable($value)) { |
91 | 91 | $value = $value($config); |
92 | 92 | } |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | |
222 | 222 | function getReleaseGitRef(): Closure |
223 | 223 | { |
224 | - return static function ($config = []): string { |
|
224 | + return static function($config = []): string { |
|
225 | 225 | if (get('update_code_strategy') === 'archive') { |
226 | 226 | if (isset($config['git_version_command'])) { |
227 | 227 | cd('{{deploy_path}}/.dep/repo'); |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | |
245 | 245 | function getGitCommitsRefs(): Closure |
246 | 246 | { |
247 | - return static function ($config = []): array { |
|
247 | + return static function($config = []): array { |
|
248 | 248 | $previousReleaseRevision = getPreviousReleaseRevision(); |
249 | 249 | $currentReleaseRevision = getCurrentReleaseRevision() ?: 'HEAD'; |
250 | 250 | |
@@ -266,13 +266,13 @@ discard block |
||
266 | 266 | $lines = array_filter( |
267 | 267 | // limit number of commits for first release with many commits |
268 | 268 | array_map('trim', array_slice(explode("\n", $result), 0, 200)), |
269 | - static function (string $line): bool { |
|
269 | + static function(string $line): bool { |
|
270 | 270 | return !empty($line) && strpos($line, 'commit') !== 0; |
271 | 271 | } |
272 | 272 | ); |
273 | 273 | |
274 | 274 | return array_map( |
275 | - static function (string $line): array { |
|
275 | + static function(string $line): array { |
|
276 | 276 | [$ref, $authorName, $authorEmail, $timestamp, $message] = explode('#', $line, 5); |
277 | 277 | |
278 | 278 | return [ |
@@ -257,8 +257,7 @@ |
||
257 | 257 | try { |
258 | 258 | if (get('update_code_strategy') === 'archive') { |
259 | 259 | cd('{{deploy_path}}/.dep/repo'); |
260 | - } |
|
261 | - else { |
|
260 | + } else { |
|
262 | 261 | cd('{{release_path}}'); |
263 | 262 | } |
264 | 263 |
@@ -20,22 +20,22 @@ |
||
20 | 20 | |
21 | 21 | use Deployer\Utility\Httpie; |
22 | 22 | |
23 | -set('newrelic_app_id', function () { |
|
23 | +set('newrelic_app_id', function() { |
|
24 | 24 | throw new \Exception('Please, configure "newrelic_app_id" parameter.'); |
25 | 25 | }); |
26 | 26 | |
27 | -set('newrelic_description', function () { |
|
27 | +set('newrelic_description', function() { |
|
28 | 28 | return runLocally('git log -n 1 --format="%an: %s" | tr \'"\' "\'"'); |
29 | 29 | }); |
30 | 30 | |
31 | -set('newrelic_revision', function () { |
|
31 | +set('newrelic_revision', function() { |
|
32 | 32 | return runLocally('git log -n 1 --format="%h"'); |
33 | 33 | }); |
34 | 34 | |
35 | 35 | set('newrelic_endpoint', 'api.newrelic.com'); |
36 | 36 | |
37 | 37 | desc('Notifies New Relic of deployment'); |
38 | -task('newrelic:notify', function () { |
|
38 | +task('newrelic:notify', function() { |
|
39 | 39 | if (($appId = get('newrelic_app_id')) && ($apiKey = get('newrelic_api_key')) && ($endpoint = get('newrelic_endpoint'))) { |
40 | 40 | $data = [ |
41 | 41 | 'user' => get('user'), |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | set('slack_channel', false); |
70 | 70 | |
71 | 71 | // Title of project |
72 | -set('slack_title', function () { |
|
72 | +set('slack_title', function() { |
|
73 | 73 | return get('application', 'Project'); |
74 | 74 | }); |
75 | 75 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | } |
97 | 97 | |
98 | 98 | desc('Notifies Slack'); |
99 | -task('slack:notify', function () { |
|
99 | +task('slack:notify', function() { |
|
100 | 100 | if (!get('slack_webhook', false)) { |
101 | 101 | warning('No Slack webhook configured'); |
102 | 102 | return; |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | ->hidden(); |
117 | 117 | |
118 | 118 | desc('Notifies Slack about deploy finish'); |
119 | -task('slack:notify:success', function () { |
|
119 | +task('slack:notify:success', function() { |
|
120 | 120 | if (!get('slack_webhook', false)) { |
121 | 121 | warning('No Slack webhook configured'); |
122 | 122 | return; |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | ->hidden(); |
138 | 138 | |
139 | 139 | desc('Notifies Slack about deploy failure'); |
140 | -task('slack:notify:failure', function () { |
|
140 | +task('slack:notify:failure', function() { |
|
141 | 141 | if (!get('slack_webhook', false)) { |
142 | 142 | warning('No Slack webhook configured'); |
143 | 143 | return; |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | ->hidden(); |
158 | 158 | |
159 | 159 | desc('Notifies Slack about rollback'); |
160 | -task('slack:notify:rollback', function () { |
|
160 | +task('slack:notify:rollback', function() { |
|
161 | 161 | if (!get('slack_webhook', false)) { |
162 | 162 | warning('No Slack webhook configured'); |
163 | 163 | return; |
@@ -31,14 +31,14 @@ |
||
31 | 31 | namespace Deployer; |
32 | 32 | |
33 | 33 | // Automatically detects by using {{bin/php}}. |
34 | -set('php_fpm_version', function () { |
|
34 | +set('php_fpm_version', function() { |
|
35 | 35 | return run('{{bin/php}} -r "printf(\'%d.%d\', PHP_MAJOR_VERSION, PHP_MINOR_VERSION);"'); |
36 | 36 | }); |
37 | 37 | |
38 | 38 | set('php_fpm_service', 'php{{php_fpm_version}}-fpm'); |
39 | 39 | |
40 | 40 | desc('Reloads the php-fpm service'); |
41 | -task('php-fpm:reload', function () { |
|
41 | +task('php-fpm:reload', function() { |
|
42 | 42 | warning('Avoid reloading php-fpm [ï.at/avoid-php-fpm-reloading]'); |
43 | 43 | run('sudo systemctl reload {{php_fpm_service}}'); |
44 | 44 | }); |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | namespace Deployer; |
21 | 21 | |
22 | 22 | desc('Clears Cloudflare Cache'); |
23 | -task('deploy:cloudflare', function () { |
|
23 | +task('deploy:cloudflare', function() { |
|
24 | 24 | |
25 | 25 | $config = get('cloudflare', []); |
26 | 26 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | ]; |
37 | 37 | } else if (!empty($config['api_token'])) { |
38 | 38 | $headers = [ |
39 | - 'Authorization' => 'Bearer '.$config['api_token'] |
|
39 | + 'Authorization' => 'Bearer ' . $config['api_token'] |
|
40 | 40 | ]; |
41 | 41 | } else { |
42 | 42 | throw new \RuntimeException("Set a service key or email / api key"); |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | |
45 | 45 | $headers['Content-Type'] = 'application/json'; |
46 | 46 | |
47 | - $makeRequest = function ($url, $opts = []) use ($headers) { |
|
47 | + $makeRequest = function($url, $opts = []) use ($headers) { |
|
48 | 48 | $ch = curl_init("https://api.cloudflare.com/client/v4/$url"); |
49 | 49 | |
50 | 50 | $parsedHeaders = []; |
51 | - foreach($headers as $key => $value){ |
|
51 | + foreach ($headers as $key => $value) { |
|
52 | 52 | $parsedHeaders[] = "$key: $value"; |
53 | 53 | } |
54 | 54 |
@@ -20,7 +20,7 @@ |
||
20 | 20 | use Deployer\Utility\Httpie; |
21 | 21 | |
22 | 22 | desc('Notifies Bugsnag of deployment'); |
23 | -task('bugsnag:notify', function () { |
|
23 | +task('bugsnag:notify', function() { |
|
24 | 24 | $data = [ |
25 | 25 | 'apiKey' => get('bugsnag_api_key'), |
26 | 26 | 'releaseStage' => get('target'), |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | if (!is_array($config) || |
34 | 34 | !isset($config['host']) || |
35 | 35 | !isset($config['username']) || |
36 | - !isset($config['password']) ) { |
|
36 | + !isset($config['password'])) { |
|
37 | 37 | throw new \RuntimeException("Please set the following DirectAdmin config:" . PHP_EOL . "set('directadmin', ['host' => '127.0.0.1', 'port' => 2222, 'username' => 'admin', 'password' => 'password']);"); |
38 | 38 | } |
39 | 39 | |
@@ -71,13 +71,13 @@ discard block |
||
71 | 71 | } |
72 | 72 | |
73 | 73 | desc('Creates a database on DirectAdmin'); |
74 | -task('directadmin:createdb', function () { |
|
74 | +task('directadmin:createdb', function() { |
|
75 | 75 | $config = getDirectAdminConfig(); |
76 | 76 | |
77 | 77 | if (!is_array($config) || |
78 | 78 | !isset($config['db_name']) || |
79 | 79 | !isset($config['db_user']) || |
80 | - !isset($config['db_password']) ) { |
|
80 | + !isset($config['db_password'])) { |
|
81 | 81 | throw new \RuntimeException("Please add the following DirectAdmin config:" . PHP_EOL . "add('directadmin', ['db_name' => 'test', 'db_user' => 'test', 'db_password' => '123456']);"); |
82 | 82 | } |
83 | 83 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | }); |
92 | 92 | |
93 | 93 | desc('Deletes a database on DirectAdmin'); |
94 | -task('directadmin:deletedb', function () { |
|
94 | +task('directadmin:deletedb', function() { |
|
95 | 95 | $config = getDirectAdminConfig(); |
96 | 96 | |
97 | 97 | if (!is_array($config) || |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | }); |
107 | 107 | |
108 | 108 | desc('Creates a domain on DirectAdmin'); |
109 | -task('directadmin:createdomain', function () { |
|
109 | +task('directadmin:createdomain', function() { |
|
110 | 110 | $config = getDirectAdminConfig(); |
111 | 111 | |
112 | 112 | if (!is_array($config) || |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | }); |
125 | 125 | |
126 | 126 | desc('Deletes a domain on DirectAdmin'); |
127 | -task('directadmin:deletedomain', function () { |
|
127 | +task('directadmin:deletedomain', function() { |
|
128 | 128 | $config = getDirectAdminConfig(); |
129 | 129 | |
130 | 130 | if (!is_array($config) || |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | }); |
141 | 141 | |
142 | 142 | desc('Symlink your private_html to public_html'); |
143 | -task('directadmin:symlink-private-html', function () { |
|
143 | +task('directadmin:symlink-private-html', function() { |
|
144 | 144 | $config = getDirectAdminConfig(); |
145 | 145 | |
146 | 146 | if (!is_array($config) || |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | }); |
157 | 157 | |
158 | 158 | desc('Changes the PHP version from a domain'); |
159 | -task('directadmin:php-version', function () { |
|
159 | +task('directadmin:php-version', function() { |
|
160 | 160 | $config = getDirectAdminConfig(); |
161 | 161 | |
162 | 162 | if (!is_array($config) || |
@@ -95,7 +95,7 @@ |
||
95 | 95 | throw new \RuntimeException('Please configure "chatwork_room_id" parameter.'); |
96 | 96 | }); |
97 | 97 | set('chatwork_api', function () { |
98 | - return 'https://api.chatwork.com/v2/rooms/' . get('chatwork_room_id') . '/messages'; |
|
98 | + return 'https://api.chatwork.com/v2/rooms/' . get('chatwork_room_id') . '/messages'; |
|
99 | 99 | }); |
100 | 100 | |
101 | 101 | // The Messages |
@@ -88,13 +88,13 @@ discard block |
||
88 | 88 | use Deployer\Utility\Httpie; |
89 | 89 | |
90 | 90 | // Chatwork settings |
91 | -set('chatwork_token', function () { |
|
91 | +set('chatwork_token', function() { |
|
92 | 92 | throw new \RuntimeException('Please configure "chatwork_token" parameter.'); |
93 | 93 | }); |
94 | -set('chatwork_room_id', function () { |
|
94 | +set('chatwork_room_id', function() { |
|
95 | 95 | throw new \RuntimeException('Please configure "chatwork_room_id" parameter.'); |
96 | 96 | }); |
97 | -set('chatwork_api', function () { |
|
97 | +set('chatwork_api', function() { |
|
98 | 98 | return 'https://api.chatwork.com/v2/rooms/' . get('chatwork_room_id') . '/messages'; |
99 | 99 | }); |
100 | 100 | |
@@ -106,14 +106,14 @@ discard block |
||
106 | 106 | // Helpers |
107 | 107 | task('chatwork_send_message', function() { |
108 | 108 | Httpie::post(get('chatwork_api')) |
109 | - ->query(['body' => get('chatwork_message'),]) |
|
109 | + ->query(['body' => get('chatwork_message'), ]) |
|
110 | 110 | ->header("X-ChatWorkToken", get('chatwork_token')) |
111 | 111 | ->send(); |
112 | 112 | }); |
113 | 113 | |
114 | 114 | // Tasks |
115 | 115 | desc('Tests messages'); |
116 | -task('chatwork:test', function () { |
|
116 | +task('chatwork:test', function() { |
|
117 | 117 | set('chatwork_message', get('chatwork_notify_text')); |
118 | 118 | invoke('chatwork_send_message'); |
119 | 119 | set('chatwork_message', get('chatwork_success_text')); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | ->once(); |
125 | 125 | |
126 | 126 | desc('Notifies Chatwork'); |
127 | -task('chatwork:notify', function () { |
|
127 | +task('chatwork:notify', function() { |
|
128 | 128 | if (!get('chatwork_token', false)) { |
129 | 129 | return; |
130 | 130 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | ->hidden(); |
140 | 140 | |
141 | 141 | desc('Notifies Chatwork about deploy finish'); |
142 | -task('chatwork:notify:success', function () { |
|
142 | +task('chatwork:notify:success', function() { |
|
143 | 143 | if (!get('chatwork_token', false)) { |
144 | 144 | return; |
145 | 145 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | ->hidden(); |
156 | 156 | |
157 | 157 | desc('Notifies Chatwork about deploy failure'); |
158 | -task('chatwork:notify:failure', function () { |
|
158 | +task('chatwork:notify:failure', function() { |
|
159 | 159 | if (!get('chatwork_token', false)) { |
160 | 160 | return; |
161 | 161 | } |