Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow to use Processors through the new CLI
- Loading branch information
Showing
3 changed files
with
34 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,40 @@ | ||
<?php | ||
|
||
// Loaded as a dependency | ||
if (file_exists(__DIR__ . '/../../../autoload.php')) { | ||
return require_once __DIR__ . '/../../../autoload.php'; | ||
} | ||
function loadApp() { | ||
// Loaded as a dependency | ||
if (file_exists(__DIR__ . '/../../../autoload.php')) { | ||
return require_once __DIR__ . '/../../../autoload.php'; | ||
} | ||
|
||
// Loaded in the project itself | ||
if (file_exists(__DIR__ . '/../vendor/autoload.php')) { | ||
return require_once __DIR__ . '/../vendor/autoload.php'; | ||
} | ||
// Loaded in the project itself | ||
if (file_exists(__DIR__ . '/../vendor/autoload.php')) { | ||
return require_once __DIR__ . '/../vendor/autoload.php'; | ||
} | ||
|
||
// Loaded in the project itself, when vendor isn't installed | ||
if (file_exists(__DIR__ . '/../daux.phar')) { | ||
define('PHAR_DIR', __DIR__ . '/..'); | ||
// Loaded in the project itself, when vendor isn't installed | ||
if (file_exists(__DIR__ . '/../daux.phar')) { | ||
define('PHAR_DIR', __DIR__ . '/..'); | ||
|
||
return require_once 'phar://' . __DIR__ . '/../daux.phar/vendor/autoload.php'; | ||
return require_once 'phar://' . __DIR__ . '/../daux.phar/vendor/autoload.php'; | ||
} | ||
|
||
throw new Exception('Impossible to load Daux, missing vendor/ or daux.phar'); | ||
} | ||
|
||
throw new Exception('Impossible to load Daux, missing vendor/ or daux.phar'); | ||
$loader = loadApp(); | ||
|
||
if ($loader) { | ||
$ext = __DIR__ . '/../daux'; | ||
if (is_dir(getcwd() . "/daux")) { | ||
$ext = getcwd() . "/daux"; | ||
} | ||
|
||
$env = getenv('DAUX_EXTENSION'); | ||
if ($env && is_dir($env)) { | ||
$ext = $env; | ||
} | ||
|
||
define('DAUX_EXTENSION', $ext); | ||
|
||
$loader->setPsr4("Todaymade\\Daux\\Extension\\", $ext); | ||
} |