| Q | A
| ----------------- | ---
| Issue Type | Feature Request
| Deployer Version | 4.3.0
| Local Machine OS | N/A
| Remote Machine OS | N/A
I want to do run({{nginx:restart}}) inside a task like this:
task('predeploy:nginx', function () {
if(!commandExist('nginx')) {
// ...
// restart nginx
run('{{nginx:restart}}');
}
return get('bin/nginx');
});
i set the nginx:restart var like this:
// Closures
$nginxRestart = function () {
return run('sudo systemctl restart nginx');
};
set('nginx:restart', $nginxRestart);
I use a closure because i have also an nginx:restart task:
task('nginx:restart', $nginxRestart);
If i replace {{nginx:restart}} by {{nginx-restart}} it works but not with the : char.
I take a look at the parse function used, the regex doesn't accept the : char.
The same pattern task:subtask is used in the task name, is it possible to update the parse regex for var names from this /\{\{\s*([\w\.\/-]+)\s*\}\}/ to this \{\{\s*([\w\:\.\/-]+)\s*\}\} ?
I can create a PR.
Thanks
Why not run('{{nginx:restart}}'); to nginxRestart();?
In v5 there is invoke('task') func.
In v5 there is invoke('task') func.
Do you mean that in v5 it will not be possible to use mustache syntax {{var}} inside the run function ?
No
For know i think to close this issue. If there will be need or real use case lets talk about it again.
Most helpful comment
Why not
run('{{nginx:restart}}');tonginxRestart();?In v5 there is
invoke('task')func.