mirror of https://gitee.com/bigwinds/arangodb
Removed appId and inserted a action stub to register the routing table for one foxx app.
This commit is contained in:
parent
873a5b409e
commit
1e4ba6e09b
|
@ -2144,10 +2144,18 @@ function stringifyRequestAddress (req) {
|
|||
return out;
|
||||
}
|
||||
|
||||
function setFoxxRouting(mount, routes) {
|
||||
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- MODULE EXPORTS
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// Insert the routing information for one foxx application
|
||||
|
||||
exports.setFoxxRouting = setFoxxRouting;
|
||||
|
||||
// load all actions from the actions directory
|
||||
exports.startup = startup;
|
||||
|
||||
|
|
|
@ -55,7 +55,6 @@
|
|||
this.comments = [];
|
||||
this.name = app._name;
|
||||
this.version = app._version;
|
||||
this.appId = app._id;
|
||||
this.mount = app._mount;
|
||||
this.collectionPrefix = app._collectionPrefix;
|
||||
this.options = app._options;
|
||||
|
@ -108,7 +107,6 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var ArangoApp = function (config) {
|
||||
this._id = config.id; // ???
|
||||
this._manifest = config.manifest;
|
||||
this._name = config.manifest.name;
|
||||
this._version = config.manifest.version;
|
||||
|
@ -121,6 +119,10 @@ var ArangoApp = function (config) {
|
|||
this._exports = {};
|
||||
this._collectionPrefix = this._mount.substr(1).replace(/-/g, "_").replace(/\//g, "_") + "_";
|
||||
this._context = new AppContext(this);
|
||||
|
||||
if (this._manifest.hasOwnProperty("defaultDocument")) {
|
||||
this._manifest.defaultDocument = "index.html";
|
||||
}
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -145,7 +147,6 @@ var ArangoApp = function (config) {
|
|||
|
||||
ArangoApp.prototype.toJSON = function () {
|
||||
var json = {
|
||||
id: this._id,
|
||||
manifest: this._manifest,
|
||||
name: this._name,
|
||||
version: this._version,
|
||||
|
|
|
@ -101,7 +101,6 @@ Controller = function (context, options) {
|
|||
options: {
|
||||
name: context.name,
|
||||
version: context.version,
|
||||
appId: context.appId,
|
||||
mount: context.mount,
|
||||
isDevelopment: context.isDevelopment,
|
||||
isProduction: context.isProduction,
|
||||
|
|
|
@ -32,13 +32,13 @@
|
|||
|
||||
(function() {
|
||||
"use strict";
|
||||
// -----------------------------------------------------------------------------
|
||||
// --CHAPTER-- used code
|
||||
// -----------------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------------
|
||||
// --CHAPTER-- used code
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- imports
|
||||
// -----------------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- imports
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
var fs = require("fs");
|
||||
var utils = require("org/arangodb/foxx/manager-utils");
|
||||
|
@ -55,36 +55,36 @@
|
|||
var throwDownloadError = arangodb.throwDownloadError;
|
||||
var throwFileNotFound = arangodb.throwFileNotFound;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- private variables
|
||||
// -----------------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- private variables
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
var appCache = {};
|
||||
var appCache = {};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- private functions
|
||||
// -----------------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- private functions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief lookup app in cache
|
||||
/// Returns either the app or undefined if it is not cached.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief lookup app in cache
|
||||
/// Returns either the app or undefined if it is not cached.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var lookupApp = function(mount) {
|
||||
var lookupApp = function(mount) {
|
||||
if (!appCache.hasOwnProperty(mount)) {
|
||||
throw "App not found";
|
||||
}
|
||||
return appCache[mount];
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief check a manifest for completeness
|
||||
///
|
||||
/// this implements issue #590: Manifest Lint
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief check a manifest for completeness
|
||||
///
|
||||
/// this implements issue #590: Manifest Lint
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var checkManifest = function(filename, mf) {
|
||||
var checkManifest = function(filename, mf) {
|
||||
// add some default attributes
|
||||
if (! mf.hasOwnProperty("author")) {
|
||||
// add a default (empty) author
|
||||
|
@ -172,16 +172,16 @@ var checkManifest = function(filename, mf) {
|
|||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief validates a manifest file and returns it.
|
||||
/// All errors are handled including file not found. Returns undefined if manifest is invalid
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief validates a manifest file and returns it.
|
||||
/// All errors are handled including file not found. Returns undefined if manifest is invalid
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var validateManifestFile = function(file) {
|
||||
var validateManifestFile = function(file) {
|
||||
var mf;
|
||||
if (!fs.exists(file)) {
|
||||
return;
|
||||
|
@ -201,77 +201,77 @@ var validateManifestFile = function(file) {
|
|||
return;
|
||||
}
|
||||
return mf;
|
||||
};
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Checks if the mountpoint is reserved for system apps
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Checks if the mountpoint is reserved for system apps
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var isSystemMount = function(mount) {
|
||||
var isSystemMount = function(mount) {
|
||||
return (/^\/_/).test(mount);
|
||||
};
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns the root path for application. Knows about system apps
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns the root path for application. Knows about system apps
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var computeRootAppPath = function(mount) {
|
||||
var computeRootAppPath = function(mount) {
|
||||
if (isSystemMount(mount)) {
|
||||
return module.systemAppPath();
|
||||
}
|
||||
return module.appPath();
|
||||
};
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief transforms a mount point to a sub-path relative to root
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief transforms a mount point to a sub-path relative to root
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var transformMountToPath = function(mount) {
|
||||
var transformMountToPath = function(mount) {
|
||||
var list = mount.split("/");
|
||||
list.push("APP");
|
||||
return fs.join.apply(this, list);
|
||||
};
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns the application path for mount point
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns the application path for mount point
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var computeAppPath = function(mount) {
|
||||
var computeAppPath = function(mount) {
|
||||
var root = computeRootAppPath(mount);
|
||||
var mountPath = transformMountToPath(mount);
|
||||
return fs.join(root, mountPath);
|
||||
};
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief executes an app script
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief executes an app script
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var executeAppScript = function(app, name) {
|
||||
var executeAppScript = function(app, name) {
|
||||
var desc = app._manifest;
|
||||
if (desc.hasOwnProperty(name)) {
|
||||
app.loadAppScript(desc[name]);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief sets up an app
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief sets up an app
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var setupApp = function (app) {
|
||||
return executeAppScript(app, "setup");
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief tears down an app
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief tears down an app
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var teardownApp = function (app) {
|
||||
return executeAppScript(app, "teardown");
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns the app path and manifest
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns the app path and manifest
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var appConfig = function (mount, options) {
|
||||
|
||||
|
@ -299,13 +299,13 @@ var executeAppScript = function(app, name) {
|
|||
};
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Creates an app with options and returns it
|
||||
/// All errors are handled including app not found. Returns undefined if app is invalid.
|
||||
/// If the app is valid it will be added into the local app cache.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Creates an app with options and returns it
|
||||
/// All errors are handled including app not found. Returns undefined if app is invalid.
|
||||
/// If the app is valid it will be added into the local app cache.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var createApp = function(mount, options) {
|
||||
var createApp = function(mount, options) {
|
||||
var config = appConfig(mount);
|
||||
config.options = options || {};
|
||||
var app = new ArangoApp(config);
|
||||
|
@ -316,15 +316,15 @@ var createApp = function(mount, options) {
|
|||
}
|
||||
appCache[mount] = app;
|
||||
return app;
|
||||
};
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Extracts an app from zip and moves it to temporary path
|
||||
///
|
||||
/// return path to app
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Extracts an app from zip and moves it to temporary path
|
||||
///
|
||||
/// return path to app
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var extractAppToPath = function (archive, targetPath, noDelete) {
|
||||
var extractAppToPath = function (archive, targetPath, noDelete) {
|
||||
var tempFile = fs.getTempFile("zip", false);
|
||||
fs.makeDirectory(tempFile);
|
||||
fs.unzipFile(archive, tempFile, false, true);
|
||||
|
@ -387,13 +387,13 @@ var extractAppToPath = function (archive, targetPath, noDelete) {
|
|||
arangodb.printf("Cannot remove temporary folder '%s'\n", tempFile);
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief builds a github repository URL
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief builds a github repository URL
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var buildGithubUrl = function (appInfo) {
|
||||
var buildGithubUrl = function (appInfo) {
|
||||
var splitted = appInfo.split(":");
|
||||
var repository = splitted[1];
|
||||
var version = splitted[2];
|
||||
|
@ -401,13 +401,13 @@ var buildGithubUrl = function (appInfo) {
|
|||
version = "master";
|
||||
}
|
||||
return 'https://github.com/' + repository + '/archive/' + version + '.zip';
|
||||
};
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Downloads an app from remote zip file and copies it to mount path
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Downloads an app from remote zip file and copies it to mount path
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var installAppFromRemote = function(url, targetPath) {
|
||||
var installAppFromRemote = function(url, targetPath) {
|
||||
var tempFile = fs.getTempFile("downloads", false);
|
||||
|
||||
try {
|
||||
|
@ -425,13 +425,13 @@ var installAppFromRemote = function(url, targetPath) {
|
|||
throwDownloadError("Could not download from '" + url + "': " + String(err));
|
||||
}
|
||||
extractAppToPath(tempFile, targetPath);
|
||||
};
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Copies an app from local, either zip file or folder, to mount path
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Copies an app from local, either zip file or folder, to mount path
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var installAppFromLocal = function(path, targetPath) {
|
||||
var installAppFromLocal = function(path, targetPath) {
|
||||
if (fs.isDirectory(path)) {
|
||||
var tempFile = fs.getTempFile("downloads", false);
|
||||
|
||||
|
@ -456,23 +456,23 @@ var installAppFromLocal = function(path, targetPath) {
|
|||
} else {
|
||||
extractAppToPath(path, targetPath, true);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- public functions
|
||||
// -----------------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- public functions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief sets up a Foxx application
|
||||
///
|
||||
/// Input:
|
||||
/// * mount: the mount path starting with a "/"
|
||||
///
|
||||
/// Output:
|
||||
/// -
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief sets up a Foxx application
|
||||
///
|
||||
/// Input:
|
||||
/// * mount: the mount path starting with a "/"
|
||||
///
|
||||
/// Output:
|
||||
/// -
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var setup = function (mount) {
|
||||
var setup = function (mount) {
|
||||
checkParameter(
|
||||
"setup(<mount>)",
|
||||
[ [ "Mount path", "string" ] ],
|
||||
|
@ -487,19 +487,19 @@ var setup = function (mount) {
|
|||
"Setup not possible for mount '%s': %s", mount, String(err.stack || err));
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief tears down a Foxx application
|
||||
///
|
||||
/// Input:
|
||||
/// * mount: the mount path starting with a "/"
|
||||
///
|
||||
/// Output:
|
||||
/// -
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief tears down a Foxx application
|
||||
///
|
||||
/// Input:
|
||||
/// * mount: the mount path starting with a "/"
|
||||
///
|
||||
/// Output:
|
||||
/// -
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var teardown = function (mount) {
|
||||
var teardown = function (mount) {
|
||||
checkParameter(
|
||||
"teardown(<mount>)",
|
||||
[ [ "Mount path", "string" ] ],
|
||||
|
@ -513,29 +513,29 @@ var teardown = function (mount) {
|
|||
"Teardown not possible for mount '%s': %s", mount, String(err.stack || err));
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Scans the sources of the given mountpoint and publishes the routes
|
||||
///
|
||||
/// TODO: Long Documentation!
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
var scanFoxx = function(mount, options) {
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Scans the sources of the given mountpoint and publishes the routes
|
||||
///
|
||||
/// TODO: Long Documentation!
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
var scanFoxx = function(mount, options) {
|
||||
delete appCache[mount];
|
||||
var app = createApp(mount, options);
|
||||
utils.tmp_getStorage().save(app.toJSON());
|
||||
var routes = routeApp(app);
|
||||
require("console").log("Routes", Object.keys(routes));
|
||||
// TODO Routing?
|
||||
};
|
||||
// TODO Routing weiter?
|
||||
};
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Internal install function. Check install.
|
||||
/// Does not check parameters and throws errors.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
var _install = function(appInfo, mount, options, runSetup) {
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Internal install function. Check install.
|
||||
/// Does not check parameters and throws errors.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
var _install = function(appInfo, mount, options, runSetup) {
|
||||
var targetPath = computeAppPath(mount, true);
|
||||
if (fs.exists(targetPath)) {
|
||||
throw "An app is already installed at this location.";
|
||||
|
@ -562,27 +562,27 @@ var _install = function(appInfo, mount, options, runSetup) {
|
|||
if (runSetup) {
|
||||
setup(mount);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Installs a new foxx application on the given mount point.
|
||||
///
|
||||
/// TODO: Long Documentation!
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
var install = function(appInfo, mount, options) {
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Installs a new foxx application on the given mount point.
|
||||
///
|
||||
/// TODO: Long Documentation!
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
var install = function(appInfo, mount, options) {
|
||||
checkParameter(
|
||||
"mount(<appInfo>, <mount>, [<options>])",
|
||||
[ [ "Install information", "string" ],
|
||||
[ "Mount path", "string" ] ],
|
||||
[ appInfo, mount ] );
|
||||
_install(appInfo, mount, options, true);
|
||||
};
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Internal install function. Check install.
|
||||
/// Does not check parameters and throws errors.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
var _uninstall = function(mount) {
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Internal install function. Check install.
|
||||
/// Does not check parameters and throws errors.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
var _uninstall = function(mount) {
|
||||
var targetPath = computeAppPath(mount, true);
|
||||
if (!fs.exists(targetPath)) {
|
||||
throw "No foxx app found at this location.";
|
||||
|
@ -593,27 +593,27 @@ var _uninstall = function(mount) {
|
|||
delete appCache[mount];
|
||||
// Remove the APP folder.
|
||||
fs.removeDirectoryRecursive(targetPath, true);
|
||||
};
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Uninstalls the foxx application on the given mount point.
|
||||
///
|
||||
/// TODO: Long Documentation!
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
var uninstall = function(mount) {
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Uninstalls the foxx application on the given mount point.
|
||||
///
|
||||
/// TODO: Long Documentation!
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
var uninstall = function(mount) {
|
||||
checkParameter(
|
||||
"mount(<mount>)",
|
||||
[ [ "Mount path", "string" ] ],
|
||||
[ mount ] );
|
||||
_uninstall(mount);
|
||||
};
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Replaces a foxx application on the given mount point by an other one.
|
||||
///
|
||||
/// TODO: Long Documentation!
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
var replace = function(appInfo, mount, options) {
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Replaces a foxx application on the given mount point by an other one.
|
||||
///
|
||||
/// TODO: Long Documentation!
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
var replace = function(appInfo, mount, options) {
|
||||
checkParameter(
|
||||
"mount(<appInfo>, <mount>, [<options>])",
|
||||
[ [ "Install information", "string" ],
|
||||
|
@ -621,14 +621,14 @@ var replace = function(appInfo, mount, options) {
|
|||
[ appInfo, mount ] );
|
||||
_uninstall(mount, true);
|
||||
_install(appInfo, mount, options, true);
|
||||
};
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Upgrade a foxx application on the given mount point by a new one.
|
||||
///
|
||||
/// TODO: Long Documentation!
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
var upgrade = function(appInfo, mount, options) {
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Upgrade a foxx application on the given mount point by a new one.
|
||||
///
|
||||
/// TODO: Long Documentation!
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
var upgrade = function(appInfo, mount, options) {
|
||||
checkParameter(
|
||||
"mount(<appInfo>, <mount>, [<options>])",
|
||||
[ [ "Install information", "string" ],
|
||||
|
@ -636,49 +636,66 @@ var upgrade = function(appInfo, mount, options) {
|
|||
[ appInfo, mount ] );
|
||||
_uninstall(mount, false);
|
||||
_install(appInfo, mount, options, false);
|
||||
};
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- exports
|
||||
// -----------------------------------------------------------------------------
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief initializes the Foxx apps
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Exports
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
var initializeFoxx = function() {
|
||||
appCache = {};
|
||||
var cursor = utils.tmp_getStorage().all();
|
||||
var config, app;
|
||||
|
||||
exports.scanFoxx = scanFoxx;
|
||||
exports.install = install;
|
||||
exports.setup = setup;
|
||||
exports.teardown = teardown;
|
||||
exports.uninstall = uninstall;
|
||||
exports.replace = replace;
|
||||
exports.upgrade = upgrade;
|
||||
while (cursor.hasNext()) {
|
||||
config = cursor.next();
|
||||
app = new ArangoApp(config);
|
||||
appCache[app._mount] = app;
|
||||
var routes = routeApp(app);
|
||||
require("console").log("Routes", Object.keys(routes));
|
||||
// TODO Routing weiter?
|
||||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Exports from foxx utils module.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- exports
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
exports.mountedApp = utils.mountedApp;
|
||||
exports.list = utils.list;
|
||||
exports.listJson = utils.listJson;
|
||||
exports.listDevelopment = utils.listDevelopment;
|
||||
exports.listDevelopmentJson = utils.listDevelopmentJson;
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Exports
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Exports from foxx store module.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
exports.scanFoxx = scanFoxx;
|
||||
exports.install = install;
|
||||
exports.setup = setup;
|
||||
exports.teardown = teardown;
|
||||
exports.uninstall = uninstall;
|
||||
exports.replace = replace;
|
||||
exports.upgrade = upgrade;
|
||||
|
||||
exports.available = store.available;
|
||||
exports.availableJson = store.availableJson;
|
||||
exports.getFishbowlStorage = store.getFishbowlStorage;
|
||||
exports.search = store.search;
|
||||
exports.searchJson = store.searchJson;
|
||||
exports.update = store.update;
|
||||
exports.info = store.info;
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Exports from foxx utils module.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// TODO implement!!
|
||||
exports.initializeFoxx = function () {};
|
||||
exports.mountedApp = utils.mountedApp;
|
||||
exports.list = utils.list;
|
||||
exports.listJson = utils.listJson;
|
||||
exports.listDevelopment = utils.listDevelopment;
|
||||
exports.listDevelopmentJson = utils.listDevelopmentJson;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Exports from foxx store module.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.available = store.available;
|
||||
exports.availableJson = store.availableJson;
|
||||
exports.getFishbowlStorage = store.getFishbowlStorage;
|
||||
exports.search = store.search;
|
||||
exports.searchJson = store.searchJson;
|
||||
exports.update = store.update;
|
||||
exports.info = store.info;
|
||||
|
||||
exports.initializeFoxx = initializeFoxx;
|
||||
}());
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
var fs = require("fs");
|
||||
var frontendDevelopmentMode = require("internal").frontendDevelopmentMode;
|
||||
var console = require("console");
|
||||
var setFoxxRouting = require("org/arangodb/actions").setFoxxRouting;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- private functions
|
||||
|
@ -297,7 +298,7 @@
|
|||
var i;
|
||||
var mount = app._mount;
|
||||
|
||||
var defaultDocument = app._manifest.defaultDocument; // TODO by default "index.html"
|
||||
var defaultDocument = app._manifest.defaultDocument;
|
||||
|
||||
// setup the routes
|
||||
var routes = {
|
||||
|
@ -364,11 +365,9 @@
|
|||
if (controllers.hasOwnProperty(i)) {
|
||||
file = controllers[i];
|
||||
|
||||
// TODO ????
|
||||
// set up a context for the application start function
|
||||
tmpContext = {
|
||||
prefix: arangodb.normalizeURL("/" + i), // app mount
|
||||
routingInfo: {},
|
||||
foxxes: []
|
||||
};
|
||||
|
||||
|
@ -423,6 +422,7 @@
|
|||
// install all files and assets
|
||||
installAssets(app, routes);
|
||||
|
||||
setFoxxRouting(app._mount, routes);
|
||||
// and return all routes
|
||||
return routes;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue