mirror of
https://github.com/laravel/valet.git
synced 2026-02-05 16:40:05 +01:00
Test most of the remaining CLI commands
* Test set tld command * Test set loopback command * Test proxy, unproxy, and proxies commands * Apply fixes from StyleCI * Test which command * Test diagnose command * Test directory-listing and which-php commands * Text isolate and unisolate and isolated commands * Apply fixes from StyleCI * Test trust command * Apply fixes from StyleCI * Test on-latest-version command * Move uninstall text to a class, and tweak text and presentation * Apply fixes from StyleCI * Test use command * Test stop command * Test start command * Test restart command Co-authored-by: StyleCI Bot <bot@styleci.io>
This commit is contained in:
@@ -98,4 +98,65 @@ public function composerGlobalUpdate(): void
|
||||
{
|
||||
$this->cli->runAsUser('composer global update');
|
||||
}
|
||||
|
||||
public function forceUninstallText(): string
|
||||
{
|
||||
return '<fg=red>NOTE:</>
|
||||
<comment>Valet has attempted to uninstall itself, but there are some steps you need to do manually:</comment>
|
||||
|
||||
1. Run <info>php -v</info>, and also <info>which php</info>, to see what PHP version you are now really using.
|
||||
2. Run <info>composer global update</info> to update your globally-installed Composer packages to work with your default PHP.
|
||||
NOTE: Composer may have other dependencies for other global apps you have installed, and those may not be compatible with your default PHP.
|
||||
3. Finish removing any Composer fragments of Valet:
|
||||
Run <info>composer global remove laravel/valet</info>
|
||||
and then <info>rm '.BREW_PREFIX.'/bin/valet</info> to remove the Valet bin link if it still exists.
|
||||
|
||||
Optional:
|
||||
- <info>brew list --formula</info> will show any other Homebrew services installed, in case you want to make changes to those as well.
|
||||
- <info>brew doctor</info> can indicate if there might be any broken things left behind.
|
||||
- <info>brew cleanup</info> can purge old cached Homebrew downloads.
|
||||
|
||||
If you had customized your Mac DNS settings in System Preferences->Network, you will need to remove 127.0.0.1 from that list.
|
||||
|
||||
You may also want to open Keychain Access and search for <comment>valet</comment> to remove any leftover trust certificates.';
|
||||
}
|
||||
|
||||
public function uninstallText(): string
|
||||
{
|
||||
return '
|
||||
<info>You did not pass the <fg=red>--force</> parameter, so this will only return instructions on how to uninstall, not ACTUALLY uninstall anything.
|
||||
A --force removal WILL delete your custom configuration information, so be sure to make backups first.</info>
|
||||
|
||||
IF YOU WANT TO UNINSTALL VALET MANUALLY, DO THE FOLLOWING...
|
||||
|
||||
<info>1. Valet Keychain Certificates</info>
|
||||
Before removing Valet configuration files, we recommend that you run <comment>valet unsecure --all</comment> to clean up the certificates that Valet inserted into your Keychain.
|
||||
Alternatively you can do a search for <comment>@laravel.valet</comment> in Keychain Access and delete those certificates there manually.
|
||||
|
||||
<info>2. Valet Configuration Files</info>
|
||||
You may remove your user-specific Valet config files by running: <comment>rm -rf ~/.config/valet</comment>
|
||||
|
||||
<info>3. Remove Valet package</info>
|
||||
You can run <comment>composer global remove laravel/valet</comment> to uninstall the Valet package.
|
||||
|
||||
<info>4. Homebrew Services</info>
|
||||
You may remove the core services (php, nginx, dnsmasq) by running: <comment>brew uninstall --force php nginx dnsmasq</comment>
|
||||
You can then remove selected leftover configurations for these services manually in both <comment>'.BREW_PREFIX.'/etc/</comment> and <comment>'.BREW_PREFIX.'/logs/</comment>.
|
||||
(If you have other PHP versions installed, run <info>brew list --formula | grep php</info> to see which versions you should also uninstall manually.)
|
||||
|
||||
<error>BEWARE:</error> Uninstalling PHP via Homebrew will leave your Mac with its original PHP version, which may not be compatible with other Composer dependencies you have installed. As a result, you may get unexpected errors.
|
||||
|
||||
If you have customized your Mac DNS settings in System Preferences->Network, you may need to add or remove 127.0.0.1 from the top of that list.
|
||||
|
||||
<info>5. GENERAL TROUBLESHOOTING</info>
|
||||
If your reasons for considering an uninstall are more for troubleshooting purposes, consider running <comment>brew doctor</comment> and/or <comment>brew cleanup</comment> to see if any problems exist there.
|
||||
Also consider running <comment>sudo nginx -t</comment> to test your nginx configs in case there are failures/errors there preventing nginx from running.
|
||||
Most of the nginx configs used by Valet are in your <comment>~/.config/valet/Nginx</comment> directory.
|
||||
|
||||
You might also want to investigate your global Composer configs. Helpful commands include:
|
||||
<comment>composer global update</comment> to apply updates to packages
|
||||
<comment>composer global outdated</comment> to identify outdated packages
|
||||
<comment>composer global diagnose</comment> to run diagnostics
|
||||
';
|
||||
}
|
||||
}
|
||||
|
||||
64
cli/app.php
64
cli/app.php
@@ -151,7 +151,7 @@ function (ConsoleCommandEvent $event) {
|
||||
Nginx::installServer();
|
||||
Nginx::restart();
|
||||
|
||||
info('Your valet loopback address has been updated to ['.$loopback.']');
|
||||
info('Your Valet loopback address has been updated to ['.$loopback.']');
|
||||
})->descriptions('Get or set the loopback address used for Valet sites');
|
||||
|
||||
/**
|
||||
@@ -435,9 +435,11 @@ function (ConsoleCommandEvent $event) {
|
||||
warning('YOU ARE ABOUT TO UNINSTALL Nginx, PHP, Dnsmasq and all Valet configs and logs.');
|
||||
$helper = $this->getHelperSet()->get('question');
|
||||
$question = new ConfirmationQuestion('Are you sure you want to proceed? ', false);
|
||||
|
||||
if (false === $helper->ask($input, $output, $question)) {
|
||||
return warning('Uninstall aborted.');
|
||||
}
|
||||
|
||||
info('Removing certificates for all Secured sites...');
|
||||
Site::unsecureAll();
|
||||
info('Removing Nginx and configs...');
|
||||
@@ -456,61 +458,12 @@ function (ConsoleCommandEvent $event) {
|
||||
Brew::removeSudoersEntry();
|
||||
Valet::removeSudoersEntry();
|
||||
|
||||
return output('<fg=red>NOTE:</>
|
||||
<comment>Valet has attempted to uninstall itself, but there are some steps you need to do manually:</comment>
|
||||
Run <info>php -v</info> to see what PHP version you are now really using.
|
||||
Run <info>composer global update</info> to update your globally-installed Composer packages to work with your default PHP.
|
||||
NOTE: Composer may have other dependencies for other global apps you have installed, and those may not be compatible with your default PHP.
|
||||
Thus, you may need to delete things from your <info>~/.composer/composer.json</info> file before running <info>composer global update</info> successfully.
|
||||
Then to finish removing any Composer fragments of Valet:
|
||||
Run <info>composer global remove laravel/valet</info>
|
||||
and then <info>rm '.BREW_PREFIX.'/bin/valet</info> to remove the Valet bin link if it still exists.
|
||||
Optional:
|
||||
- <info>brew list --formula</info> will show any other Homebrew services installed, in case you want to make changes to those as well.
|
||||
- <info>brew doctor</info> can indicate if there might be any broken things left behind.
|
||||
- <info>brew cleanup</info> can purge old cached Homebrew downloads.
|
||||
<fg=red>If you had customized your Mac DNS settings in System Preferences->Network, you will need to remove 127.0.0.1 from that list.</>
|
||||
Additionally you might also want to open Keychain Access and search for <comment>valet</comment> to remove any leftover trust certificates.
|
||||
');
|
||||
return output(Valet::forceUninstallText());
|
||||
}
|
||||
|
||||
output('WAIT! Before you uninstall things, consider cleaning things up in the following order. (Or skip to the bottom for troubleshooting suggestions.):
|
||||
<info>You did not pass the <fg=red>--force</> parameter so we are NOT ACTUALLY uninstalling anything.</info>
|
||||
A --force removal WILL delete your custom configuration information, so you will want to make backups first.
|
||||
output(Valet::uninstallText());
|
||||
|
||||
IF YOU WANT TO UNINSTALL VALET MANUALLY, DO THE FOLLOWING...
|
||||
|
||||
<info>1. Valet Keychain Certificates</info>
|
||||
Before removing Valet configuration files, we recommend that you run <comment>valet unsecure --all</comment> to clean up the certificates that Valet inserted into your Keychain.
|
||||
Alternatively you can do a search for <comment>@laravel.valet</comment> in Keychain Access and delete those certificates there manually.
|
||||
You may also run <comment>valet parked</comment> to see a list of all sites Valet could serve.
|
||||
|
||||
<info>2. Valet Configuration Files</info>
|
||||
<fg=red>You may remove your user-specific Valet config files by running:</> <comment>rm -rf ~/.config/valet</comment>
|
||||
|
||||
<info>3. Remove Valet package</info>
|
||||
You can run <comment>composer global remove laravel/valet</comment> to uninstall the Valet package.
|
||||
|
||||
<info>4. Homebrew Services</info>
|
||||
<fg=red>You may remove the core services (php, nginx, dnsmasq) by running:</> <comment>brew uninstall --force php nginx dnsmasq</comment>
|
||||
<fg=red>You can then remove selected leftover configurations for these services manually</> in both <comment>'.BREW_PREFIX.'/etc/</comment> and <comment>'.BREW_PREFIX.'/logs/</comment>.
|
||||
(If you have other PHP versions installed, run <info>brew list --formula | grep php</info> to see which versions you should also uninstall manually.)
|
||||
|
||||
<error>BEWARE:</error> Uninstalling PHP via Homebrew will leave your Mac with its original PHP version, which may not be compatible with other Composer dependencies you have installed. Thus you may get unexpected errors.
|
||||
|
||||
<fg=red>If you have customized your Mac DNS settings in System Preferences->Network, you may need to add or remove 127.0.0.1 from the top of that list.</>
|
||||
|
||||
<info>5. GENERAL TROUBLESHOOTING</info>
|
||||
If your reasons for considering an uninstall are more for troubleshooting purposes, consider running <comment>brew doctor</comment> and/or <comment>brew cleanup</comment> to see if any problems exist there.
|
||||
Also consider running <comment>sudo nginx -t</comment> to test your nginx configs in case there are failures/errors there preventing nginx from running.
|
||||
Most of the nginx configs used by Valet are in your ~/.config/valet/Nginx directory.
|
||||
|
||||
You might also want to investigate your global Composer configs. Helpful commands include:
|
||||
<comment>composer global update</comment> to apply updates to packages
|
||||
<comment>composer global outdated</comment> to identify outdated packages
|
||||
<comment>composer global diagnose</comment> to run diagnostics
|
||||
');
|
||||
// Stopping PHP so the ~/.config/valet/valet.sock file is released so the directory can be deleted if desired
|
||||
// Stop PHP so the ~/.config/valet/valet.sock file is released so the directory can be deleted if desired
|
||||
PhpFpm::stopRunning();
|
||||
Nginx::stop();
|
||||
})->descriptions('Uninstall the Valet services', ['--force' => 'Do a forceful uninstall of Valet and related Homebrew pkgs']);
|
||||
@@ -574,7 +527,7 @@ function (ConsoleCommandEvent $event) {
|
||||
|
||||
PhpFpm::useVersion($phpVersion, $force);
|
||||
})->descriptions('Change the version of PHP used by Valet', [
|
||||
'phpVersion' => 'The PHP version you want to use, e.g php@7.3',
|
||||
'phpVersion' => 'The PHP version you want to use; e.g php@8.2',
|
||||
]);
|
||||
|
||||
/**
|
||||
@@ -591,7 +544,8 @@ function (ConsoleCommandEvent $event) {
|
||||
} else {
|
||||
info(PHP_EOL.'Please provide a version number. E.g.:');
|
||||
info('valet isolate php@8.2');
|
||||
exit;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user