1
0
Fork 0

Removed foxx store and client foxx manager dependency on common/bootstrap/module

This commit is contained in:
Michael Hackstein 2015-01-14 14:57:40 +01:00
parent d73482219c
commit e7f08e04db
3 changed files with 162 additions and 162 deletions

View File

@ -1,5 +1,5 @@
/*jshint unused: false */ /*jshint unused: false */
/*global require, exports, module */ /*global require, exports*/
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief ArangoDB Application Launcher /// @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]; version = keys[keys.length - 1];
source = available.versions[version]; source = available.versions[version];
} }
@ -204,7 +204,7 @@ function fetchGithubForInstall (name) {
while (cursor.hasNext()) { while (cursor.hasNext()) {
doc = cursor.next(); doc = cursor.next();
if (module.compareVersions(version, doc.version) <= 0) { if (store.compareVersions(version, doc.version) <= 0) {
version = doc.version; version = doc.version;
source = "fetched"; source = "fetched";
appId = doc.app; appId = doc.app;

View File

@ -1333,58 +1333,6 @@ function require (path) {
return startupPath; 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 /// @brief normalize
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@ -1,5 +1,5 @@
/*jslint continue:true */ /*jslint continue:true */
/*global require, exports, module */ /*global require, exports*/
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief Foxx application store /// @brief Foxx application store
@ -57,9 +57,9 @@
/// @brief returns the fishbowl repository /// @brief returns the fishbowl repository
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
function getFishbowlUrl () { function getFishbowlUrl () {
return "arangodb/foxx-apps"; return "arangodb/foxx-apps";
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief returns the fishbowl collection /// @brief returns the fishbowl collection
@ -69,7 +69,7 @@ function getFishbowlUrl () {
/// used in context of the database. /// used in context of the database.
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
var getFishbowlStorage = function() { var getFishbowlStorage = function() {
var c = db._collection('_fishbowl'); var c = db._collection('_fishbowl');
if (c === null) { if (c === null) {
@ -84,7 +84,8 @@ var getFishbowlStorage = function() {
} }
return c; return c;
}; };
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief comparator for applications /// @brief comparator for applications
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -104,11 +105,62 @@ var getFishbowlStorage = function() {
return 0; 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 /// @brief updates the fishbowl from a zip archive
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
function updateFishbowlFromZip (filename) { var updateFishbowlFromZip = function(filename) {
var i; var i;
var tempPath = fs.getTempPath(); var tempPath = fs.getTempPath();
var toSave = [ ]; var toSave = [ ];
@ -201,10 +253,7 @@ function updateFishbowlFromZip (filename) {
throw err; throw err;
} }
} };
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// Section public functions /// Section public functions
@ -298,7 +347,7 @@ function availableJson() {
maxVersion = "-"; maxVersion = "-";
versions = Object.keys(doc.versions); versions = Object.keys(doc.versions);
versions.sort(module.compareVersions); versions.sort(compareVersions);
if (versions.length > 0) { if (versions.length > 0) {
versions.reverse(); versions.reverse();
maxVersion = versions[0]; maxVersion = versions[0];
@ -423,7 +472,7 @@ function availableJson() {
var header = false; var header = false;
var versions = Object.keys(desc.versions); var versions = Object.keys(desc.versions);
versions.sort(module.compareVersions); versions.sort(compareVersions);
versions.forEach(function (v) { versions.forEach(function (v) {
var version = desc.versions[v]; var version = desc.versions[v];
@ -461,6 +510,9 @@ function availableJson() {
exports.update = update; exports.update = update;
exports.info = info; exports.info = info;
// Temporary export to avoid breaking the client
exports.compareVersions = compareVersions;
}()); }());
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------