@@ -11,6 +11,6 @@ |
||
11 | 11 | localhost('group_b_2') |
12 | 12 | ->setLabels(['node' => 'anna']); |
13 | 13 | |
14 | -task('test_once_per_node', function () { |
|
14 | +task('test_once_per_node', function() { |
|
15 | 15 | writeln('alias: {{alias}} hostname: {{hostname}}'); |
16 | 16 | })->oncePerNode(); |
@@ -4,19 +4,19 @@ |
||
4 | 4 | |
5 | 5 | localhost(); |
6 | 6 | |
7 | -task('named_arguments', function () { |
|
7 | +task('named_arguments', function() { |
|
8 | 8 | run('echo "Hello, $name!"', env: ['name' => 'world']); |
9 | 9 | }); |
10 | 10 | |
11 | -task('options', function () { |
|
11 | +task('options', function() { |
|
12 | 12 | run('echo "Hello, $name!"', ['env' => ['name' => 'Anton']]); |
13 | 13 | }); |
14 | 14 | |
15 | -task('options_with_named_arguments', function () { |
|
15 | +task('options_with_named_arguments', function() { |
|
16 | 16 | // The `options:` arg has higher priority than named arguments. |
17 | 17 | run('echo "Hello, $name!"', ['env' => ['name' => 'override']], env: ['name' => 'world']); |
18 | 18 | }); |
19 | 19 | |
20 | -task('run_locally_named_arguments', function () { |
|
20 | +task('run_locally_named_arguments', function() { |
|
21 | 21 | runLocally('echo "Hello, $name!"', env: ['name' => 'world']); |
22 | 22 | }); |
@@ -120,7 +120,7 @@ |
||
120 | 120 | |
121 | 121 | usort( |
122 | 122 | $updates, |
123 | - function (Update $a, Update $b) { |
|
123 | + function(Update $a, Update $b) { |
|
124 | 124 | return Comparator::isGreaterThan( |
125 | 125 | $a->getVersion(), |
126 | 126 | $b->getVersion(), |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $dealersHand = []; |
81 | 81 | $playersHand = []; |
82 | 82 | shuffle($deck); |
83 | - $deal = function () use (&$deck, &$graveyard) { |
|
83 | + $deal = function() use (&$deck, &$graveyard) { |
|
84 | 84 | if (count($deck) == 0) { |
85 | 85 | shuffle($graveyard); |
86 | 86 | $deck = $graveyard; |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | } |
288 | 288 | $variants = [$value]; |
289 | 289 | while ($aces-- > 0) { |
290 | - $variants = array_flatten(array_map(function ($v) { |
|
290 | + $variants = array_flatten(array_map(function($v) { |
|
291 | 291 | return [$v + 1, $v + 11]; |
292 | 292 | }, $variants)); |
293 | 293 | } |
@@ -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; |
@@ -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 | } |
@@ -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}}; |