我正在使用fabpot / Sami存储库的此fork的v4.1.4,因为不再支持原始版本。分叉的仓库不接受问题,所以我在这里发布,希望对问题的原因有一些想法。
https://github.com/blueend-ag/Sami
尝试使用.phar文件运行更新命令时,我一直收到此错误。
php ./sami_v4.1.4.phar update ./sami.config.php -v
Updating project
In FilesystemLoader.php line 106:
[Twig\Error\LoaderError]
The "/" directory does not exist ("/").
奇怪的是,这仅在使用.phar文件时发生。如果我从提取的目录中提取phar并使用sami.php文件运行命令,它将运行得很好。有什么想法可能导致问题吗?此问题仅发生在此叉子的法尔。原始存储库中的密码也可以正常工作。
这是完整的堆栈跟踪:
php ./sami_v4.1.4.phar update ./sami.config.php -v
Updating project
In FilesystemLoader.php line 106:
[Twig\Error\LoaderError]
The "/" directory does not exist ("/").
Exception trace:
() at phar://F:/xxx/sami_v4.1.4.phar/vendor/twig/twig/src/Loader/FilesystemLoader.php:106
Twig\Loader\FilesystemLoader->addPath() at phar://F:/xxx/sami_v4.1.4.phar/vendor/twig/twig/src/Loader/FilesystemLoader.php:87
Twig\Loader\FilesystemLoader->setPaths() at phar://F:/xxx/sami_v4.1.4.phar/vendor/twig/twig/src/Loader/FilesystemLoader.php:45
Twig\Loader\FilesystemLoader->__construct() at phar://F:/xxx/sami_v4.1.4.phar/Sami/Sami.php:161
Sami\Sami->Sami\{closure}() at phar://F:/xxx/sami_v4.1.4.phar/vendor/pimple/pimple/src/Pimple/Container.php:118
Pimple\Container->offsetGet() at phar://F:/xxx/sami_v4.1.4.phar/Sami/Sami.php:135
Sami\Sami->Sami\{closure}() at phar://F:/xxx/sami_v4.1.4.phar/vendor/pimple/pimple/src/Pimple/Container.php:118
Pimple\Container->offsetGet() at phar://F:/xxx/sami_v4.1.4.phar/Sami/Sami.php:80
Sami\Sami->Sami\{closure}() at phar://F:/xxx/sami_v4.1.4.phar/vendor/pimple/pimple/src/Pimple/Container.php:118
Pimple\Container->offsetGet() at phar://F:/xxx/sami_v4.1.4.phar/Sami/Console/Command/UpdateCommand.php:53
Sami\Console\Command\UpdateCommand->execute() at phar://F:/xxx/sami_v4.1.4.phar/vendor/symfony/console/Command/Command.php:255
Symfony\Component\Console\Command\Command->run() at phar://F:/xxx/sami_v4.1.4.phar/vendor/symfony/console/Application.php:908
Symfony\Component\Console\Application->doRunCommand() at phar://F:/xxx/sami_v4.1.4.phar/vendor/symfony/console/Application.php:269
Symfony\Component\Console\Application->doRun() at phar://F:/xxx/sami_v4.1.4.phar/vendor/symfony/console/Application.php:145
Symfony\Component\Console\Application->run() at phar://F:/xxx/sami_v4.1.4.phar/sami.php:13
include() at F:\xxx\sami_v4.1.4.phar:9
sami.config.php
use Sami\Sami;
use Sami\RemoteRepository\GitLabRemoteRepository;
use Symfony\Component\Finder\Finder;
use Sami\Version\GitVersionCollection;
$dir = dirname(__DIR__,1) . '/my-application/app';
$iterator = Finder::create()
->files()
->name('*.php')
->exclude('node_modules')
->exclude('resources')
->exclude('database')
->exclude('config')
->exclude('routes')
->exclude('bootstrap')
->exclude('storage')
->exclude('tests')
->exclude('vendor')
->in($dir);
$versions = GitVersionCollection::create($dir)
->add('release/v0.1', 'v0.1')
->add('release/v0.2', 'v0.2')
->add('release/v0.3', 'v0.3')
->add('release/v1.0', 'v1.0')
->add('release/v1.1', 'v1.1')
->add('release/v1.1', 'v1.1')
->add('develop', 'develop')
->add('master', 'master');
return new Sami($iterator, [
'versions' => $versions,
'theme' => 'default',
'title' => 'API Docs',
'build_dir' => __DIR__ . '/docs/api/%version%',
'cache_dir' => __DIR__ . '/docs/api/cache/%version%',
'remote_repository' => new GitLabRemoteRepository('test/test', dirname($dir), 'https://gitlab.com/'),
]);
到目前为止已进行调试:
-在配置中使用绝对目录路径
-提取并重新编译Phar文件
-将sami_v4.1.4.phar
和sami.config.php
的位置更改为各种目录(根目录,子目录,兄弟目录,父目录)。