mirror of
https://github.com/php/pie.git
synced 2026-03-23 23:12:17 +01:00
Display version and package name correctly
This commit is contained in:
2
.github/workflows/continuous-integration.yml
vendored
2
.github/workflows/continuous-integration.yml
vendored
@@ -83,6 +83,8 @@ jobs:
|
||||
tools: composer, box
|
||||
php-version: "${{ matrix.php-version }}"
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: ramsey/composer-install@v3
|
||||
- name: Build PHAR
|
||||
run: box compile
|
||||
|
||||
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -22,6 +22,8 @@ jobs:
|
||||
tools: composer, box
|
||||
php-version: "${{ matrix.php-version }}"
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: ramsey/composer-install@v3
|
||||
- name: Build PHAR
|
||||
run: box compile
|
||||
|
||||
32
bin/pie
32
bin/pie
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Php\Pie;
|
||||
|
||||
use Composer\InstalledVersions;
|
||||
use Php\Pie\Command\BuildCommand;
|
||||
use Php\Pie\Command\DownloadCommand;
|
||||
use Php\Pie\Command\InfoCommand;
|
||||
@@ -20,7 +21,36 @@ include $_composer_autoload_path ?? __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
$container = Container::factory();
|
||||
|
||||
$application = new Application('pie', 'dev-main');
|
||||
$application = new Application(
|
||||
'🥧 PHP Installer for Extensions (PIE)',
|
||||
(static function (): string {
|
||||
$pieVersion = '@pie_version@';
|
||||
|
||||
/**
|
||||
* @psalm-suppress RedundantCondition
|
||||
* @noinspection PhpConditionAlreadyCheckedInspection
|
||||
*/
|
||||
if ($pieVersion === '@pie_version'.'@') {
|
||||
if (!class_exists(InstalledVersions::class)) {
|
||||
/**
|
||||
* Note: magic constant that causes Symfony Console to not display a version
|
||||
* {@see Application::getLongVersion()}
|
||||
*/
|
||||
return 'UNKNOWN';
|
||||
}
|
||||
|
||||
$installedVersion = InstalledVersions::getVersion(InstalledVersions::getRootPackage()['name']);
|
||||
if ($installedVersion === null) {
|
||||
return 'UNKNOWN';
|
||||
}
|
||||
|
||||
return $installedVersion;
|
||||
}
|
||||
|
||||
/** @psalm-suppress NoValue */
|
||||
return $pieVersion;
|
||||
})()
|
||||
);
|
||||
$application->setCommandLoader(new ContainerCommandLoader(
|
||||
$container,
|
||||
[
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"alias": "pie.phar",
|
||||
"output": "pie.phar"
|
||||
"output": "pie.phar",
|
||||
"git": "pie_version"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user