Add composer autoload guard
This commit is contained in:
parent
a305a5a92a
commit
a42e46aaad
25
bin/orbit
25
bin/orbit
|
@ -1,7 +1,30 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
require_once dirname(__DIR__) . "/vendor/autoload.php";
|
||||
// Find where the composer autoload is
|
||||
// This tool was installed as a composed dependency or directly
|
||||
$root = realpath(dirname(__DIR__));
|
||||
$autoload_locations = array(
|
||||
__DIR__ . '/../../../autoload.php',
|
||||
$root . DIRECTORY_SEPARATOR . 'vendor/autoload.php'
|
||||
);
|
||||
foreach ($autoload_locations as $file) {
|
||||
if (file_exists($file)) {
|
||||
define('ORBIT_COMPOSER_AUTOLOAD', $file);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Composer autoload require guard
|
||||
if (!defined('ORBIT_COMPOSER_AUTOLOAD')) {
|
||||
die(
|
||||
"You must run the command `composer install` from the terminal "
|
||||
. "in the directory '$root' before using this tool.\n"
|
||||
);
|
||||
}
|
||||
|
||||
// Load composer autoloader
|
||||
$autoload = require_once ORBIT_COMPOSER_AUTOLOAD;
|
||||
|
||||
// Define command line args for this client
|
||||
// And fetch args passed in by invocation
|
||||
|
|
Loading…
Reference in New Issue