Skip to content

Commit

Permalink
Feature: auto version for git achive and fix duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
donhardman committed Jan 23, 2025
1 parent 3a661d8 commit 73d5895
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 31 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
APP_VERSION export-subst
2 changes: 1 addition & 1 deletion APP_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.1
$Format:%(describe:tags=true)$
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
37 changes: 18 additions & 19 deletions composer.lock

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

1 change: 0 additions & 1 deletion packages/rpm.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
9 changes: 1 addition & 8 deletions src/Lib/Metric.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,7 @@ public function send(): bool {
* @return array<string,string>
*/
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');
Expand Down
3 changes: 2 additions & 1 deletion test/Buddy/src/Lib/CliArgsProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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'));
Expand Down

0 comments on commit 73d5895

Please sign in to comment.