Skip to content

Commit

Permalink
Improved finding autoload file
Browse files Browse the repository at this point in the history
  • Loading branch information
norberttech committed Jan 24, 2025
1 parent f7b7e1b commit a00150e
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions bin/automation
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,16 @@ use Symfony\Component\Console\Output\ConsoleOutput;
error_reporting(E_ALL);
ini_set('display_errors', 'stderr');

if (is_file($autoload = getcwd() . '/vendor/autoload.php')) {
require $autoload;
} elseif (is_file($autoload = getcwd() . '/../../autoload.php')) {
require $autoload;
} elseif (is_file($autoload = __DIR__ . '/../vendor/autoload.php')) {
require($autoload);
} elseif (is_file($autoload = __DIR__ . '/../../../autoload.php')) {
require($autoload);
} else {
$autoload = null;
foreach (array(__DIR__ . '/../../autoload.php', __DIR__ . '/../vendor/autoload.php', __DIR__ . '/vendor/autoload.php') as $file) {
if (file_exists($file)) {
$autoload = $file;

break;
}
}

if (!$autoload) {
fwrite(STDERR,
'You must set up the project dependencies, run the following commands:' . PHP_EOL .
'curl -s http://getcomposer.org/installer | php' . PHP_EOL .
Expand All @@ -41,6 +42,8 @@ use Symfony\Component\Console\Output\ConsoleOutput;
exit(1);
}

require $autoload;

$application = new AeonApplication('aeon-automation');
$output = new ConsoleOutput();
$input = new ArgvInput();
Expand Down

0 comments on commit a00150e

Please sign in to comment.