diff -up ./bin/phpreflect.json.dist.rpm ./bin/phpreflect.json.dist --- ./bin/phpreflect.json.dist.rpm 2019-04-07 17:37:00.000000000 +0200 +++ ./bin/phpreflect.json.dist 2019-04-09 14:47:07.638174748 +0200 @@ -6,6 +6,19 @@ } ], "plugins": [ + { + "name": "Cache", + "class": "Bartlett\\Reflect\\Plugin\\CachePlugin", + "options": { + "adapter": "DoctrineCacheAdapter", + "backend": { + "class": "Doctrine\\Common\\Cache\\FilesystemCache", + "args": [ + "%{HOME}/.cache/php-reflect" + ] + } + } + } ], "analysers": [ ], diff -up ./bin/phpreflect.rpm ./bin/phpreflect --- ./bin/phpreflect.rpm 2019-04-09 14:47:07.639174753 +0200 +++ ./bin/phpreflect 2019-04-09 14:53:18.251134771 +0200 @@ -6,28 +6,12 @@ declare(strict_types=1); gc_disable(); // performance boost -$possibleAutoloadPaths = [ - // local dev repository - __DIR__ . '/../vendor/autoload.php', - // dependency - __DIR__ . '/../../../../vendor/autoload.php', -]; +$vendorDir = '/usr/share/php'; +if (is_file('/usr/share/php-bartlett-PHP-CompatInfo/compatinfo.sqlite')) { + putenv('BARTLETT_COMPATINFO_DB=/usr/share/php-bartlett-PHP-CompatInfo/compatinfo.sqlite'); + } -$isAutoloadFound = false; -foreach ($possibleAutoloadPaths as $possibleAutoloadPath) { - if (file_exists($possibleAutoloadPath)) { - require_once $possibleAutoloadPath; - $isAutoloadFound = true; - break; - } -} - -if ($isAutoloadFound === false) { - throw new RuntimeException(sprintf( - 'Unable to find "vendor/autoload.php" in "%s" paths.', - implode('", "', $possibleAutoloadPaths) - )); -} +require_once $vendorDir . '/Bartlett/Reflect/autoload.php'; $application = new \Bartlett\Reflect\Presentation\Console\Application('phpReflect'); $application->run(); diff -up ./src/Reflect/Presentation/Console/Application.php.rpm ./src/Reflect/Presentation/Console/Application.php --- ./src/Reflect/Presentation/Console/Application.php.rpm 2019-04-09 14:51:38.632607939 +0200 +++ ./src/Reflect/Presentation/Console/Application.php 2019-04-09 14:52:25.779857292 +0200 @@ -82,12 +82,7 @@ class Application extends \Symfony\Compo public function __construct(string $name = 'UNKNOWN') { - try { - $version = \Jean85\PrettyVersions::getVersion('bartlett/php-reflect')->getPrettyVersion(); - } catch (\OutOfBoundsException $e) { - $version = 'UNKNOWN'; - } - parent::__construct($name, $version); + parent::__construct($name, "@VERSION@"); $this->baseDir = dirname(dirname(dirname(dirname(__DIR__)))); } diff -up ./tests/bootstrap.php.rpm ./tests/bootstrap.php --- ./tests/bootstrap.php.rpm 2019-04-07 17:37:00.000000000 +0200 +++ ./tests/bootstrap.php 2019-04-09 14:47:07.639174753 +0200 @@ -1,11 +1,10 @@ addClassMap( - array( +require_once '@BUILDROOT@/usr/share/php/Bartlett/Reflect/autoload.php'; +$tab = array( 'Bartlett\Tests\Reflect\Analyser\FooAnalyser' => __DIR__ . '/Analyser/FooAnalyser.php', 'Bartlett\Tests\Reflect\Analyser\BarAnalyser' @@ -14,5 +13,13 @@ $loader->addClassMap( => __DIR__ . '/Model/GenericModelTest.php', 'Bartlett\Tests\Reflect\Environment\YourLogger' => __DIR__ . '/Environment/YourLogger.php', - ) ); + +\Fedora\Autoloader\Autoload::addClassMap($tab, '/'); +\Fedora\Autoloader\Autoload::addPsr4('Bartlett\\Tests\\Reflect', $baseDir . '/tests'); + +// Needed when installed for 'Bartlett\CompatInfo\Analyser\CompatibilityAnalyser' +if (is_file('/usr/share/php-bartlett-PHP-CompatInfo/compatinfo.sqlite')) { + putenv("BARTLETT_COMPATINFO_DB=/usr/share/php-bartlett-PHP-CompatInfo/compatinfo.sqlite"); +} +