1
0
mirror of https://github.com/laravel/valet.git synced 2026-02-05 00:20:08 +01:00

Allow Valet to uninstall itself

`valet uninstall` only displays information about how to manually uninstall and clean up after Valet.

This PR adds a `--force` parameter, which will forcefully remove Valet and the Homebrew services it installs, as well as clean up the config files and log files.
But for a few post-uninstall composer dependencies, cleanup is very thorough.

This brings idempotency to both `valet install` and `valet uninstall --force`

(There may still be edge cases where other Homebrew or composer packages might create interference with install/uninstall, but this makes things much easier to self-troubleshoot.)
This commit is contained in:
Chris Brown
2019-12-05 19:50:33 -05:00
parent d301e4ac11
commit 6e01bfb5f4
7 changed files with 205 additions and 32 deletions

View File

@@ -51,6 +51,23 @@ function install($tld = 'test')
info('Valet is configured to serve for TLD [.'.$tld.']');
}
/**
* Forcefully uninstall dnsmasq.
*
* @return void
*/
function uninstall()
{
$this->brew->stopService('dnsmasq');
$this->brew->uninstallFormula('dnsmasq');
$this->cli->run('rm -rf /usr/local/etc/dnsmasq.d/dnsmasq-valet.conf');
}
/**
* Tell Homebrew to restart dnsmasq
*
* @return void
*/
function restart()
{
$this->brew->restartService('dnsmasq');