1
0
Fork 0

fixed server version

This commit is contained in:
Frank Celler 2016-03-16 13:01:18 +01:00
parent aede7c5eb1
commit d9f9b8b65d
4 changed files with 24 additions and 28 deletions

View File

@ -1,12 +1,9 @@
'use strict'; 'use strict';
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief JavaScript base module
///
/// @file
///
/// DISCLAIMER /// DISCLAIMER
/// ///
/// Copyright 2016 ArangoDB GmbH, Cologne, Germany
/// Copyright 2012 triagens GmbH, Cologne, Germany /// Copyright 2012 triagens GmbH, Cologne, Germany
/// ///
/// Licensed under the Apache License, Version 2.0 (the "License"); /// Licensed under the Apache License, Version 2.0 (the "License");
@ -21,20 +18,18 @@
/// See the License for the specific language governing permissions and /// See the License for the specific language governing permissions and
/// limitations under the License. /// limitations under the License.
/// ///
/// Copyright holder is triAGENS GmbH, Cologne, Germany /// Copyright holder is ArangoDB GmbH, Cologne, Germany
/// ///
/// @author Dr. Frank Celler /// @author Dr. Frank Celler
/// @author Copyright 2012, triAGENS GmbH, Cologne, Germany
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
var internal = require("internal"); var internal = require("internal");
var common = require("@arangodb/common"); var common = require("@arangodb/common");
Object.keys(common).forEach(function (key) { Object.keys(common).forEach(function(key) {
exports[key] = common[key]; exports[key] = common[key];
}); });
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief isServer /// @brief isServer
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -90,8 +85,7 @@ if (typeof internal.arango !== 'undefined') {
exports.arango = internal.arango; exports.arango = internal.arango;
exports.db = new exports.ArangoDatabase(internal.arango); exports.db = new exports.ArangoDatabase(internal.arango);
internal.db = exports.db; // TODO remove internal.db = exports.db; // TODO remove
} } catch (err) {
catch (err) {
internal.print("cannot connect to server: " + String(err)); internal.print("cannot connect to server: " + String(err));
} }
} }
@ -103,17 +97,20 @@ if (typeof internal.arango !== 'undefined') {
exports.plainServerVersion = function() { exports.plainServerVersion = function() {
if (internal.arango) { if (internal.arango) {
let version = internal.arango.getVersion(); let version = internal.arango.getVersion();
let devel = version.match(/(.*)-((alpha|beta|devel|rc)[0-9]*)$/); let devel = version.match(/(.*)\.x-devel/);
if (devel !== null) { if (devel !== null) {
version = devel[1]; version = devel[1] + ".0";
} else {
devel = version.match(/(.*)-((alpha|beta|devel|rc)[0-9]*)$/);
if (devel !== null) {
version = devel[1];
}
} }
return version; return version;
} } else {
else {
return undefined; return undefined;
} }
}; };

View File

@ -1,12 +1,9 @@
'use strict'; 'use strict';
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief JavaScript base module
///
/// @file
///
/// DISCLAIMER /// DISCLAIMER
/// ///
/// Copyright 2016 ArangoDB GmbH, Cologne, Germany
/// Copyright 2012 triagens GmbH, Cologne, Germany /// Copyright 2012 triagens GmbH, Cologne, Germany
/// ///
/// Licensed under the Apache License, Version 2.0 (the "License"); /// Licensed under the Apache License, Version 2.0 (the "License");
@ -21,17 +18,16 @@
/// See the License for the specific language governing permissions and /// See the License for the specific language governing permissions and
/// limitations under the License. /// limitations under the License.
/// ///
/// Copyright holder is triAGENS GmbH, Cologne, Germany /// Copyright holder is ArangoDB GmbH, Cologne, Germany
/// ///
/// @author Dr. Frank Celler /// @author Dr. Frank Celler
/// @author Copyright 2012, triAGENS GmbH, Cologne, Germany
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
module.isSystem = true; module.isSystem = true;
var common = require("@arangodb/common"); var common = require("@arangodb/common");
Object.keys(common).forEach(function (key) { Object.keys(common).forEach(function(key) {
exports[key] = common[key]; exports[key] = common[key];
}); });
@ -39,7 +35,6 @@ var internal = require("internal"); // OK: db
var ShapedJson = require("@arangodb/shaped-json").ShapedJson; var ShapedJson = require("@arangodb/shaped-json").ShapedJson;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief isServer /// @brief isServer
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -91,13 +86,17 @@ exports.db = internal.db;
exports.plainServerVersion = function() { exports.plainServerVersion = function() {
let version = internal.version; let version = internal.version;
let devel = version.match(/(.*)-((alpha|beta|devel|rc)[0-9]*)$/); let devel = version.match(/(.*)\.x-devel/);
if (devel !== null) { if (devel !== null) {
version = devel[1]; version = devel[1] + ".0";
} else {
devel = version.match(/(.*)-((alpha|beta|devel|rc)[0-9]*)$/);
if (devel !== null) {
version = devel[1];
}
} }
return version; return version;
}; };