Skip to content

Commit

Permalink
Add uninstall to services
Browse files Browse the repository at this point in the history
  • Loading branch information
mischabraam committed Sep 21, 2023
1 parent 9c4c7c5 commit 37069a5
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 15 deletions.
3 changes: 3 additions & 0 deletions cli/ValetPlus/Rabbitmq.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,8 @@ public function uninstall(): void
if (file_exists(BREW_PREFIX . '/var/lib/rabbitmq')) {
$this->files->rmDirAndContents(BREW_PREFIX . '/var/lib/rabbitmq');
}
if (file_exists(BREW_PREFIX . '/var/log/rabbitmq')) {
$this->files->rmDirAndContents(BREW_PREFIX . '/var/log/rabbitmq');
}
}
}
2 changes: 2 additions & 0 deletions cli/ValetPlus/Redis.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,7 @@ public function uninstall(): void
{
$this->stop();
$this->brew->uninstallFormula(static::SERVICE_NAME);

$this->files->unlink(BREW_PREFIX . '/var/log/redis.log');
}
}
42 changes: 27 additions & 15 deletions cli/valet.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@
*/
$app
->command('varnish', function (OutputInterface $output, string $mode = null) {
$modes = ['install', 'on', 'enable', 'off', 'disable'];
$modes = ['install', 'on', 'enable', 'off', 'disable', 'uninstall'];

if (!in_array($mode, $modes)) {
throw new Exception('Mode not found. Available modes: ' . implode(', ', $modes));
Expand All @@ -301,28 +301,32 @@
case 'install':
Varnish::install();

return;
break;
case 'enable':
case 'on':
Varnish::enable();

return;
break;
case 'disable':
case 'off':
Varnish::disable();

return;
break;
case 'uninstall':
Varnish::uninstall();

break;
}
})
->descriptions('Enable/disable Varnish')
->addArgument('mode', InputArgument::REQUIRED, 'Available modes: ' . implode(', ', ['install', 'on', 'enable', 'off', 'disable']));
->addArgument('mode', InputArgument::REQUIRED, 'Available modes: ' . implode(', ', ['install', 'on', 'enable', 'off', 'disable', 'uninstall']));

/**
* Redis services.
*/
$app
->command('redis', function (OutputInterface $output, string $mode = null) {
$modes = ['install', 'on', 'enable', 'off', 'disable'];
$modes = ['install', 'on', 'enable', 'off', 'disable', 'uninstall'];

if (!in_array($mode, $modes)) {
throw new Exception('Mode not found. Available modes: ' . implode(', ', $modes));
Expand All @@ -332,28 +336,32 @@
case 'install':
Redis::install();

return;
break;
case 'enable':
case 'on':
Redis::enable();

return;
break;
case 'disable':
case 'off':
Redis::disable();

return;
break;
case 'uninstall':
Redis::uninstall();

break;
}
})
->descriptions('Enable/disable Redis')
->addArgument('mode', InputArgument::REQUIRED, 'Available modes: ' . implode(', ', ['install', 'on', 'enable', 'off', 'disable']));
->addArgument('mode', InputArgument::REQUIRED, 'Available modes: ' . implode(', ', ['install', 'on', 'enable', 'off', 'disable', 'uninstall']));

/**
* Rabbitmq services.
*/
$app
->command('rabbitmq', function (OutputInterface $output, string $mode = null) {
$modes = ['install', 'on', 'enable', 'off', 'disable'];
$modes = ['install', 'on', 'enable', 'off', 'disable', 'uninstall'];

if (!in_array($mode, $modes)) {
throw new Exception('Mode not found. Available modes: ' . implode(', ', $modes));
Expand All @@ -363,21 +371,25 @@
case 'install':
Rabbitmq::install();

return;
break;
case 'enable':
case 'on':
Rabbitmq::enable();

return;
break;
case 'disable':
case 'off':
Rabbitmq::disable();

return;
break;
case 'uninstall':
Rabbitmq::uninstall();

break;
}
})
->descriptions('Enable/disable Rabbitmq')
->addArgument('mode', InputArgument::REQUIRED, 'Available modes: ' . implode(', ', ['install', 'on', 'enable', 'off', 'disable']));
->addArgument('mode', InputArgument::REQUIRED, 'Available modes: ' . implode(', ', ['install', 'on', 'enable', 'off', 'disable', 'uninstall']));

/**
* Database services and commands.
Expand Down

0 comments on commit 37069a5

Please sign in to comment.