Change autoloader requirement for bin file
Now the autoloader can be found within the repo itself, within a project dependency, or within a globally required copy. To be honest, the code is just copied from a number of similar bin-providing composer projects.
This commit is contained in:
parent
2fb157acaf
commit
1bd0468812
1 changed files with 22 additions and 1 deletions
|
@ -1,6 +1,27 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
require_once(dirname(__FILE__)."/../vendor/autoload.php");
|
||||
|
||||
$autoloadLocations = [
|
||||
getcwd() . '/vendor/autoload.php',
|
||||
getcwd() . '/../../autoload.php',
|
||||
__DIR__ . '/../vendor/autoload.php',
|
||||
__DIR__ . '/../../../autoload.php',
|
||||
];
|
||||
$loaded = false;
|
||||
foreach ($autoloadLocations as $autoload) {
|
||||
if (is_file($autoload)) {
|
||||
require_once($autoload);
|
||||
$loaded = true;
|
||||
}
|
||||
}
|
||||
if (!$loaded) {
|
||||
fwrite(STDERR,
|
||||
'You must set up the project dependencies, run the following commands:' . PHP_EOL .
|
||||
'curl -s http://getcomposer.org/installer | php' . PHP_EOL .
|
||||
'php composer.phar install' . PHP_EOL
|
||||
);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
use Composer2Nix\Composer;
|
||||
use Composer2Nix\Generator;
|
||||
|
|
Loading…
Reference in a new issue