Skip to content

Commit 98f8757

Browse files
committed
refactor: Diagnose commands to use the new Packages\Nginx class.
Refactor all `Diagnose` commands for nginx to be more DRY and use the `packagePath` and `packageExe` methods of the new `Packages\Nginx` class.
1 parent 510d468 commit 98f8757

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

cli/Valet/Diagnose.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,18 @@ class Diagnose {
2626
public function __construct(CommandLine $cli, Filesystem $files) {
2727
$this->cli = $cli;
2828
$this->files = $files;
29+
30+
$nginxPkgClass = resolve(Packages\Nginx::class);
31+
2932
$this->commands = [
3033
'systeminfo',
3134
'valet --version',
3235
'cat ~/.config/valet/config.json',
33-
valetBinPath() . 'nginx/nginx.exe -v 2>&1',
34-
valetBinPath() . 'nginx/nginx.exe -c \"' . __DIR__ . '/../../bin/nginx/conf/nginx.conf\" -t -p ' . valetBinPath() . 'nginx 2>&1',
35-
'foreach ($file in get-ChildItem -Path "' . valetBinPath() . 'nginx/conf/nginx.conf", "' . valetBinPath() . 'nginx/valet/valet.conf", "' . VALET_HOME_PATH . '/Nginx/*.conf"){echo $file.fullname --------------------`n; Get-Content -Path $file; echo `n;}',
36+
$nginxPkgClass->packageExe() . ' -v 2>&1',
37+
$nginxPkgClass->packageExe() . ' -c \"' . $nginxPkgClass->packagePath() . '/conf/nginx.conf\" -t -p ' . $nginxPkgClass->packagePath() . ' 2>&1',
38+
39+
'foreach ($file in get-ChildItem -Path "' . $nginxPkgClass->packagePath() . '/conf/nginx.conf", "' . $nginxPkgClass->packagePath() . '/valet/valet.conf", "' . VALET_HOME_PATH . '/Nginx/*.conf"){echo $file.fullname --------------------`n; Get-Content -Path $file; echo `n;}',
40+
3641
valetBinPath() . 'ngrok.exe version',
3742
'php -v',
3843
'cmd /C "where /f php"',

0 commit comments

Comments
 (0)