Skip to content

Commit

Permalink
Change versioning origin/resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
flavioheleno committed Feb 24, 2023
1 parent 43bbb18 commit ab5faf8
Show file tree
Hide file tree
Showing 9 changed files with 104 additions and 81 deletions.
12 changes: 11 additions & 1 deletion bin/console.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

require_once __DIR__ . '/../vendor/autoload.php';

use Composer\InstalledVersions;
use DI\ContainerBuilder;
use PackageHealth\PHP\Application\Console\Packagist\GetDataCommand;
use PackageHealth\PHP\Application\Console\Packagist\GetListCommand;
Expand All @@ -27,6 +28,15 @@
$dotenv->safeLoad();
}

define(
'__VERSION__',
sprintf(
'%s@%s',
InstalledVersions::getPrettyVersion('package-health/php'),
substr(InstalledVersions::getReference('package-health/php'), 0, 7)
)
);

// Instantiate PHP-DI ContainerBuilder
$containerBuilder = new ContainerBuilder();

Expand Down Expand Up @@ -65,7 +75,7 @@
$messages = require __DIR__ . '/../app/messages.php';
$messages($container);

$app = new Application('php.package.health console', $_ENV['VERSION'] ?? '');
$app = new Application('php.package.health console', __VERSION__);
$app->setCommandLoader(
new FactoryCommandLoader(
[
Expand Down
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"ext-posix": "*",
"ext-redis": "*",
"ext-zlib": "*",
"composer-runtime-api": "^2",
"badges/poser": "^2.3",
"composer/metadata-minifier": "^1.0",
"composer/semver": "^3.3",
Expand All @@ -54,6 +55,7 @@
"nyholm/dsn": "^2.0",
"nyholm/psr7": "^1.5",
"nyholm/psr7-server": "^1.0",
"ocramius/package-versions": "*",
"php-di/php-di": "^7.0",
"phpunit/php-timer": "^6.0",
"psr/cache": "^3.0",
Expand Down
151 changes: 76 additions & 75 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions public/index.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
declare(strict_types = 1);

use Composer\InstalledVersions;
use DI\ContainerBuilder;
use PackageHealth\PHP\Application\Handler\HttpErrorHandler;
use PackageHealth\PHP\Application\Handler\ShutdownHandler;
Expand All @@ -16,6 +17,15 @@
$dotenv->safeLoad();
}

define(
'__VERSION__',
sprintf(
'%s@%s',
InstalledVersions::getPrettyVersion('package-health/php'),
substr(InstalledVersions::getReference('package-health/php'), 0, 7)
)
);

// Instantiate PHP-DI ContainerBuilder
$containerBuilder = new ContainerBuilder();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ static function (Version $version): DateTimeImmutable {
],
'app' => [
'canonicalUrl' => (string)$this->request->getUri(),
'version' => $_ENV['VERSION']
'version' => __VERSION__
]
]
);
Expand Down
2 changes: 1 addition & 1 deletion src/Application/Action/Package/ListPackagesAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ static function (Package $package): DateTimeImmutable {
],
'app' => [
'canonicalUrl' => (string)$this->request->getUri(),
'version' => $_ENV['VERSION']
'version' => __VERSION__
]
]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ static function (Version $version): bool {
],
'app' => [
'canonicalUrl' => (string)$this->request->getUri(),
'version' => $_ENV['VERSION']
'version' => __VERSION__
]
]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ protected function action(): ResponseInterface {
],
'app' => [
'canonicalUrl' => (string)$this->request->getUri(),
'version' => $_ENV['VERSION']
'version' => __VERSION__
]
];

Expand Down
2 changes: 1 addition & 1 deletion src/Application/Action/Vendor/ListVendorPackagesAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static function (Package $package): DateTimeImmutable {
],
'app' => [
'canonicalUrl' => (string)$this->request->getUri(),
'version' => $_ENV['VERSION']
'version' => __VERSION__
]
]
);
Expand Down

0 comments on commit ab5faf8

Please sign in to comment.