Skip to content

Commit

Permalink
Use Composer\InstalledVersions to retrieve the installed version
Browse files Browse the repository at this point in the history
Following the recommendation from @sasezaki at #366
  • Loading branch information
sj-i committed Nov 27, 2023
1 parent fc94521 commit edb2a79
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion reli
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ $application = new Application();
$container = (new ContainerBuilder())->addDefinitions(__DIR__ . '/config/di.php')->build();

$application->setName(ReliProfiler::TOOL_NAME);
$application->setVersion(ReliProfiler::VERSION);
$application->setVersion(ReliProfiler::getVersion());

Log::initializeLogger(
$container->make(LoggerInterface::class),
Expand Down
10 changes: 8 additions & 2 deletions src/ReliProfiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,19 @@

namespace Reli;

use Composer\InstalledVersions;

final class ReliProfiler
{
public const TOOL_NAME = 'reli';
public const VERSION = '0.10.0';

public static function getVersion(): string
{
return InstalledVersions::getPrettyVersion('reliforp/reli-prof') ?? 'unknown';
}

public static function toolSignature(): string
{
return self::TOOL_NAME . ' ' . self::VERSION;
return self::TOOL_NAME . ' ' . self::getVersion();
}
}

0 comments on commit edb2a79

Please sign in to comment.