@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | use Deployer\Utility\Httpie; |
64 | 64 | |
65 | -set('rockchat_title', function () { |
|
65 | +set('rockchat_title', function() { |
|
66 | 66 | return get('application', 'Project'); |
67 | 67 | }); |
68 | 68 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | set('rocketchat_failure_text', 'Deploy to *{{where}}* failed'); |
84 | 84 | |
85 | 85 | desc('Notifies RocketChat'); |
86 | -task('rocketchat:notify', function () { |
|
86 | +task('rocketchat:notify', function() { |
|
87 | 87 | if (null === get('rocketchat_webhook')) { |
88 | 88 | return; |
89 | 89 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | }); |
114 | 114 | |
115 | 115 | desc('Notifies RocketChat about deploy finish'); |
116 | -task('rocketchat:notify:success', function () { |
|
116 | +task('rocketchat:notify:success', function() { |
|
117 | 117 | if (null === get('rocketchat_webhook')) { |
118 | 118 | return; |
119 | 119 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | }); |
144 | 144 | |
145 | 145 | desc('Notifies RocketChat about deploy failure'); |
146 | -task('rocketchat:notify:failure', function () { |
|
146 | +task('rocketchat:notify:failure', function() { |
|
147 | 147 | if (null === get('rocketchat_webhook')) { |
148 | 148 | return; |
149 | 149 | } |
@@ -27,7 +27,7 @@ |
||
27 | 27 | set('rollbar_comment', '_{{user}}_ deploying `{{what}}` to *{{where}}*'); |
28 | 28 | |
29 | 29 | desc('Notifies Rollbar of deployment'); |
30 | -task('rollbar:notify', function () { |
|
30 | +task('rollbar:notify', function() { |
|
31 | 31 | if (!get('rollbar_token', false)) { |
32 | 32 | return; |
33 | 33 | } |
@@ -51,22 +51,22 @@ discard block |
||
51 | 51 | use Deployer\Task\Context; |
52 | 52 | use Deployer\Utility\Httpie; |
53 | 53 | |
54 | -set('discord_webhook', function () { |
|
54 | +set('discord_webhook', function() { |
|
55 | 55 | return 'https://discordapp.com/api/webhooks/{{discord_channel}}/{{discord_token}}/slack'; |
56 | 56 | }); |
57 | 57 | |
58 | 58 | // Deploy messages |
59 | -set('discord_notify_text', function () { |
|
59 | +set('discord_notify_text', function() { |
|
60 | 60 | return [ |
61 | 61 | 'text' => parse(':information_source: **{{user}}** is deploying branch `{{what}}` to _{{where}}_'), |
62 | 62 | ]; |
63 | 63 | }); |
64 | -set('discord_success_text', function () { |
|
64 | +set('discord_success_text', function() { |
|
65 | 65 | return [ |
66 | 66 | 'text' => parse(':white_check_mark: Branch `{{what}}` deployed to _{{where}}_ successfully'), |
67 | 67 | ]; |
68 | 68 | }); |
69 | -set('discord_failure_text', function () { |
|
69 | +set('discord_failure_text', function() { |
|
70 | 70 | return [ |
71 | 71 | 'text' => parse(':no_entry_sign: Branch `{{what}}` has failed to deploy to _{{where}}_'), |
72 | 72 | ]; |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | set('discord_message', 'discord_notify_text'); |
77 | 77 | |
78 | 78 | // Helpers |
79 | -task('discord_send_message', function () { |
|
79 | +task('discord_send_message', function() { |
|
80 | 80 | $message = get(get('discord_message')); |
81 | 81 | |
82 | 82 | Httpie::post(get('discord_webhook'))->jsonBody($message)->send(); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | // Tasks |
86 | 86 | desc('Tests messages'); |
87 | -task('discord:test', function () { |
|
87 | +task('discord:test', function() { |
|
88 | 88 | set('discord_message', 'discord_notify_text'); |
89 | 89 | invoke('discord_send_message'); |
90 | 90 | set('discord_message', 'discord_success_text'); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | ->once(); |
96 | 96 | |
97 | 97 | desc('Notifies Discord'); |
98 | -task('discord:notify', function () { |
|
98 | +task('discord:notify', function() { |
|
99 | 99 | set('discord_message', 'discord_notify_text'); |
100 | 100 | invoke('discord_send_message'); |
101 | 101 | }) |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | ->isHidden(); |
104 | 104 | |
105 | 105 | desc('Notifies Discord about deploy finish'); |
106 | -task('discord:notify:success', function () { |
|
106 | +task('discord:notify:success', function() { |
|
107 | 107 | set('discord_message', 'discord_success_text'); |
108 | 108 | invoke('discord_send_message'); |
109 | 109 | }) |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | ->isHidden(); |
112 | 112 | |
113 | 113 | desc('Notifies Discord about deploy failure'); |
114 | -task('discord:notify:failure', function () { |
|
114 | +task('discord:notify:failure', function() { |
|
115 | 115 | set('discord_message', 'discord_failure_text'); |
116 | 116 | invoke('discord_send_message'); |
117 | 117 | }) |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | set('yammer_url', 'https://www.yammer.com/api/v1/messages.json'); |
56 | 56 | |
57 | 57 | // Title of project |
58 | -set('yammer_title', function () { |
|
58 | +set('yammer_title', function() { |
|
59 | 59 | return get('application', 'Project'); |
60 | 60 | }); |
61 | 61 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | set('yammer_failure_body', 'Deploy to <strong>{{where}}</strong> failed'); |
66 | 66 | |
67 | 67 | desc('Notifies Yammer'); |
68 | -task('yammer:notify', function () { |
|
68 | +task('yammer:notify', function() { |
|
69 | 69 | $params = [ |
70 | 70 | 'is_rich_text' => 'true', |
71 | 71 | 'message_type' => 'announcement', |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | ->hidden(); |
85 | 85 | |
86 | 86 | desc('Notifies Yammer about deploy finish'); |
87 | -task('yammer:notify:success', function () { |
|
87 | +task('yammer:notify:success', function() { |
|
88 | 88 | $params = [ |
89 | 89 | 'is_rich_text' => 'true', |
90 | 90 | 'message_type' => 'announcement', |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | ->hidden(); |
104 | 104 | |
105 | 105 | desc('Notifies Yammer about deploy failure'); |
106 | -task('yammer:notify:failure', function () { |
|
106 | +task('yammer:notify:failure', function() { |
|
107 | 107 | $params = [ |
108 | 108 | 'is_rich_text' => 'true', |
109 | 109 | 'message_type' => 'announcement', |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | set('mattermost_failure_text', 'Deploy to **{{where}}** failed {{mattermost_failure_emoji}}'); |
92 | 92 | |
93 | 93 | desc('Notifies mattermost'); |
94 | -task('mattermost:notify', function () { |
|
94 | +task('mattermost:notify', function() { |
|
95 | 95 | if (null === get('mattermost_webhook')) { |
96 | 96 | return; |
97 | 97 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | }); |
113 | 113 | |
114 | 114 | desc('Notifies mattermost about deploy finish'); |
115 | -task('mattermost:notify:success', function () { |
|
115 | +task('mattermost:notify:success', function() { |
|
116 | 116 | if (null === get('mattermost_webhook')) { |
117 | 117 | return; |
118 | 118 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | }); |
134 | 134 | |
135 | 135 | desc('Notifies mattermost about deploy failure'); |
136 | -task('mattermost:notify:failure', function () { |
|
136 | +task('mattermost:notify:failure', function() { |
|
137 | 137 | if (null === get('mattermost_webhook')) { |
138 | 138 | return; |
139 | 139 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | foreach ($paths as $path) { |
52 | 52 | if (preg_match('/\.php$/i', $path)) { |
53 | 53 | // Prevent variable leak into deploy.php file |
54 | - call_user_func(function () use ($path) { |
|
54 | + call_user_func(function() use ($path) { |
|
55 | 55 | // Reorder autoload stack |
56 | 56 | $originStack = spl_autoload_functions(); |
57 | 57 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | self::$recipeFilename = basename($path); |
70 | 70 | self::$recipeSource = file_get_contents($path, true); |
71 | 71 | |
72 | - $root = array_filter(Yaml::parse(self::$recipeSource), static function (string $key) { |
|
72 | + $root = array_filter(Yaml::parse(self::$recipeSource), static function(string $key) { |
|
73 | 73 | return !str_starts_with($key, '.'); |
74 | 74 | }, ARRAY_FILTER_USE_KEY); |
75 | 75 | |
@@ -107,17 +107,17 @@ discard block |
||
107 | 107 | |
108 | 108 | protected static function tasks(array $tasks) |
109 | 109 | { |
110 | - $buildTask = function ($name, $steps) { |
|
111 | - $body = function () {}; |
|
110 | + $buildTask = function($name, $steps) { |
|
111 | + $body = function() {}; |
|
112 | 112 | $task = task($name, $body); |
113 | 113 | |
114 | 114 | foreach ($steps as $step) { |
115 | - $buildStep = function ($step) use (&$body, $task) { |
|
115 | + $buildStep = function($step) use (&$body, $task) { |
|
116 | 116 | extract($step); |
117 | 117 | |
118 | 118 | if (isset($cd)) { |
119 | 119 | $prev = $body; |
120 | - $body = function () use ($cd, $prev) { |
|
120 | + $body = function() use ($cd, $prev) { |
|
121 | 121 | $prev(); |
122 | 122 | cd($cd); |
123 | 123 | }; |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | if (isset($run)) { |
127 | 127 | $has = 'run'; |
128 | 128 | $prev = $body; |
129 | - $body = function () use ($run, $prev) { |
|
129 | + $body = function() use ($run, $prev) { |
|
130 | 130 | $prev(); |
131 | 131 | try { |
132 | 132 | run($run); |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | } |
145 | 145 | $has = 'run_locally'; |
146 | 146 | $prev = $body; |
147 | - $body = function () use ($run_locally, $prev) { |
|
147 | + $body = function() use ($run_locally, $prev) { |
|
148 | 148 | $prev(); |
149 | 149 | try { |
150 | 150 | runLocally($run_locally); |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | } |
163 | 163 | $has = 'upload'; |
164 | 164 | $prev = $body; |
165 | - $body = function () use ($upload, $prev) { |
|
165 | + $body = function() use ($upload, $prev) { |
|
166 | 166 | $prev(); |
167 | 167 | upload($upload['src'], $upload['dest']); |
168 | 168 | }; |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | } |
175 | 175 | $has = 'download'; |
176 | 176 | $prev = $body; |
177 | - $body = function () use ($download, $prev) { |
|
177 | + $body = function() use ($download, $prev) { |
|
178 | 178 | $prev(); |
179 | 179 | download($download['src'], $download['dest']); |
180 | 180 | }; |
@@ -91,19 +91,19 @@ discard block |
||
91 | 91 | new InputOption('file', 'f', InputOption::VALUE_REQUIRED, 'Recipe file path'), |
92 | 92 | ); |
93 | 93 | |
94 | - $this['console'] = function () use ($console) { |
|
94 | + $this['console'] = function() use ($console) { |
|
95 | 95 | return $console; |
96 | 96 | }; |
97 | - $this['input'] = function () { |
|
97 | + $this['input'] = function() { |
|
98 | 98 | throw new \RuntimeException('Uninitialized "input" in Deployer container.'); |
99 | 99 | }; |
100 | - $this['output'] = function () { |
|
100 | + $this['output'] = function() { |
|
101 | 101 | throw new \RuntimeException('Uninitialized "output" in Deployer container.'); |
102 | 102 | }; |
103 | - $this['inputDefinition'] = function () { |
|
103 | + $this['inputDefinition'] = function() { |
|
104 | 104 | return new InputDefinition(); |
105 | 105 | }; |
106 | - $this['questionHelper'] = function () { |
|
106 | + $this['questionHelper'] = function() { |
|
107 | 107 | return $this->getHelper('question'); |
108 | 108 | }; |
109 | 109 | |
@@ -111,12 +111,12 @@ discard block |
||
111 | 111 | * Config * |
112 | 112 | ******************************/ |
113 | 113 | |
114 | - $this['config'] = function () { |
|
114 | + $this['config'] = function() { |
|
115 | 115 | return new Configuration(); |
116 | 116 | }; |
117 | 117 | // -l act as if it had been invoked as a login shell (i.e. source ~/.profile file) |
118 | 118 | // -s commands are read from the standard input (no arguments should remain after this option) |
119 | - $this->config['shell'] = function () { |
|
119 | + $this->config['shell'] = function() { |
|
120 | 120 | if (currentHost() instanceof Localhost) { |
121 | 121 | return 'bash -s'; // Non-login shell for localhost. |
122 | 122 | } |
@@ -129,37 +129,37 @@ discard block |
||
129 | 129 | * Core * |
130 | 130 | ******************************/ |
131 | 131 | |
132 | - $this['pop'] = function ($c) { |
|
132 | + $this['pop'] = function($c) { |
|
133 | 133 | return new Printer($c['output']); |
134 | 134 | }; |
135 | - $this['sshClient'] = function ($c) { |
|
135 | + $this['sshClient'] = function($c) { |
|
136 | 136 | return new Client($c['output'], $c['pop'], $c['logger']); |
137 | 137 | }; |
138 | - $this['rsync'] = function ($c) { |
|
138 | + $this['rsync'] = function($c) { |
|
139 | 139 | return new Rsync($c['pop'], $c['output']); |
140 | 140 | }; |
141 | - $this['processRunner'] = function ($c) { |
|
141 | + $this['processRunner'] = function($c) { |
|
142 | 142 | return new ProcessRunner($c['pop'], $c['logger']); |
143 | 143 | }; |
144 | - $this['tasks'] = function () { |
|
144 | + $this['tasks'] = function() { |
|
145 | 145 | return new TaskCollection(); |
146 | 146 | }; |
147 | - $this['hosts'] = function () { |
|
147 | + $this['hosts'] = function() { |
|
148 | 148 | return new HostCollection(); |
149 | 149 | }; |
150 | - $this['scriptManager'] = function ($c) { |
|
150 | + $this['scriptManager'] = function($c) { |
|
151 | 151 | return new ScriptManager($c['tasks']); |
152 | 152 | }; |
153 | - $this['selector'] = function ($c) { |
|
153 | + $this['selector'] = function($c) { |
|
154 | 154 | return new Selector($c['hosts']); |
155 | 155 | }; |
156 | - $this['fail'] = function () { |
|
156 | + $this['fail'] = function() { |
|
157 | 157 | return new Collection(); |
158 | 158 | }; |
159 | - $this['messenger'] = function ($c) { |
|
159 | + $this['messenger'] = function($c) { |
|
160 | 160 | return new Messenger($c['input'], $c['output'], $c['logger']); |
161 | 161 | }; |
162 | - $this['master'] = function ($c) { |
|
162 | + $this['master'] = function($c) { |
|
163 | 163 | return new Master( |
164 | 164 | $c['hosts'], |
165 | 165 | $c['input'], |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | $c['messenger'], |
168 | 168 | ); |
169 | 169 | }; |
170 | - $this['importer'] = function () { |
|
170 | + $this['importer'] = function() { |
|
171 | 171 | return new Importer(); |
172 | 172 | }; |
173 | 173 | |
@@ -175,12 +175,12 @@ discard block |
||
175 | 175 | * Logger * |
176 | 176 | ******************************/ |
177 | 177 | |
178 | - $this['log_handler'] = function () { |
|
178 | + $this['log_handler'] = function() { |
|
179 | 179 | return !empty($this['log']) |
180 | 180 | ? new FileHandler($this['log']) |
181 | 181 | : new NullHandler(); |
182 | 182 | }; |
183 | - $this['logger'] = function () { |
|
183 | + $this['logger'] = function() { |
|
184 | 184 | return new Logger($this['log_handler']); |
185 | 185 | }; |
186 | 186 | |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | $output->writeln([ |
326 | 326 | "<fg=white;bg=red> {$class} </> <comment>in {$file} on line {$exception->getLine()}:</>", |
327 | 327 | "", |
328 | - implode("\n", array_map(function ($line) { |
|
328 | + implode("\n", array_map(function($line) { |
|
329 | 329 | return " " . $line; |
330 | 330 | }, explode("\n", $exception->getMessage()))), |
331 | 331 | "", |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | private InputInterface $input; |
40 | 40 | private OutputInterface $output; |
41 | 41 | private Messenger $messenger; |
42 | - private string|false $phpBin; |
|
42 | + private string | false $phpBin; |
|
43 | 43 | |
44 | 44 | public function __construct( |
45 | 45 | HostCollection $hosts, |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | /** @var Process[] $processes */ |
172 | 172 | $processes = []; |
173 | 173 | |
174 | - $server->afterRun(function (int $port) use (&$processes, $hosts, $task) { |
|
174 | + $server->afterRun(function(int $port) use (&$processes, $hosts, $task) { |
|
175 | 175 | foreach ($hosts as $host) { |
176 | 176 | $processes[] = $this->createProcess($host, $task, $port); |
177 | 177 | } |
@@ -181,14 +181,14 @@ discard block |
||
181 | 181 | } |
182 | 182 | }); |
183 | 183 | |
184 | - $echoCallback = function (string $output) { |
|
184 | + $echoCallback = function(string $output) { |
|
185 | 185 | $output = preg_replace('/\n$/', '', $output); |
186 | 186 | if (strlen($output) !== 0) { |
187 | 187 | $this->output->writeln($output); |
188 | 188 | } |
189 | 189 | }; |
190 | 190 | |
191 | - $server->ticker(function () use (&$processes, $server, $echoCallback) { |
|
191 | + $server->ticker(function() use (&$processes, $server, $echoCallback) { |
|
192 | 192 | $this->gatherOutput($processes, $echoCallback); |
193 | 193 | if ($this->output->isDecorated() && !getenv('CI')) { |
194 | 194 | $this->output->write(spinner()); |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | } |
199 | 199 | }); |
200 | 200 | |
201 | - $server->router(function (string $path, array $payload) { |
|
201 | + $server->router(function(string $path, array $payload) { |
|
202 | 202 | switch ($path) { |
203 | 203 | case '/load': |
204 | 204 | ['host' => $host] = $payload; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | // Name of current user who is running deploy. |
29 | 29 | // If not set will try automatically get git user name, |
30 | 30 | // otherwise output of `whoami` command. |
31 | -set('user', function () { |
|
31 | +set('user', function() { |
|
32 | 32 | if (getenv('CI') !== false) { |
33 | 33 | $ciUserVars = ['GITLAB_USER_NAME', 'GITHUB_ACTOR', 'CIRCLE_USERNAME', 'DRONE_BUILD_TRIGGER']; |
34 | 34 | foreach ($ciUserVars as $var) { |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * set('deploy_path', '~/{{alias}}'); |
95 | 95 | * ``` |
96 | 96 | */ |
97 | -set('deploy_path', function () { |
|
97 | +set('deploy_path', function() { |
|
98 | 98 | throw new ConfigurationException('Please, specify `deploy_path`.'); |
99 | 99 | }); |
100 | 100 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | set('current_path', '{{deploy_path}}/current'); |
108 | 108 | |
109 | 109 | // Path to the `php` bin. |
110 | -set('bin/php', function () { |
|
110 | +set('bin/php', function() { |
|
111 | 111 | if (currentHost()->hasOwn('php_version')) { |
112 | 112 | return '/usr/bin/php{{php_version}}'; |
113 | 113 | } |
@@ -115,25 +115,25 @@ discard block |
||
115 | 115 | }); |
116 | 116 | |
117 | 117 | // Path to the `git` bin. |
118 | -set('bin/git', function () { |
|
118 | +set('bin/git', function() { |
|
119 | 119 | return which('git'); |
120 | 120 | }); |
121 | 121 | |
122 | 122 | // Should {{bin/symlink}} use `--relative` option or not. Will detect |
123 | 123 | // automatically. |
124 | -set('use_relative_symlink', function () { |
|
124 | +set('use_relative_symlink', function() { |
|
125 | 125 | return commandSupportsOption('ln', '--relative'); |
126 | 126 | }); |
127 | 127 | |
128 | 128 | // Path to the `ln` bin. With predefined options `-nfs`. |
129 | -set('bin/symlink', function () { |
|
129 | +set('bin/symlink', function() { |
|
130 | 130 | return get('use_relative_symlink') ? 'ln -nfs --relative' : 'ln -nfs'; |
131 | 131 | }); |
132 | 132 | |
133 | 133 | // Path to a file which will store temp script with sudo password. |
134 | 134 | // Defaults to `.dep/sudo_pass`. This script is only temporary and will be deleted after |
135 | 135 | // sudo command executed. |
136 | -set('sudo_askpass', function () { |
|
136 | +set('sudo_askpass', function() { |
|
137 | 137 | if (test('[ -d {{deploy_path}}/.dep ]')) { |
138 | 138 | return '{{deploy_path}}/.dep/sudo_pass'; |
139 | 139 | } else { |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | /** |
172 | 172 | * Prints success message |
173 | 173 | */ |
174 | -task('deploy:success', function () { |
|
174 | +task('deploy:success', function() { |
|
175 | 175 | info('successfully deployed!'); |
176 | 176 | }) |
177 | 177 | ->hidden(); |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | /** |
181 | 181 | * Hook on deploy failure. |
182 | 182 | */ |
183 | -task('deploy:failed', function () {}) |
|
183 | +task('deploy:failed', function() {}) |
|
184 | 184 | ->hidden(); |
185 | 185 | |
186 | 186 | fail('deploy', 'deploy:failed'); |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | * Follows latest application logs. |
190 | 190 | */ |
191 | 191 | desc('Shows application logs'); |
192 | -task('logs:app', function () { |
|
192 | +task('logs:app', function() { |
|
193 | 193 | if (!has('log_files')) { |
194 | 194 | warning("Please, specify \"log_files\" option."); |
195 | 195 | return; |