mirror of
https://github.com/laravel/valet.git
synced 2026-02-05 00:20:08 +01:00
Merge pull request #461 from simensen/modern-sculpin-support
Enable support for modern Sculpin projects.
This commit is contained in:
@@ -11,10 +11,39 @@ class SculpinValetDriver extends BasicValetDriver
|
||||
* @return bool
|
||||
*/
|
||||
public function serves($sitePath, $siteName, $uri)
|
||||
{
|
||||
return $this->isModernSculpinProject($sitePath) ||
|
||||
$this->isLegacySculpinProject($sitePath);
|
||||
}
|
||||
|
||||
private function isModernSculpinProject($sitePath)
|
||||
{
|
||||
return is_dir($sitePath.'/source') &&
|
||||
is_dir($sitePath.'/output_dev') &&
|
||||
$this->composerRequiresSculpin($sitePath);
|
||||
}
|
||||
|
||||
private function isLegacySculpinProject($sitePath)
|
||||
{
|
||||
return is_dir($sitePath.'/.sculpin');
|
||||
}
|
||||
|
||||
private function composerRequiresSculpin($sitePath)
|
||||
{
|
||||
if (! file_exists($sitePath.'/composer.json')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$composer_json_source = file_get_contents($sitePath.'/composer.json');
|
||||
$composer_json = json_decode($composer_json_source, true);
|
||||
|
||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return isset($composer_json['require']['sculpin/sculpin']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mutate the incoming URI.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user