diff --git a/.gitignore b/.gitignore index 94ae2fdbd..b773d458c 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ coverage.html /*.bat /filestorage app/V1Module/presenters/_autogenerated_annotations_temp.php +/app/.version diff --git a/app/helpers/Config/ApiConfig.php b/app/helpers/Config/ApiConfig.php index 5dff1ea00..11f9039eb 100644 --- a/app/helpers/Config/ApiConfig.php +++ b/app/helpers/Config/ApiConfig.php @@ -2,8 +2,6 @@ namespace App\Helpers; -use limenet\GitVersion\Directory; -use limenet\GitVersion\Formatters\CustomFormatter; use Nette; use Nette\Utils\Arrays; @@ -56,7 +54,9 @@ public function __construct(array $config) $this->versionFormat = Arrays::get($config, ["versionFormat"], "{tag}"); // version is constructed from git version tag - $this->version = (new Directory(__DIR__))->get(new CustomFormatter($this->versionFormat)) ?: "UNKNOWN"; + $versionFile = __DIR__ . "/../../.version"; + $version = file_exists($versionFile) ? trim(@file_get_contents($versionFile)) : null; + $this->version = $version ?: "UNKNOWN"; } public function getAddress() diff --git a/composer.json b/composer.json index f72dd5126..56d9faff9 100644 --- a/composer.json +++ b/composer.json @@ -38,7 +38,6 @@ "ext-zip": ">=1.15", "latte/latte": "^3.1", "league/commonmark": "^2.8", - "limenet/git-version": "v0.1.6", "nelmio/alice": "^3.17", "nette/application": "^3.2", "nette/bootstrap": "^3.2", diff --git a/recodex-api.spec b/recodex-api.spec index 328e7714f..ff319becf 100644 --- a/recodex-api.spec +++ b/recodex-api.spec @@ -13,7 +13,7 @@ License: MIT Group: Development/Libraries BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot Prefix: %{_prefix} -Vendor: Petr Stefan +Vendor: ReCodEx Team Url: https://github.com/ReCodEx/api Requires(post): systemd Requires(preun): systemd @@ -41,6 +41,7 @@ ln -sf /var/log/recodex/core-api %{buildroot}%{install_dir}/log mkdir -p %{buildroot}%{install_dir}/temp cp -r www %{buildroot}%{install_dir}/www cp -r app %{buildroot}%{install_dir}/app +echo "v%{version}-%{release}" > %{buildroot}%{install_dir}/app/.version cp -r bin %{buildroot}%{install_dir}/bin cp -r migrations %{buildroot}%{install_dir}/migrations mkdir -p %{buildroot}%{install_dir}/fixtures