Set version via environment variable
Change-Id: I09a496f0fc55c2dd7ef808ee85df9aa3c8f875b4
diff --git a/Changes b/Changes
index 3c5b79e..c7ca762 100755
--- a/Changes
+++ b/Changes
@@ -9,6 +9,8 @@
variable to load plugins in addition to the 'plugins'
parameter in the configuration file. (diewald)
- Allow popups in plugin widgets. (diewald)
+ - Set version via KALAMAR_VERSION environment variable.
+ (diewald)
0.47 2022-11-22
- Add command to generate super_client_info file. (diewald)
diff --git a/lib/Kalamar.pm b/lib/Kalamar.pm
index ffb5499..31ac587 100644
--- a/lib/Kalamar.pm
+++ b/lib/Kalamar.pm
@@ -26,7 +26,10 @@
# Set version based on package file
# This may introduce a SemVer patch number
my $pkg_path = $self->home->child('package.json');
- if (-e $pkg_path->to_abs) {
+ if ($ENV{KALAMAR_VERSION}) {
+ $Kalamar::VERSION = $ENV{KALAMAR_VERSION};
+ }
+ elsif (-e $pkg_path->to_abs) {
my $pkg = $pkg_path->slurp;
$Kalamar::VERSION = decode_json($pkg)->{version};
};
diff --git a/t/intro.t b/t/intro.t
index 3178098..f93ea73 100644
--- a/t/intro.t
+++ b/t/intro.t
@@ -4,6 +4,8 @@
use Mojo::File qw/path/;
use utf8;
+$ENV{KALAMAR_VERSION} = '0.47.999';
+
my $t = Test::Mojo->new('Kalamar');
$t->app->mode('production');
@@ -16,6 +18,7 @@
->text_is('div.intro > p > strong', 'KorAP')
->content_unlike(qr!onload!)
->text_is('#link-guided-tour', 'guided tour')
+ ->text_is('nav > a[href=/doc/korap/kalamar]', 'V 0.47.999')
;
# Only routed when existing