mirror of
https://github.com/ramsey/uuid.git
synced 2026-06-15 16:07:55 +03:00
Fix bug in which uuid CLI tool could not find autoloader
This commit is contained in:
@@ -13,17 +13,29 @@
|
||||
date_default_timezone_set('UTC');
|
||||
|
||||
if (PHP_SAPI !== 'cli') {
|
||||
echo 'Warning: uuid should be invoked via the CLI version of PHP, not the ' . PHP_SAPI . ' SAPI' . PHP_EOL;
|
||||
die('uuid should be invoked via the CLI version of PHP, not the ' . PHP_SAPI . ' SAPI' . PHP_EOL);
|
||||
}
|
||||
|
||||
if (!file_exists(__DIR__ . '/../vendor/autoload.php')) {
|
||||
echo 'You must set up the project dependencies, run the following commands:' . PHP_EOL .
|
||||
'curl -sS https://getcomposer.org/installer | php' . PHP_EOL .
|
||||
'php composer.phar install' . PHP_EOL;
|
||||
exit(1);
|
||||
$files = array(
|
||||
__DIR__ . '/../vendor/autoload.php',
|
||||
__DIR__ . '/../../../autoload.php',
|
||||
);
|
||||
|
||||
foreach ($files as $file) {
|
||||
if (file_exists($file)) {
|
||||
require $file;
|
||||
define('UUID_COMPOSER_INSTALL', $file);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
if (!defined('UUID_COMPOSER_INSTALL')) {
|
||||
die(
|
||||
'You need to set up the project dependencies using the following commands:' . PHP_EOL .
|
||||
'curl -s http://getcomposer.org/installer | php' . PHP_EOL .
|
||||
'php composer.phar install' . PHP_EOL
|
||||
);
|
||||
}
|
||||
|
||||
use Rhumsaa\Uuid\Console\Application;
|
||||
use Rhumsaa\Uuid\Console\Command;
|
||||
|
||||
Reference in New Issue
Block a user