diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..43355f42 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +APP_VERSION export-subst diff --git a/APP_VERSION b/APP_VERSION index 94ff29cc..8d694aa3 100644 --- a/APP_VERSION +++ b/APP_VERSION @@ -1 +1 @@ -3.1.1 +$Format:%(describe:tags=true)$ diff --git a/composer.json b/composer.json index f095b86a..ba2fa3a6 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,7 @@ "require": { "manticoresoftware/telemetry": "^0.1.19", "symfony/dependency-injection": "^6.1", - "manticoresoftware/buddy-core": "dev-main", + "manticoresoftware/buddy-core": "dev-feature/app-version-detection", "php-ds/php-ds": "^1.4", "manticoresoftware/manticoresearch-backup": "^1.3", "symfony/expression-language": "^6.4" diff --git a/composer.lock b/composer.lock index 22b3dc8f..76b05890 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f8b8f7446a01b57af60c5fcd61adb8c7", + "content-hash": "853610edd1834ca32528cee77d04dae7", "packages": [ { "name": "composer/ca-bundle", @@ -157,16 +157,16 @@ }, { "name": "composer/composer", - "version": "2.8.4", + "version": "2.8.5", "source": { "type": "git", "url": "https://github.com/composer/composer.git", - "reference": "112e37d1dca22b3fdb81cf3524ab4994f47fdb8c" + "reference": "ae208dc1e182bd45d99fcecb956501da212454a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/112e37d1dca22b3fdb81cf3524ab4994f47fdb8c", - "reference": "112e37d1dca22b3fdb81cf3524ab4994f47fdb8c", + "url": "https://api.github.com/repos/composer/composer/zipball/ae208dc1e182bd45d99fcecb956501da212454a1", + "reference": "ae208dc1e182bd45d99fcecb956501da212454a1", "shasum": "" }, "require": { @@ -251,7 +251,7 @@ "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/composer/issues", "security": "https://github.com/composer/composer/security/policy", - "source": "https://github.com/composer/composer/tree/2.8.4" + "source": "https://github.com/composer/composer/tree/2.8.5" }, "funding": [ { @@ -267,7 +267,7 @@ "type": "tidelift" } ], - "time": "2024-12-11T10:57:47+00:00" + "time": "2025-01-21T14:23:40+00:00" }, { "name": "composer/metadata-minifier", @@ -711,16 +711,16 @@ }, { "name": "manticoresoftware/buddy-core", - "version": "dev-main", + "version": "dev-feature/app-version-detection", "source": { "type": "git", "url": "https://github.com/manticoresoftware/buddy-core.git", - "reference": "ab8e9a84618658a7a75d2b2c30cda5f289d9bf7f" + "reference": "d577e98faab95c7ba67f638d55a425b0dab53fea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/manticoresoftware/buddy-core/zipball/ab8e9a84618658a7a75d2b2c30cda5f289d9bf7f", - "reference": "ab8e9a84618658a7a75d2b2c30cda5f289d9bf7f", + "url": "https://api.github.com/repos/manticoresoftware/buddy-core/zipball/d577e98faab95c7ba67f638d55a425b0dab53fea", + "reference": "d577e98faab95c7ba67f638d55a425b0dab53fea", "shasum": "" }, "require": { @@ -736,7 +736,6 @@ "slevomat/coding-standard": "^8.5", "squizlabs/php_codesniffer": "^3.7" }, - "default-branch": true, "type": "library", "autoload": { "psr-4": { @@ -757,9 +756,9 @@ "description": "The Buddy Core to develop your own plugin for Manticore Search", "support": { "issues": "https://github.com/manticoresoftware/buddy-core/issues", - "source": "https://github.com/manticoresoftware/buddy-core/tree/main" + "source": "https://github.com/manticoresoftware/buddy-core/tree/feature/app-version-detection" }, - "time": "2025-01-21T09:39:01+00:00" + "time": "2025-01-23T05:16:44+00:00" }, { "name": "manticoresoftware/manticoresearch-backup", @@ -3376,16 +3375,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.15", + "version": "1.12.16", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "c91d4e8bc056f46cf653656e6f71004b254574d1" + "reference": "e0bb5cb78545aae631220735aa706eac633a6be9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c91d4e8bc056f46cf653656e6f71004b254574d1", - "reference": "c91d4e8bc056f46cf653656e6f71004b254574d1", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e0bb5cb78545aae631220735aa706eac633a6be9", + "reference": "e0bb5cb78545aae631220735aa706eac633a6be9", "shasum": "" }, "require": { @@ -3430,7 +3429,7 @@ "type": "github" } ], - "time": "2025-01-05T16:40:22+00:00" + "time": "2025-01-21T14:50:05+00:00" }, { "name": "phpunit/php-code-coverage", diff --git a/packages/rpm.spec b/packages/rpm.spec index df569e8d..3915e371 100644 --- a/packages/rpm.spec +++ b/packages/rpm.spec @@ -39,7 +39,6 @@ rm -rf %{buildroot} %dir /usr/share/manticore/modules/{{ NAME }}/bin /usr/share/manticore/modules/{{ NAME }}/src/* /usr/share/manticore/modules/{{ NAME }}/vendor/* -/usr/share/manticore/modules/{{ NAME }}/APP_VERSION /usr/share/manticore/modules/{{ NAME }}/composer.json /usr/share/manticore/modules/{{ NAME }}/composer.lock %attr(1755, root, root) /usr/share/manticore/modules/{{ NAME }}/bin/{{ NAME }} diff --git a/src/Lib/Metric.php b/src/Lib/Metric.php index 7f8f2d13..1123b996 100644 --- a/src/Lib/Metric.php +++ b/src/Lib/Metric.php @@ -138,14 +138,7 @@ public function send(): bool { * @return array */ public function getVersions(): array { - $buddyVersion = trim( - (string)file_get_contents( - __DIR__ . DIRECTORY_SEPARATOR . '..' - . DIRECTORY_SEPARATOR. '..' - . DIRECTORY_SEPARATOR . 'APP_VERSION' - ) - ); - + $buddyVersion = Buddy::getVersion(); $statusMap = $this->getStatusMap(); if (!isset($statusMap['version'])) { Buddy::debug('metric: failed to get version from SHOW STATUS query'); diff --git a/test/Buddy/src/Lib/CliArgsProcessorTest.php b/test/Buddy/src/Lib/CliArgsProcessorTest.php index 99a67109..d92552c2 100644 --- a/test/Buddy/src/Lib/CliArgsProcessorTest.php +++ b/test/Buddy/src/Lib/CliArgsProcessorTest.php @@ -10,6 +10,7 @@ */ use Manticoresearch\Buddy\Base\Lib\CliArgsProcessor; +use Manticoresearch\Buddy\Core\Tool\Buddy; use Manticoresearch\BuddyTest\Trait\TestProtectedTrait; use PHPUnit\Framework\TestCase; @@ -53,7 +54,7 @@ public function testVersionArgProcessOk(): void { CliArgsProcessor::run(); echo "\nTesting the processing of the `version` argument\n"; - $version = trim((string)file_get_contents(__DIR__ . '/../../../../APP_VERSION')); + $version = Buddy::getVersion(); $res = "Manticore Buddy v$version\n" . "Copyright (c) 2024, Manticore Software LTD (https://manticoresearch.com)\n"; $this->assertEquals($res, self::invokeMethod(CliArgsProcessor::class, 'version'));