mirror of
https://github.com/laravel/valet.git
synced 2026-02-06 00:40:06 +01:00
47 lines
961 B
PHP
47 lines
961 B
PHP
<?php
|
|
|
|
namespace Valet;
|
|
|
|
class Valet
|
|
{
|
|
var $cli, $files;
|
|
|
|
var $valetBin = '/usr/local/bin/valet';
|
|
|
|
/**
|
|
* Create a new Valet instance.
|
|
*
|
|
* @param CommandLine $cli
|
|
* @param Filesystem $files
|
|
* @return void
|
|
*/
|
|
function __construct(CommandLine $cli, Filesystem $files)
|
|
{
|
|
$this->cli = $cli;
|
|
$this->files = $files;
|
|
}
|
|
|
|
/**
|
|
* Symlink the Valet Bash script into the user's local bin.
|
|
*
|
|
* @return void
|
|
*/
|
|
function symlinkToUsersBin()
|
|
{
|
|
$this->cli->quietly('rm '.$this->valetBin);
|
|
|
|
$this->cli->run('ln -s '.realpath(__DIR__.'/../valet').' '.$this->valetBin);
|
|
}
|
|
|
|
/**
|
|
* Create the "sudoers.d" entry for running Valet.
|
|
*
|
|
* @return void
|
|
*/
|
|
function createSudoersEntry()
|
|
{
|
|
$this->files->put('/etc/sudoers.d/valet', 'Cmnd_Alias VALET = /usr/local/bin/valet *
|
|
%admin ALL=(root) NOPASSWD: VALET'.PHP_EOL);
|
|
}
|
|
}
|