1
0
Fork 0

semver foxx plain func (#6293)

This commit is contained in:
Heiko 2018-08-29 20:26:03 +02:00 committed by Michael Hackstein
parent 462bfd0063
commit 6ac135e876
1 changed files with 12 additions and 7 deletions

View File

@ -26,6 +26,7 @@
module.isSystem = true;
var common = require('@arangodb/common');
const semver = require('semver');
Object.keys(common).forEach(function (key) {
exports[key] = common[key];
@ -80,16 +81,20 @@ exports.db = internal.db;
exports.plainServerVersion = function () {
let version = internal.version;
let devel = version.match(/(.*)\.devel/);
if (devel !== null) {
version = devel[1] + '.0';
} else {
devel = version.match(/(.*)((milestone|alpha|beta|devel|rc)[0-9]*)$/);
if (semver.valid(version) === null) {
let devel = version.match(/(.*)\.devel/);
if (devel !== null) {
version = devel[1] + '0';;
version = devel[1] + '.0';
} else {
devel = version.match(/(.*)((milestone|alpha|beta|devel|rc)[0-9]*)$/);
if (devel !== null) {
version = devel[1] + '0';
}
}
} else {
version = semver.major(version) + '.' + semver.minor(version) + '.' + semver.patch(version);
}
return version;