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

Merge pull request #263 from antonioribeiro/showStartStopInfo

Show start & stop process info in terminal
This commit is contained in:
Adam Wathan
2017-03-23 10:45:26 -04:00
committed by GitHub
4 changed files with 23 additions and 3 deletions

View File

@@ -91,6 +91,8 @@ function ensureInstalled($formula, $options = [], $taps = [])
*/ */
function installOrFail($formula, $options = [], $taps = []) function installOrFail($formula, $options = [], $taps = [])
{ {
info("Installing {$formula}...");
if (count($taps) > 0) { if (count($taps) > 0) {
$this->tap($taps); $this->tap($taps);
} }
@@ -129,10 +131,14 @@ function restartService($services)
$services = is_array($services) ? $services : func_get_args(); $services = is_array($services) ? $services : func_get_args();
foreach ($services as $service) { 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 stop '.$service);
$this->cli->quietly('sudo brew services start '.$service); $this->cli->quietly('sudo brew services start '.$service);
} }
} }
}
/** /**
* Stop the given Homebrew services. * Stop the given Homebrew services.
@@ -144,9 +150,13 @@ function stopService($services)
$services = is_array($services) ? $services : func_get_args(); $services = is_array($services) ? $services : func_get_args();
foreach ($services as $service) { foreach ($services as $service) {
if ($this->installed($service)) {
info("Stopping {$service}...");
$this->cli->quietly('sudo brew services stop '.$service); $this->cli->quietly('sudo brew services stop '.$service);
} }
} }
}
/** /**
* Determine which version of PHP is linked in Homebrew. * Determine which version of PHP is linked in Homebrew.

View File

@@ -56,6 +56,8 @@ function install()
*/ */
function installConfiguration() function installConfiguration()
{ {
info('Installing nginx configuration...');
$contents = $this->files->get(__DIR__.'/../stubs/nginx.conf'); $contents = $this->files->get(__DIR__.'/../stubs/nginx.conf');
$this->files->putAsUser( $this->files->putAsUser(
@@ -97,6 +99,8 @@ function installServer()
*/ */
function installNginxDirectory() function installNginxDirectory()
{ {
info('Installing nginx directory...');
if (! $this->files->isDir($nginxDirectory = VALET_HOME_PATH.'/Nginx')) { if (! $this->files->isDir($nginxDirectory = VALET_HOME_PATH.'/Nginx')) {
$this->files->mkdirAsUser($nginxDirectory); $this->files->mkdirAsUser($nginxDirectory);
} }
@@ -150,6 +154,8 @@ function restart()
*/ */
function stop() function stop()
{ {
info('Stopping nginx....');
$this->cli->quietly('sudo brew services stop '. $this->brew->nginxServiceName()); $this->cli->quietly('sudo brew services stop '. $this->brew->nginxServiceName());
} }

View File

@@ -54,6 +54,8 @@ function install()
*/ */
function updateConfiguration() function updateConfiguration()
{ {
info('Updating PHP configuration...');
$contents = $this->files->get($this->fpmConfigPath()); $contents = $this->files->get($this->fpmConfigPath());
$contents = preg_replace('/^user = .+$/m', 'user = '.user(), $contents); $contents = preg_replace('/^user = .+$/m', 'user = '.user(), $contents);

View File

@@ -99,6 +99,7 @@ public function test_tap_taps_the_given_homebrew_repository()
public function test_restart_restarts_the_service_using_homebrew_services() public function test_restart_restarts_the_service_using_homebrew_services()
{ {
$cli = Mockery::mock(CommandLine::class); $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 stop dnsmasq');
$cli->shouldReceive('quietly')->once()->with('sudo brew services start dnsmasq'); $cli->shouldReceive('quietly')->once()->with('sudo brew services start dnsmasq');
swap(CommandLine::class, $cli); 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() public function test_stop_stops_the_service_using_homebrew_services()
{ {
$cli = Mockery::mock(CommandLine::class); $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 stop dnsmasq');
swap(CommandLine::class, $cli); swap(CommandLine::class, $cli);
resolve(Brew::class)->stopService('dnsmasq'); resolve(Brew::class)->stopService('dnsmasq');