Skip to content

Commit ba1afb2

Browse files
committed
[bootstrap] Normalize CLI autoload bootstrap
1 parent 5703f3c commit ba1afb2

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

bin/dev-tools.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,16 @@
2121

2222
use FastForward\DevTools\Console\DevTools;
2323

24-
$projectVendorAutoload = \dirname(__DIR__, 4) . '/vendor/autoload.php';
25-
$pluginVendorAutoload = \dirname(__DIR__) . '/vendor/autoload.php';
24+
$autoloadCandidates = [\dirname(__DIR__) . '/vendor/autoload.php', \dirname(__DIR__, 4) . '/vendor/autoload.php'];
2625

27-
require_once file_exists($projectVendorAutoload) ? $projectVendorAutoload : $pluginVendorAutoload;
26+
foreach ($autoloadCandidates as $autoloadCandidate) {
27+
if (is_file($autoloadCandidate)) {
28+
require_once $autoloadCandidate;
2829

29-
DevTools::create()->run();
30+
exit(DevTools::create()->run());
31+
}
32+
}
33+
34+
fprintf(\STDERR, "Could not locate Composer autoload.php for fast-forward/dev-tools.\n");
35+
36+
exit(1);

0 commit comments

Comments
 (0)