mirror of
https://github.com/laravel/valet.git
synced 2026-02-07 09:10:03 +01:00
Merge pull request #263 from antonioribeiro/showStartStopInfo
Show start & stop process info in terminal
This commit is contained in:
@@ -91,6 +91,8 @@ function ensureInstalled($formula, $options = [], $taps = [])
|
||||
*/
|
||||
function installOrFail($formula, $options = [], $taps = [])
|
||||
{
|
||||
info("Installing {$formula}...");
|
||||
|
||||
if (count($taps) > 0) {
|
||||
$this->tap($taps);
|
||||
}
|
||||
@@ -129,10 +131,14 @@ function restartService($services)
|
||||
$services = is_array($services) ? $services : func_get_args();
|
||||
|
||||
foreach ($services as $service) {
|
||||
if ($this->installed($service)) {
|
||||
info("Restarting {$service}...");
|
||||
|
||||
$this->cli->quietly('sudo brew services stop '.$service);
|
||||
$this->cli->quietly('sudo brew services start '.$service);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop the given Homebrew services.
|
||||
@@ -144,9 +150,13 @@ function stopService($services)
|
||||
$services = is_array($services) ? $services : func_get_args();
|
||||
|
||||
foreach ($services as $service) {
|
||||
if ($this->installed($service)) {
|
||||
info("Stopping {$service}...");
|
||||
|
||||
$this->cli->quietly('sudo brew services stop '.$service);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine which version of PHP is linked in Homebrew.
|
||||
|
||||
@@ -56,6 +56,8 @@ function install()
|
||||
*/
|
||||
function installConfiguration()
|
||||
{
|
||||
info('Installing nginx configuration...');
|
||||
|
||||
$contents = $this->files->get(__DIR__.'/../stubs/nginx.conf');
|
||||
|
||||
$this->files->putAsUser(
|
||||
@@ -97,6 +99,8 @@ function installServer()
|
||||
*/
|
||||
function installNginxDirectory()
|
||||
{
|
||||
info('Installing nginx directory...');
|
||||
|
||||
if (! $this->files->isDir($nginxDirectory = VALET_HOME_PATH.'/Nginx')) {
|
||||
$this->files->mkdirAsUser($nginxDirectory);
|
||||
}
|
||||
@@ -150,6 +154,8 @@ function restart()
|
||||
*/
|
||||
function stop()
|
||||
{
|
||||
info('Stopping nginx....');
|
||||
|
||||
$this->cli->quietly('sudo brew services stop '. $this->brew->nginxServiceName());
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +54,8 @@ function install()
|
||||
*/
|
||||
function updateConfiguration()
|
||||
{
|
||||
info('Updating PHP configuration...');
|
||||
|
||||
$contents = $this->files->get($this->fpmConfigPath());
|
||||
|
||||
$contents = preg_replace('/^user = .+$/m', 'user = '.user(), $contents);
|
||||
|
||||
@@ -99,6 +99,7 @@ public function test_tap_taps_the_given_homebrew_repository()
|
||||
public function test_restart_restarts_the_service_using_homebrew_services()
|
||||
{
|
||||
$cli = Mockery::mock(CommandLine::class);
|
||||
$cli->shouldReceive('runAsUser')->once()->with('brew list | grep dnsmasq')->andReturn('dnsmasq');
|
||||
$cli->shouldReceive('quietly')->once()->with('sudo brew services stop dnsmasq');
|
||||
$cli->shouldReceive('quietly')->once()->with('sudo brew services start dnsmasq');
|
||||
swap(CommandLine::class, $cli);
|
||||
@@ -109,6 +110,7 @@ public function test_restart_restarts_the_service_using_homebrew_services()
|
||||
public function test_stop_stops_the_service_using_homebrew_services()
|
||||
{
|
||||
$cli = Mockery::mock(CommandLine::class);
|
||||
$cli->shouldReceive('runAsUser')->once()->with('brew list | grep dnsmasq')->andReturn('dnsmasq');
|
||||
$cli->shouldReceive('quietly')->once()->with('sudo brew services stop dnsmasq');
|
||||
swap(CommandLine::class, $cli);
|
||||
resolve(Brew::class)->stopService('dnsmasq');
|
||||
|
||||
Reference in New Issue
Block a user