Updated readme, misc fixes
* Look for spark config in parent directories * Version tracking via src/version
This commit is contained in:
@ -125,9 +125,22 @@ class Environment
|
||||
SparkApplication::$instance->getPluginManager()->initializePlugins();
|
||||
}
|
||||
|
||||
public static function createFromDirectory(string|null $directory=null): Environment
|
||||
public static function createFromDirectory(string|null $directory=null, bool $parents=false): Environment
|
||||
{
|
||||
$directory = $directory ?? getcwd();
|
||||
|
||||
if ($parents) {
|
||||
$check = $directory;
|
||||
while (!glob("{$check}/.spark*")) {
|
||||
$p = dirname($check);
|
||||
if ($p == $check) break;
|
||||
$check = $p;
|
||||
}
|
||||
if (strlen($directory) > 1) {
|
||||
$directory = $check;
|
||||
}
|
||||
}
|
||||
|
||||
$candidates = [ $directory . "/.spark.json", $directory . "/.spark/spark.json" ];
|
||||
$config = [];
|
||||
while ($candidate = array_shift($candidates)) {
|
||||
|
Reference in New Issue
Block a user