@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $labels = $host->get('labels', []); |
54 | 54 | $labels['alias'] = $host->getAlias(); |
55 | 55 | $labels['true'] = 'true'; |
56 | - $isTrue = function ($value) { |
|
56 | + $isTrue = function($value) { |
|
57 | 57 | return $value; |
58 | 58 | }; |
59 | 59 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | private static function compare(string $op, $a, ?string $b): bool |
76 | 76 | { |
77 | - $matchFunction = function ($a, ?string $b) { |
|
77 | + $matchFunction = function($a, ?string $b) { |
|
78 | 78 | foreach ((array) $a as $item) { |
79 | 79 | if ($item === $b) { |
80 | 80 | return true; |
@@ -59,7 +59,7 @@ |
||
59 | 59 | $this->loop, |
60 | 60 | new React\Http\Middleware\StreamingRequestMiddleware(), |
61 | 61 | new React\Http\Middleware\RequestBodyBufferMiddleware(16 * 1024 * 1024), // 16 MiB |
62 | - function (ServerRequestInterface $request) { |
|
62 | + function(ServerRequestInterface $request) { |
|
63 | 63 | try { |
64 | 64 | return $this->router($request); |
65 | 65 | } catch (Throwable $exception) { |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | return 0; |
183 | 183 | } |
184 | 184 | |
185 | - $callback = function (string $output) { |
|
185 | + $callback = function(string $output) { |
|
186 | 186 | $output = preg_replace('/\n$/', '', $output); |
187 | 187 | if (strlen($output) !== 0) { |
188 | 188 | $this->output->writeln($output); |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | /** @var Process[] $processes */ |
193 | 193 | $processes = []; |
194 | 194 | |
195 | - $this->server->loop->futureTick(function () use (&$processes, $hosts, $task) { |
|
195 | + $this->server->loop->futureTick(function() use (&$processes, $hosts, $task) { |
|
196 | 196 | foreach ($hosts as $host) { |
197 | 197 | $processes[] = $this->createProcess($host, $task); |
198 | 198 | } |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | } |
203 | 203 | }); |
204 | 204 | |
205 | - $this->server->loop->addPeriodicTimer(0.03, function ($timer) use (&$processes, $callback) { |
|
205 | + $this->server->loop->addPeriodicTimer(0.03, function($timer) use (&$processes, $callback) { |
|
206 | 206 | $this->gatherOutput($processes, $callback); |
207 | 207 | if ($this->output->isDecorated() && !getenv('CI')) { |
208 | 208 | $this->output->write(spinner()); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | { |
52 | 52 | foreach ($this->recipes as $recipe) { |
53 | 53 | // $find will try to return DocConfig for a given config $name. |
54 | - $findConfig = function (string $name) use ($recipe): ?DocConfig { |
|
54 | + $findConfig = function(string $name) use ($recipe): ?DocConfig { |
|
55 | 55 | if (array_key_exists($name, $recipe->config)) { |
56 | 56 | return $recipe->config[$name]; |
57 | 57 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | } |
70 | 70 | return null; |
71 | 71 | }; |
72 | - $findConfigOverride = function (DocRecipe $recipe, string $name) use (&$findConfigOverride): ?DocConfig { |
|
72 | + $findConfigOverride = function(DocRecipe $recipe, string $name) use (&$findConfigOverride): ?DocConfig { |
|
73 | 73 | foreach ($recipe->require as $r) { |
74 | 74 | if (array_key_exists($r, $this->recipes)) { |
75 | 75 | if (array_key_exists($name, $this->recipes[$r]->config)) { |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | return null; |
86 | 86 | }; |
87 | 87 | // Replace all {{name}} with link to correct config declaration. |
88 | - $replaceLinks = function (string $comment) use ($findConfig): string { |
|
88 | + $replaceLinks = function(string $comment) use ($findConfig): string { |
|
89 | 89 | $output = ''; |
90 | 90 | $code = false; |
91 | 91 | foreach (explode("\n", $comment) as $i => $line) { |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $output .= "\n"; |
98 | 98 | continue; |
99 | 99 | } |
100 | - $output .= preg_replace_callback('#(\{\{(?<name>[\w_:\-/]+)\}\})#', function ($m) use ($findConfig) { |
|
100 | + $output .= preg_replace_callback('#(\{\{(?<name>[\w_:\-/]+)\}\})#', function($m) use ($findConfig) { |
|
101 | 101 | $name = $m['name']; |
102 | 102 | $config = $findConfig($name); |
103 | 103 | if ($config !== null) { |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | } |
112 | 112 | return $output; |
113 | 113 | }; |
114 | - $findTask = function (string $name, bool $searchOtherRecipes = true) use ($recipe): ?DocTask { |
|
114 | + $findTask = function(string $name, bool $searchOtherRecipes = true) use ($recipe): ?DocTask { |
|
115 | 115 | if (array_key_exists($name, $recipe->tasks)) { |
116 | 116 | return $recipe->tasks[$name]; |
117 | 117 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | MARKDOWN; |
172 | 172 | |
173 | - $map = function (DocTask $task, $ident = '') use (&$map, $findTask, &$intro): void { |
|
173 | + $map = function(DocTask $task, $ident = '') use (&$map, $findTask, &$intro): void { |
|
174 | 174 | foreach ($task->group as $taskName) { |
175 | 175 | $t = $findTask($taskName); |
176 | 176 | if ($t !== null) { |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | |
357 | 357 | function indent(string $text): string |
358 | 358 | { |
359 | - return implode("\n", array_map(function ($line) { |
|
359 | + return implode("\n", array_map(function($line) { |
|
360 | 360 | return " " . $line; |
361 | 361 | }, explode("\n", $text))); |
362 | 362 | } |
@@ -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 | } |