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)) {
|
||||
|
@ -25,13 +25,13 @@ class SparkApplication extends Application
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct("Spark", "dev");
|
||||
parent::__construct("Spark", APP_VERSION);
|
||||
self::$instance = $this;
|
||||
|
||||
$this->resourceManager = new ResourceManager();
|
||||
$this->pluginManager = new PluginManager();
|
||||
|
||||
$this->environment = Environment::createFromDirectory();
|
||||
$this->environment = Environment::createFromDirectory(null, true);
|
||||
$this->environment->loadEnvironment();
|
||||
|
||||
$this->add(new Commands\RunCommand());
|
||||
|
Reference in New Issue
Block a user