mirror of https://gitee.com/bigwinds/arangodb
Removed foxx store and client foxx manager dependency on common/bootstrap/module
This commit is contained in:
parent
d73482219c
commit
e7f08e04db
|
@ -1,5 +1,5 @@
|
|||
/*jshint unused: false */
|
||||
/*global require, exports, module */
|
||||
/*global require, exports*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief ArangoDB Application Launcher
|
||||
|
@ -187,7 +187,7 @@ function fetchGithubForInstall (name) {
|
|||
}
|
||||
}
|
||||
|
||||
keys = keys.sort(module.compareVersions);
|
||||
keys = keys.sort(store.compareVersions);
|
||||
version = keys[keys.length - 1];
|
||||
source = available.versions[version];
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ function fetchGithubForInstall (name) {
|
|||
while (cursor.hasNext()) {
|
||||
doc = cursor.next();
|
||||
|
||||
if (module.compareVersions(version, doc.version) <= 0) {
|
||||
if (store.compareVersions(version, doc.version) <= 0) {
|
||||
version = doc.version;
|
||||
source = "fetched";
|
||||
appId = doc.app;
|
||||
|
|
|
@ -1333,58 +1333,6 @@ function require (path) {
|
|||
return startupPath;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief compareVersions
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Module.prototype.compareVersions = function (a, b) {
|
||||
'use strict';
|
||||
|
||||
var i;
|
||||
|
||||
if (a === b) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// error handling
|
||||
if (typeof a !== "string") {
|
||||
return -1;
|
||||
}
|
||||
if (typeof b !== "string") {
|
||||
return 1;
|
||||
}
|
||||
|
||||
var aComponents = a.split(".");
|
||||
var bComponents = b.split(".");
|
||||
var len = Math.min(aComponents.length, bComponents.length);
|
||||
|
||||
// loop while the components are equal
|
||||
for (i = 0; i < len; i++) {
|
||||
|
||||
// A bigger than B
|
||||
if (parseInt(aComponents[i], 10) > parseInt(bComponents[i], 10)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// B bigger than A
|
||||
if (parseInt(aComponents[i], 10) < parseInt(bComponents[i], 10)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
// If one's a prefix of the other, the longer one is bigger one.
|
||||
if (aComponents.length > bComponents.length) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (aComponents.length < bComponents.length) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Otherwise they are the same.
|
||||
return 0;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief normalize
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*jslint continue:true */
|
||||
/*global require, exports, module */
|
||||
/*global require, exports*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Foxx application store
|
||||
|
@ -57,9 +57,9 @@
|
|||
/// @brief returns the fishbowl repository
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function getFishbowlUrl () {
|
||||
function getFishbowlUrl () {
|
||||
return "arangodb/foxx-apps";
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns the fishbowl collection
|
||||
|
@ -69,7 +69,7 @@ function getFishbowlUrl () {
|
|||
/// used in context of the database.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var getFishbowlStorage = function() {
|
||||
var getFishbowlStorage = function() {
|
||||
|
||||
var c = db._collection('_fishbowl');
|
||||
if (c === null) {
|
||||
|
@ -84,7 +84,8 @@ var getFishbowlStorage = function() {
|
|||
}
|
||||
|
||||
return c;
|
||||
};
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief comparator for applications
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -104,11 +105,62 @@ var getFishbowlStorage = function() {
|
|||
return 0;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief comparator for versions
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var compareVersions = function (a, b) {
|
||||
var i;
|
||||
|
||||
if (a === b) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// error handling
|
||||
if (typeof a !== "string") {
|
||||
return -1;
|
||||
}
|
||||
if (typeof b !== "string") {
|
||||
return 1;
|
||||
}
|
||||
|
||||
var aComponents = a.split(".");
|
||||
var bComponents = b.split(".");
|
||||
var len = Math.min(aComponents.length, bComponents.length);
|
||||
|
||||
// loop while the components are equal
|
||||
for (i = 0; i < len; i++) {
|
||||
|
||||
// A bigger than B
|
||||
if (parseInt(aComponents[i], 10) > parseInt(bComponents[i], 10)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// B bigger than A
|
||||
if (parseInt(aComponents[i], 10) < parseInt(bComponents[i], 10)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
// If one's a prefix of the other, the longer one is bigger one.
|
||||
if (aComponents.length > bComponents.length) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (aComponents.length < bComponents.length) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Otherwise they are the same.
|
||||
return 0;
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief updates the fishbowl from a zip archive
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function updateFishbowlFromZip (filename) {
|
||||
var updateFishbowlFromZip = function(filename) {
|
||||
var i;
|
||||
var tempPath = fs.getTempPath();
|
||||
var toSave = [ ];
|
||||
|
@ -201,10 +253,7 @@ function updateFishbowlFromZip (filename) {
|
|||
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Section public functions
|
||||
|
@ -298,7 +347,7 @@ function availableJson() {
|
|||
|
||||
maxVersion = "-";
|
||||
versions = Object.keys(doc.versions);
|
||||
versions.sort(module.compareVersions);
|
||||
versions.sort(compareVersions);
|
||||
if (versions.length > 0) {
|
||||
versions.reverse();
|
||||
maxVersion = versions[0];
|
||||
|
@ -423,7 +472,7 @@ function availableJson() {
|
|||
|
||||
var header = false;
|
||||
var versions = Object.keys(desc.versions);
|
||||
versions.sort(module.compareVersions);
|
||||
versions.sort(compareVersions);
|
||||
|
||||
versions.forEach(function (v) {
|
||||
var version = desc.versions[v];
|
||||
|
@ -461,6 +510,9 @@ function availableJson() {
|
|||
exports.update = update;
|
||||
exports.info = info;
|
||||
|
||||
// Temporary export to avoid breaking the client
|
||||
exports.compareVersions = compareVersions;
|
||||
|
||||
}());
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue