@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Deployer; |
| 3 | 3 | |
| 4 | -task('deploy:info', function () { |
|
| 4 | +task('deploy:info', function() { |
|
| 5 | 5 | $what = ''; |
| 6 | 6 | $branch = get('branch'); |
| 7 | 7 | |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | * Determines which branch to deploy. Can be overridden with cli option `--branch`. |
| 8 | 8 | * If not specified, will get current git HEAD branch as default branch to deploy. |
| 9 | 9 | */ |
| 10 | -set('branch', function () { |
|
| 10 | +set('branch', function() { |
|
| 11 | 11 | try { |
| 12 | 12 | $branch = runLocally('git rev-parse --abbrev-ref HEAD'); |
| 13 | 13 | } catch (\Throwable $exception) { |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | * |
| 34 | 34 | * Faster cloning by borrowing objects from existing clones. |
| 35 | 35 | */ |
| 36 | -set('git_cache', function () { |
|
| 36 | +set('git_cache', function() { |
|
| 37 | 37 | $gitVersion = run('{{bin/git}} version'); |
| 38 | 38 | $regs = []; |
| 39 | 39 | if (preg_match('/((\d+\.?)+)/', $gitVersion, $regs)) { |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * Update code at {{release_path}} on host. |
| 49 | 49 | */ |
| 50 | 50 | desc('Update code'); |
| 51 | -task('deploy:update_code', function () { |
|
| 51 | +task('deploy:update_code', function() { |
|
| 52 | 52 | $repository = get('repository'); |
| 53 | 53 | $branch = get('branch'); |
| 54 | 54 | $git = get('bin/git'); |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * Facts |
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | -set('user', function () { |
|
| 29 | +set('user', function() { |
|
| 30 | 30 | if (getenv('CI') !== false) { |
| 31 | 31 | return 'ci'; |
| 32 | 32 | } |
@@ -65,15 +65,15 @@ discard block |
||
| 65 | 65 | set('http_user', false); |
| 66 | 66 | set('http_group', false); |
| 67 | 67 | |
| 68 | -set('clear_paths', []); // Relative path from release_path |
|
| 69 | -set('clear_use_sudo', false); // Using sudo in clean commands? |
|
| 68 | +set('clear_paths', []); // Relative path from release_path |
|
| 69 | +set('clear_use_sudo', false); // Using sudo in clean commands? |
|
| 70 | 70 | |
| 71 | 71 | set('cleanup_use_sudo', false); // Using sudo in cleanup commands? |
| 72 | 72 | |
| 73 | -set('use_relative_symlink', function () { |
|
| 73 | +set('use_relative_symlink', function() { |
|
| 74 | 74 | return commandSupportsOption('ln', '--relative'); |
| 75 | 75 | }); |
| 76 | -set('use_atomic_symlink', function () { |
|
| 76 | +set('use_atomic_symlink', function() { |
|
| 77 | 77 | return commandSupportsOption('mv', '--no-target-directory'); |
| 78 | 78 | }); |
| 79 | 79 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | /** |
| 86 | 86 | * Return current release path. |
| 87 | 87 | */ |
| 88 | -set('current_path', function () { |
|
| 88 | +set('current_path', function() { |
|
| 89 | 89 | $link = run("readlink {{deploy_path}}/current"); |
| 90 | 90 | return substr($link, 0, 1) === '/' ? $link : get('deploy_path') . '/' . $link; |
| 91 | 91 | }); |
@@ -94,15 +94,15 @@ discard block |
||
| 94 | 94 | /** |
| 95 | 95 | * Custom bins |
| 96 | 96 | */ |
| 97 | -set('bin/php', function () { |
|
| 97 | +set('bin/php', function() { |
|
| 98 | 98 | return locateBinaryPath('php'); |
| 99 | 99 | }); |
| 100 | 100 | |
| 101 | -set('bin/git', function () { |
|
| 101 | +set('bin/git', function() { |
|
| 102 | 102 | return locateBinaryPath('git'); |
| 103 | 103 | }); |
| 104 | 104 | |
| 105 | -set('bin/composer', function () { |
|
| 105 | +set('bin/composer', function() { |
|
| 106 | 106 | if (commandExist('composer')) { |
| 107 | 107 | $composer = '{{bin/php}} ' . locateBinaryPath('composer'); |
| 108 | 108 | } |
@@ -115,14 +115,14 @@ discard block |
||
| 115 | 115 | return $composer; |
| 116 | 116 | }); |
| 117 | 117 | |
| 118 | -set('bin/symlink', function () { |
|
| 118 | +set('bin/symlink', function() { |
|
| 119 | 119 | return get('use_relative_symlink') ? 'ln -nfs --relative' : 'ln -nfs'; |
| 120 | 120 | }); |
| 121 | 121 | |
| 122 | 122 | // Path to a file which will store temp script with sudo password. |
| 123 | 123 | // Defaults to `.dep/sudo_pass`. This script is only temporary and will be deleted after |
| 124 | 124 | // sudo command executed. |
| 125 | -set('sudo_askpass', function () { |
|
| 125 | +set('sudo_askpass', function() { |
|
| 126 | 126 | if (test('[ -d {{deploy_path}}/.dep ]')) { |
| 127 | 127 | return '{{deploy_path}}/.dep/sudo_pass'; |
| 128 | 128 | } else { |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | /** |
| 159 | 159 | * Success message |
| 160 | 160 | */ |
| 161 | -task('deploy:success', function () { |
|
| 161 | +task('deploy:success', function() { |
|
| 162 | 162 | info('successfully deployed!'); |
| 163 | 163 | }) |
| 164 | 164 | ->shallow() |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | /** |
| 169 | 169 | * Deploy failure |
| 170 | 170 | */ |
| 171 | -task('deploy:failed', function () { |
|
| 171 | +task('deploy:failed', function() { |
|
| 172 | 172 | })->hidden(); |
| 173 | 173 | |
| 174 | 174 | fail('deploy', 'deploy:failed'); |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | * Follow latest application logs. |
| 178 | 178 | */ |
| 179 | 179 | desc('Follow latest application logs.'); |
| 180 | -task('logs', function () { |
|
| 180 | +task('logs', function() { |
|
| 181 | 181 | if (!has('log_files')) { |
| 182 | 182 | warning("Please, specify \"log_files\" option."); |
| 183 | 183 | return; |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $state = 'root'; |
| 44 | 44 | foreach (explode("\n", $content) as $i => $line) { |
| 45 | 45 | $m = []; |
| 46 | - $match = function ($regexp) use ($line, &$m) { |
|
| 46 | + $match = function($regexp) use ($line, &$m) { |
|
| 47 | 47 | return preg_match("#$regexp#", $line, $m); |
| 48 | 48 | }; |
| 49 | 49 | switch ($state) { |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | $desc = ''; |
| 108 | - if($first && $comment !== '') { |
|
| 108 | + if ($first && $comment !== '') { |
|
| 109 | 109 | $this->comment = $comment; |
| 110 | 110 | } |
| 111 | 111 | $first = false; |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | { |
| 44 | 44 | foreach ($this->recipes as $recipe) { |
| 45 | 45 | // $find will try to return DocConfig for a given config $name. |
| 46 | - $findConfig = function (string $name) use ($recipe): ?DocConfig { |
|
| 46 | + $findConfig = function(string $name) use ($recipe): ?DocConfig { |
|
| 47 | 47 | if (array_key_exists($name, $recipe->config)) { |
| 48 | 48 | return $recipe->config[$name]; |
| 49 | 49 | } |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | return null; |
| 63 | 63 | }; |
| 64 | - $findConfigOverride = function (DocRecipe $recipe, string $name) use (&$findConfigOverride): ?DocConfig { |
|
| 64 | + $findConfigOverride = function(DocRecipe $recipe, string $name) use (&$findConfigOverride): ?DocConfig { |
|
| 65 | 65 | foreach ($recipe->require as $r) { |
| 66 | 66 | if (array_key_exists($r, $this->recipes)) { |
| 67 | 67 | if (array_key_exists($name, $this->recipes[$r]->config)) { |
@@ -77,8 +77,8 @@ discard block |
||
| 77 | 77 | return null; |
| 78 | 78 | }; |
| 79 | 79 | // Replace all {{name}} with link to correct config declaration. |
| 80 | - $replaceLinks = function (string $comment) use ($findConfig): string { |
|
| 81 | - return preg_replace_callback('#(\{\{(?<name>[\w_:]+)\}\})#', function ($m) use ($findConfig) { |
|
| 80 | + $replaceLinks = function(string $comment) use ($findConfig): string { |
|
| 81 | + return preg_replace_callback('#(\{\{(?<name>[\w_:]+)\}\})#', function($m) use ($findConfig) { |
|
| 82 | 82 | $name = $m['name']; |
| 83 | 83 | $config = $findConfig($name); |
| 84 | 84 | if ($config !== null) { |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | return "{{" . $name . "}}"; |
| 90 | 90 | }, $comment); |
| 91 | 91 | }; |
| 92 | - $findTask = function (string $name) use ($recipe): ?DocTask { |
|
| 92 | + $findTask = function(string $name) use ($recipe): ?DocTask { |
|
| 93 | 93 | if (array_key_exists($name, $recipe->tasks)) { |
| 94 | 94 | return $recipe->tasks[$name]; |
| 95 | 95 | } |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | |
| 202 | 202 | function indent($text) |
| 203 | 203 | { |
| 204 | - return implode("\n", array_map(function ($line) { |
|
| 204 | + return implode("\n", array_map(function($line) { |
|
| 205 | 205 | return " " . $line; |
| 206 | 206 | }, explode("\n", $text))); |
| 207 | 207 | } |