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->ensureDirExists('/etc/sudoers.d'); $this->files->put('/etc/sudoers.d/valet', 'Cmnd_Alias VALET = /usr/local/bin/valet * %admin ALL=(root) NOPASSWD: VALET'.PHP_EOL); } /** * Determine if this is the latest version of Valet. * * @param string $currentVersion * @return bool */ public function onLatestVersion($currentVersion) { $response = \Httpful\Request::get('https://api.github.com/repos/laravel/valet/releases/latest')->send(); return version_compare($currentVersion, trim($response->body->tag_name, 'v'), '>='); } }