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

extract logic

This commit is contained in:
Taylor Otwell
2016-05-11 15:29:04 -05:00
parent ba73074f77
commit d98fce6f08
2 changed files with 14 additions and 3 deletions

View File

@@ -45,4 +45,17 @@ function createSudoersEntry()
$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'), '>=');
}
}