@@ -95,19 +95,19 @@ discard block |
||
95 | 95 | new InputOption('file', 'f', InputOption::VALUE_REQUIRED, 'Recipe file path'), |
96 | 96 | ); |
97 | 97 | |
98 | - $this['console'] = function () use ($console) { |
|
98 | + $this['console'] = function() use ($console) { |
|
99 | 99 | return $console; |
100 | 100 | }; |
101 | - $this['input'] = function () { |
|
101 | + $this['input'] = function() { |
|
102 | 102 | throw new \RuntimeException('Uninitialized "input" in Deployer container.'); |
103 | 103 | }; |
104 | - $this['output'] = function () { |
|
104 | + $this['output'] = function() { |
|
105 | 105 | throw new \RuntimeException('Uninitialized "output" in Deployer container.'); |
106 | 106 | }; |
107 | - $this['inputDefinition'] = function () { |
|
107 | + $this['inputDefinition'] = function() { |
|
108 | 108 | return new InputDefinition(); |
109 | 109 | }; |
110 | - $this['questionHelper'] = function () { |
|
110 | + $this['questionHelper'] = function() { |
|
111 | 111 | return $this->getHelper('question'); |
112 | 112 | }; |
113 | 113 | |
@@ -115,12 +115,12 @@ discard block |
||
115 | 115 | * Config * |
116 | 116 | ******************************/ |
117 | 117 | |
118 | - $this['config'] = function () { |
|
118 | + $this['config'] = function() { |
|
119 | 119 | return new Configuration(); |
120 | 120 | }; |
121 | 121 | // -l act as if it had been invoked as a login shell (i.e. source ~/.profile file) |
122 | 122 | // -s commands are read from the standard input (no arguments should remain after this option) |
123 | - $this->config['shell'] = function () { |
|
123 | + $this->config['shell'] = function() { |
|
124 | 124 | if (currentHost() instanceof Localhost) { |
125 | 125 | return 'bash -s'; // Non-login shell for localhost. |
126 | 126 | } |
@@ -133,43 +133,43 @@ discard block |
||
133 | 133 | * Core * |
134 | 134 | ******************************/ |
135 | 135 | |
136 | - $this['pop'] = function ($c) { |
|
136 | + $this['pop'] = function($c) { |
|
137 | 137 | return new Printer($c['output']); |
138 | 138 | }; |
139 | - $this['sshClient'] = function ($c) { |
|
139 | + $this['sshClient'] = function($c) { |
|
140 | 140 | return new Client($c['output'], $c['pop'], $c['logger']); |
141 | 141 | }; |
142 | - $this['rsync'] = function ($c) { |
|
142 | + $this['rsync'] = function($c) { |
|
143 | 143 | return new Rsync($c['pop'], $c['output']); |
144 | 144 | }; |
145 | - $this['processRunner'] = function ($c) { |
|
145 | + $this['processRunner'] = function($c) { |
|
146 | 146 | return new ProcessRunner($c['pop'], $c['logger']); |
147 | 147 | }; |
148 | - $this['tasks'] = function () { |
|
148 | + $this['tasks'] = function() { |
|
149 | 149 | return new TaskCollection(); |
150 | 150 | }; |
151 | - $this['hosts'] = function () { |
|
151 | + $this['hosts'] = function() { |
|
152 | 152 | return new HostCollection(); |
153 | 153 | }; |
154 | - $this['scriptManager'] = function ($c) { |
|
154 | + $this['scriptManager'] = function($c) { |
|
155 | 155 | return new ScriptManager($c['tasks']); |
156 | 156 | }; |
157 | - $this['selector'] = function ($c) { |
|
157 | + $this['selector'] = function($c) { |
|
158 | 158 | return new Selector($c['hosts']); |
159 | 159 | }; |
160 | - $this['fail'] = function () { |
|
160 | + $this['fail'] = function() { |
|
161 | 161 | return new Collection(); |
162 | 162 | }; |
163 | - $this['messenger'] = function ($c) { |
|
163 | + $this['messenger'] = function($c) { |
|
164 | 164 | return new Messenger($c['input'], $c['output'], $c['logger']); |
165 | 165 | }; |
166 | - $this['server'] = function ($c) { |
|
166 | + $this['server'] = function($c) { |
|
167 | 167 | return new Server( |
168 | 168 | $c['output'], |
169 | 169 | $this, |
170 | 170 | ); |
171 | 171 | }; |
172 | - $this['master'] = function ($c) { |
|
172 | + $this['master'] = function($c) { |
|
173 | 173 | return new Master( |
174 | 174 | $c['input'], |
175 | 175 | $c['output'], |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | $c['messenger'], |
178 | 178 | ); |
179 | 179 | }; |
180 | - $this['importer'] = function () { |
|
180 | + $this['importer'] = function() { |
|
181 | 181 | return new Importer(); |
182 | 182 | }; |
183 | 183 | |
@@ -185,12 +185,12 @@ discard block |
||
185 | 185 | * Logger * |
186 | 186 | ******************************/ |
187 | 187 | |
188 | - $this['log_handler'] = function () { |
|
188 | + $this['log_handler'] = function() { |
|
189 | 189 | return !empty($this['log']) |
190 | 190 | ? new FileHandler($this['log']) |
191 | 191 | : new NullHandler(); |
192 | 192 | }; |
193 | - $this['logger'] = function () { |
|
193 | + $this['logger'] = function() { |
|
194 | 194 | return new Logger($this['log_handler']); |
195 | 195 | }; |
196 | 196 | |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | $output->writeln([ |
336 | 336 | "<fg=white;bg=red> {$class} </> <comment>in {$file} on line {$exception->getLine()}:</>", |
337 | 337 | "", |
338 | - implode("\n", array_map(function ($line) { |
|
338 | + implode("\n", array_map(function($line) { |
|
339 | 339 | return " " . $line; |
340 | 340 | }, explode("\n", $exception->getMessage()))), |
341 | 341 | "", |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * Silverstripe configuration |
11 | 11 | */ |
12 | 12 | |
13 | -set('shared_assets', function () { |
|
13 | +set('shared_assets', function() { |
|
14 | 14 | if (test('[ -d {{release_or_current_path}}/public ]') || test('[ -d {{deploy_path}}/shared/public ]')) { |
15 | 15 | return 'public/assets'; |
16 | 16 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | ]); |
30 | 30 | |
31 | 31 | // Silverstripe cli script |
32 | -set('silverstripe_cli_script', function () { |
|
32 | +set('silverstripe_cli_script', function() { |
|
33 | 33 | $paths = [ |
34 | 34 | 'framework/cli-script.php', |
35 | 35 | 'vendor/silverstripe/framework/cli-script.php', |
@@ -45,12 +45,12 @@ discard block |
||
45 | 45 | * Helper tasks |
46 | 46 | */ |
47 | 47 | desc('Runs /dev/build'); |
48 | -task('silverstripe:build', function () { |
|
48 | +task('silverstripe:build', function() { |
|
49 | 49 | run('{{bin/php}} {{release_or_current_path}}/{{silverstripe_cli_script}} /dev/build'); |
50 | 50 | }); |
51 | 51 | |
52 | 52 | desc('Runs /dev/build?flush=all'); |
53 | -task('silverstripe:buildflush', function () { |
|
53 | +task('silverstripe:buildflush', function() { |
|
54 | 54 | run('{{bin/php}} {{release_or_current_path}}/{{silverstripe_cli_script}} /dev/build flush=all'); |
55 | 55 | }); |
56 | 56 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | // Used in `chown` and `acl` modes of {{writable_mode}}. |
7 | 7 | // Attempts automatically to detect http user in process list. |
8 | 8 | |
9 | -set('http_user', function () { |
|
9 | +set('http_user', function() { |
|
10 | 10 | $candidates = explode("\n", run("ps axo comm,user | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | sort | awk '{print \$NF}' | uniq")); |
11 | 11 | $httpUser = array_shift($candidates); |
12 | 12 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | // Used to make a writable directory by a server. |
24 | 24 | // Used in `chgrp` mode of {{writable_mode}} only. |
25 | 25 | // Attempts automatically to detect http user in process list. |
26 | -set('http_group', function () { |
|
26 | +set('http_group', function() { |
|
27 | 27 | $candidates = explode("\n", run("ps axo comm,group | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | sort | awk '{print \$NF}' | uniq")); |
28 | 28 | $httpGroup = array_shift($candidates); |
29 | 29 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | set('writable_chmod_mode', '0755'); |
60 | 60 | |
61 | 61 | desc('Makes writable dirs'); |
62 | -task('deploy:writable', function () { |
|
62 | +task('deploy:writable', function() { |
|
63 | 63 | $dirs = join(' ', get('writable_dirs')); |
64 | 64 | $mode = get('writable_mode'); |
65 | 65 | $recursive = get('writable_recursive') ? '-R' : ''; |
@@ -3,7 +3,7 @@ |
||
3 | 3 | namespace Deployer; |
4 | 4 | |
5 | 5 | desc('Prepares host for deploy'); |
6 | -task('deploy:setup', function () { |
|
6 | +task('deploy:setup', function() { |
|
7 | 7 | run( |
8 | 8 | <<<EOF |
9 | 9 | [ -d {{deploy_path}} ] || mkdir -p {{deploy_path}}; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | |
33 | 33 | //Create and upload Drupal 7 settings.php using values from secrets |
34 | -task('drupal:settings', function () { |
|
34 | +task('drupal:settings', function() { |
|
35 | 35 | if (askConfirmation('Are you sure to generate and upload settings.php file?')) { |
36 | 36 | |
37 | 37 | //Get template |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | }); |
74 | 74 | |
75 | 75 | //Upload Drupal 7 files folder |
76 | -task('drupal:upload_files', function () { |
|
76 | +task('drupal:upload_files', function() { |
|
77 | 77 | if (askConfirmation('Are you sure?')) { |
78 | 78 | upload('sites/{{drupal_site}}/files', '{{deploy_path}}/shared/sites/{{drupal_site}}/files'); |
79 | 79 | } |
@@ -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 |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | // Update using: `set('static_content_jobs', '1');` |
65 | 65 | set('static_content_jobs', '1'); |
66 | 66 | |
67 | -set('content_version', function () { |
|
67 | +set('content_version', function() { |
|
68 | 68 | return time(); |
69 | 69 | }); |
70 | 70 | |
@@ -109,14 +109,14 @@ discard block |
||
109 | 109 | |
110 | 110 | set('bin/magento', '{{release_or_current_path}}/{{magento_dir}}/bin/magento'); |
111 | 111 | |
112 | -set('magento_version', function () { |
|
112 | +set('magento_version', function() { |
|
113 | 113 | // detect version |
114 | 114 | $versionOutput = run('{{bin/php}} {{bin/magento}} --version'); |
115 | 115 | preg_match('/(\d+\.?)+(-p\d+)?$/', $versionOutput, $matches); |
116 | 116 | return $matches[0] ?? '2.0'; |
117 | 117 | }); |
118 | 118 | |
119 | -set('config_import_needed', function () { |
|
119 | +set('config_import_needed', function() { |
|
120 | 120 | // detect if app:config:import is needed |
121 | 121 | try { |
122 | 122 | run('{{bin/php}} {{bin/magento}} app:config:status'); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | return false; |
131 | 131 | }); |
132 | 132 | |
133 | -set('database_upgrade_needed', function () { |
|
133 | +set('database_upgrade_needed', function() { |
|
134 | 134 | // detect if setup:upgrade is needed |
135 | 135 | try { |
136 | 136 | run('{{bin/php}} {{bin/magento}} setup:db:status'); |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | // 'MAGE_MODE' => 'production' |
166 | 166 | // ``` |
167 | 167 | desc('Compiles magento di'); |
168 | -task('magento:compile', function () { |
|
168 | +task('magento:compile', function() { |
|
169 | 169 | run("{{bin/php}} {{bin/magento}} setup:di:compile"); |
170 | 170 | run('cd {{release_or_current_path}}/{{magento_dir}} && {{bin/composer}} dump-autoload -o'); |
171 | 171 | }); |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | // ] |
192 | 192 | // ``` |
193 | 193 | desc('Deploys assets'); |
194 | -task('magento:deploy:assets', function () { |
|
194 | +task('magento:deploy:assets', function() { |
|
195 | 195 | $themesToCompile = ''; |
196 | 196 | if (get('split_static_deployment')) { |
197 | 197 | invoke('magento:deploy:assets:adminhtml'); |
@@ -208,12 +208,12 @@ discard block |
||
208 | 208 | }); |
209 | 209 | |
210 | 210 | desc('Deploys assets for backend only'); |
211 | -task('magento:deploy:assets:adminhtml', function () { |
|
211 | +task('magento:deploy:assets:adminhtml', function() { |
|
212 | 212 | magentoDeployAssetsSplit('backend'); |
213 | 213 | }); |
214 | 214 | |
215 | 215 | desc('Deploys assets for frontend only'); |
216 | -task('magento:deploy:assets:frontend', function () { |
|
216 | +task('magento:deploy:assets:frontend', function() { |
|
217 | 217 | magentoDeployAssetsSplit('frontend'); |
218 | 218 | }); |
219 | 219 | |
@@ -261,9 +261,9 @@ discard block |
||
261 | 261 | } |
262 | 262 | |
263 | 263 | desc('Syncs content version'); |
264 | -task('magento:sync:content_version', function () { |
|
264 | +task('magento:sync:content_version', function() { |
|
265 | 265 | $timestamp = time(); |
266 | - on(select('all'), function (Host $host) use ($timestamp) { |
|
266 | + on(select('all'), function(Host $host) use ($timestamp) { |
|
267 | 267 | $host->set('content_version', $timestamp); |
268 | 268 | }); |
269 | 269 | })->once(); |
@@ -271,26 +271,25 @@ discard block |
||
271 | 271 | before('magento:deploy:assets', 'magento:sync:content_version'); |
272 | 272 | |
273 | 273 | desc('Enables maintenance mode'); |
274 | -task('magento:maintenance:enable', function () { |
|
274 | +task('magento:maintenance:enable', function() { |
|
275 | 275 | // do not use {{bin/magento}} because it would be in "release" but the maintenance mode must be set in "current" |
276 | 276 | run("if [ -d $(echo {{current_path}}) ]; then {{bin/php}} {{current_path}}/{{magento_dir}}/bin/magento maintenance:enable; fi"); |
277 | 277 | }); |
278 | 278 | |
279 | 279 | desc('Disables maintenance mode'); |
280 | -task('magento:maintenance:disable', function () { |
|
280 | +task('magento:maintenance:disable', function() { |
|
281 | 281 | // do not use {{bin/magento}} because it would be in "release" but the maintenance mode must be set in "current" |
282 | 282 | run("if [ -d $(echo {{current_path}}) ]; then {{bin/php}} {{current_path}}/{{magento_dir}}/bin/magento maintenance:disable; fi"); |
283 | 283 | }); |
284 | 284 | |
285 | 285 | desc('Set maintenance mode if needed'); |
286 | -task('magento:maintenance:enable-if-needed', function () { |
|
287 | - ! get('enable_zerodowntime') || get('database_upgrade_needed') || get('config_import_needed') ? |
|
288 | - invoke('magento:maintenance:enable') : |
|
289 | - writeln('Config and database up to date => no maintenance mode'); |
|
286 | +task('magento:maintenance:enable-if-needed', function() { |
|
287 | + !get('enable_zerodowntime') || get('database_upgrade_needed') || get('config_import_needed') ? |
|
288 | + invoke('magento:maintenance:enable') : writeln('Config and database up to date => no maintenance mode'); |
|
290 | 289 | }); |
291 | 290 | |
292 | 291 | desc('Config Import'); |
293 | -task('magento:config:import', function () { |
|
292 | +task('magento:config:import', function() { |
|
294 | 293 | if (get('config_import_needed')) { |
295 | 294 | run('{{bin/php}} {{bin/magento}} app:config:import --no-interaction'); |
296 | 295 | } else { |
@@ -299,7 +298,7 @@ discard block |
||
299 | 298 | }); |
300 | 299 | |
301 | 300 | desc('Upgrades magento database'); |
302 | -task('magento:upgrade:db', function () { |
|
301 | +task('magento:upgrade:db', function() { |
|
303 | 302 | if (get('database_upgrade_needed')) { |
304 | 303 | run("{{bin/php}} {{bin/magento}} setup:db-schema:upgrade --no-interaction"); |
305 | 304 | run("{{bin/php}} {{bin/magento}} setup:db-data:upgrade --no-interaction"); |
@@ -309,7 +308,7 @@ discard block |
||
309 | 308 | })->once(); |
310 | 309 | |
311 | 310 | desc('Flushes Magento Cache'); |
312 | -task('magento:cache:flush', function () { |
|
311 | +task('magento:cache:flush', function() { |
|
313 | 312 | run("{{bin/php}} {{bin/magento}} cache:flush"); |
314 | 313 | }); |
315 | 314 | |
@@ -360,7 +359,7 @@ discard block |
||
360 | 359 | set('repository', null); |
361 | 360 | |
362 | 361 | // The relative path to the artifact file. If the directory does not exist, it will be created |
363 | -set('artifact_path', function () { |
|
362 | +set('artifact_path', function() { |
|
364 | 363 | if (!testLocally('[ -d {{artifact_dir}} ]')) { |
365 | 364 | runLocally('mkdir -p {{artifact_dir}}'); |
366 | 365 | } |
@@ -368,7 +367,7 @@ discard block |
||
368 | 367 | }); |
369 | 368 | |
370 | 369 | // The location of the tar command. On MacOS you should have installed gtar, as it supports the required settings |
371 | -set('bin/tar', function () { |
|
370 | +set('bin/tar', function() { |
|
372 | 371 | if (commandExist('gtar')) { |
373 | 372 | return which('gtar'); |
374 | 373 | } else { |
@@ -379,7 +378,7 @@ discard block |
||
379 | 378 | // tasks section |
380 | 379 | |
381 | 380 | desc('Packages all relevant files in an artifact.'); |
382 | -task('artifact:package', function () { |
|
381 | +task('artifact:package', function() { |
|
383 | 382 | if (!test('[ -f {{artifact_excludes_file}} ]')) { |
384 | 383 | throw new GracefulShutdownException( |
385 | 384 | "No artifact excludes file provided, provide one at artifacts/excludes or change location", |
@@ -389,23 +388,23 @@ discard block |
||
389 | 388 | }); |
390 | 389 | |
391 | 390 | desc('Uploads artifact in release folder for extraction.'); |
392 | -task('artifact:upload', function () { |
|
391 | +task('artifact:upload', function() { |
|
393 | 392 | upload(get('artifact_path'), '{{release_path}}'); |
394 | 393 | }); |
395 | 394 | |
396 | 395 | desc('Extracts artifact in release path.'); |
397 | -task('artifact:extract', function () { |
|
396 | +task('artifact:extract', function() { |
|
398 | 397 | run('{{bin/tar}} -xzpf {{release_path}}/{{artifact_file}} -C {{release_path}}'); |
399 | 398 | run('rm -rf {{release_path}}/{{artifact_file}}'); |
400 | 399 | }); |
401 | 400 | |
402 | 401 | desc('Clears generated files prior to building.'); |
403 | -task('build:remove-generated', function () { |
|
402 | +task('build:remove-generated', function() { |
|
404 | 403 | run('rm -rf generated/*'); |
405 | 404 | }); |
406 | 405 | |
407 | 406 | desc('Prepare local artifact build'); |
408 | -task('build:prepare', function () { |
|
407 | +task('build:prepare', function() { |
|
409 | 408 | if (!currentHost()->get('local')) { |
410 | 409 | throw new GracefulShutdownException('Artifact can only be built locally, you provided a non local host'); |
411 | 410 | } |
@@ -446,7 +445,7 @@ discard block |
||
446 | 445 | |
447 | 446 | |
448 | 447 | desc('Adds additional files and dirs to the list of shared files and dirs'); |
449 | -task('deploy:additional-shared', function () { |
|
448 | +task('deploy:additional-shared', function() { |
|
450 | 449 | add('shared_files', get('additional_shared_files')); |
451 | 450 | add('shared_dirs', get('additional_shared_dirs')); |
452 | 451 | }); |
@@ -461,7 +460,7 @@ discard block |
||
461 | 460 | * ``` |
462 | 461 | **/ |
463 | 462 | desc('Update cache id_prefix'); |
464 | -task('magento:set_cache_prefix', function () { |
|
463 | +task('magento:set_cache_prefix', function() { |
|
465 | 464 | //download current env config |
466 | 465 | $tmpConfigFile = tempnam(sys_get_temp_dir(), 'deployer_config'); |
467 | 466 | download('{{deploy_path}}/shared/' . ENV_CONFIG_FILE_PATH, $tmpConfigFile); |
@@ -501,7 +500,7 @@ discard block |
||
501 | 500 | * After successful deployment, move the tmp_env.php file to env.php ready for next deployment |
502 | 501 | */ |
503 | 502 | desc('Cleanup cache id_prefix env files'); |
504 | -task('magento:cleanup_cache_prefix', function () { |
|
503 | +task('magento:cleanup_cache_prefix', function() { |
|
505 | 504 | run('rm {{deploy_path}}/shared/' . ENV_CONFIG_FILE_PATH); |
506 | 505 | run('rm {{release_or_current_path}}/' . ENV_CONFIG_FILE_PATH); |
507 | 506 | run('mv {{deploy_path}}/shared/' . TMP_ENV_CONFIG_FILE_PATH . ' {{deploy_path}}/shared/' . ENV_CONFIG_FILE_PATH); |
@@ -517,7 +516,7 @@ discard block |
||
517 | 516 | * ``` |
518 | 517 | */ |
519 | 518 | desc('Remove cron from crontab and kill running cron jobs'); |
520 | -task('magento:cron:stop', function () { |
|
519 | +task('magento:cron:stop', function() { |
|
521 | 520 | if (has('previous_release')) { |
522 | 521 | run('{{bin/php}} {{previous_release}}/{{magento_dir}}/bin/magento cron:remove'); |
523 | 522 | } |
@@ -533,7 +532,7 @@ discard block |
||
533 | 532 | * ``` |
534 | 533 | */ |
535 | 534 | desc('Install cron in crontab'); |
536 | -task('magento:cron:install', function () { |
|
535 | +task('magento:cron:install', function() { |
|
537 | 536 | run('cd {{release_or_current_path}}'); |
538 | 537 | run('{{bin/php}} {{bin/magento}} cron:install'); |
539 | 538 | }); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | // Name of current user who is running deploy. |
28 | 28 | // If not set will try automatically get git user name, |
29 | 29 | // otherwise output of `whoami` command. |
30 | -set('user', function () { |
|
30 | +set('user', function() { |
|
31 | 31 | if (getenv('CI') !== false) { |
32 | 32 | return 'ci'; |
33 | 33 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * set('deploy_path', '~/{{alias}}'); |
88 | 88 | * ``` |
89 | 89 | */ |
90 | -set('deploy_path', function () { |
|
90 | +set('deploy_path', function() { |
|
91 | 91 | throw new ConfigurationException('Please, specify `deploy_path`.'); |
92 | 92 | }); |
93 | 93 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | set('current_path', '{{deploy_path}}/current'); |
101 | 101 | |
102 | 102 | // Path to the `php` bin. |
103 | -set('bin/php', function () { |
|
103 | +set('bin/php', function() { |
|
104 | 104 | if (currentHost()->hasOwn('php_version')) { |
105 | 105 | return '/usr/bin/php{{php_version}}'; |
106 | 106 | } |
@@ -108,25 +108,25 @@ discard block |
||
108 | 108 | }); |
109 | 109 | |
110 | 110 | // Path to the `git` bin. |
111 | -set('bin/git', function () { |
|
111 | +set('bin/git', function() { |
|
112 | 112 | return which('git'); |
113 | 113 | }); |
114 | 114 | |
115 | 115 | // Should {{bin/symlink}} use `--relative` option or not. Will detect |
116 | 116 | // automatically. |
117 | -set('use_relative_symlink', function () { |
|
117 | +set('use_relative_symlink', function() { |
|
118 | 118 | return commandSupportsOption('ln', '--relative'); |
119 | 119 | }); |
120 | 120 | |
121 | 121 | // Path to the `ln` bin. With predefined options `-nfs`. |
122 | -set('bin/symlink', function () { |
|
122 | +set('bin/symlink', function() { |
|
123 | 123 | return get('use_relative_symlink') ? 'ln -nfs --relative' : 'ln -nfs'; |
124 | 124 | }); |
125 | 125 | |
126 | 126 | // Path to a file which will store temp script with sudo password. |
127 | 127 | // Defaults to `.dep/sudo_pass`. This script is only temporary and will be deleted after |
128 | 128 | // sudo command executed. |
129 | -set('sudo_askpass', function () { |
|
129 | +set('sudo_askpass', function() { |
|
130 | 130 | if (test('[ -d {{deploy_path}}/.dep ]')) { |
131 | 131 | return '{{deploy_path}}/.dep/sudo_pass'; |
132 | 132 | } else { |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | /** |
164 | 164 | * Prints success message |
165 | 165 | */ |
166 | -task('deploy:success', function () { |
|
166 | +task('deploy:success', function() { |
|
167 | 167 | info('successfully deployed!'); |
168 | 168 | }) |
169 | 169 | ->hidden(); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | /** |
173 | 173 | * Hook on deploy failure. |
174 | 174 | */ |
175 | -task('deploy:failed', function () {}) |
|
175 | +task('deploy:failed', function() {}) |
|
176 | 176 | ->hidden(); |
177 | 177 | |
178 | 178 | fail('deploy', 'deploy:failed'); |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * Follows latest application logs. |
182 | 182 | */ |
183 | 183 | desc('Shows application logs'); |
184 | -task('logs:app', function () { |
|
184 | +task('logs:app', function() { |
|
185 | 185 | if (!has('log_files')) { |
186 | 186 | warning("Please, specify \"log_files\" option."); |
187 | 187 | return; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | public function testTask() |
72 | 72 | { |
73 | - task('task', function () {}); |
|
73 | + task('task', function() {}); |
|
74 | 74 | |
75 | 75 | $task = $this->deployer->tasks->get('task'); |
76 | 76 | self::assertInstanceOf(Task::class, $task); |
@@ -85,10 +85,10 @@ discard block |
||
85 | 85 | |
86 | 86 | public function testBefore() |
87 | 87 | { |
88 | - task('main', function () {}); |
|
89 | - task('before', function () {}); |
|
88 | + task('main', function() {}); |
|
89 | + task('before', function() {}); |
|
90 | 90 | before('main', 'before'); |
91 | - before('before', function () {}); |
|
91 | + before('before', function() {}); |
|
92 | 92 | |
93 | 93 | $names = $this->taskToNames($this->deployer->scriptManager->getTasks('main')); |
94 | 94 | self::assertEquals(['before:before', 'before', 'main'], $names); |
@@ -96,10 +96,10 @@ discard block |
||
96 | 96 | |
97 | 97 | public function testAfter() |
98 | 98 | { |
99 | - task('main', function () {}); |
|
100 | - task('after', function () {}); |
|
99 | + task('main', function() {}); |
|
100 | + task('after', function() {}); |
|
101 | 101 | after('main', 'after'); |
102 | - after('after', function () {}); |
|
102 | + after('after', function() {}); |
|
103 | 103 | |
104 | 104 | $names = $this->taskToNames($this->deployer->scriptManager->getTasks('main')); |
105 | 105 | self::assertEquals(['main', 'after', 'after:after'], $names); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | { |
131 | 131 | Context::get()->getConfig()->set('working_path', '/foo'); |
132 | 132 | |
133 | - within('/bar', function () { |
|
133 | + within('/bar', function() { |
|
134 | 134 | $withinWorkingPath = Context::get()->getConfig()->get('working_path'); |
135 | 135 | self::assertEquals('/bar', $withinWorkingPath); |
136 | 136 | }); |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | Context::get()->getConfig()->set('working_path', '/foo'); |
145 | 145 | |
146 | 146 | try { |
147 | - within('/bar', function () { |
|
147 | + within('/bar', function() { |
|
148 | 148 | throw new \Exception('Dummy exception'); |
149 | 149 | }); |
150 | 150 | } catch (\Exception $exception) { |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | public function testWithinReturningValue() |
159 | 159 | { |
160 | - $output = within('/foo', function () { |
|
160 | + $output = within('/foo', function() { |
|
161 | 161 | return 'bar'; |
162 | 162 | }); |
163 | 163 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | |
167 | 167 | public function testWithinWithVoidFunction() |
168 | 168 | { |
169 | - $output = within('/foo', function () { |
|
169 | + $output = within('/foo', function() { |
|
170 | 170 | // noop |
171 | 171 | }); |
172 | 172 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | |
176 | 176 | private function taskToNames($tasks) |
177 | 177 | { |
178 | - return array_map(function (Task $task) { |
|
178 | + return array_map(function(Task $task) { |
|
179 | 179 | return $task->getName(); |
180 | 180 | }, $tasks); |
181 | 181 | } |