mirror of https://gitee.com/bigwinds/arangodb
app -> service
This commit is contained in:
parent
c76af3012b
commit
6aaa55f9dc
|
@ -34,7 +34,7 @@ var foxxManager = require('@arangodb/foxx/manager');
|
||||||
var easyPostCallback = actions.easyPostCallback;
|
var easyPostCallback = actions.easyPostCallback;
|
||||||
|
|
||||||
// //////////////////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////////////////
|
||||||
// / @brief sets up a Foxx application
|
// / @brief sets up a Foxx service
|
||||||
// //////////////////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
actions.defineHttp({
|
actions.defineHttp({
|
||||||
|
@ -52,7 +52,7 @@ actions.defineHttp({
|
||||||
});
|
});
|
||||||
|
|
||||||
// //////////////////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////////////////
|
||||||
// / @brief tears down a Foxx application
|
// / @brief tears down a Foxx service
|
||||||
// //////////////////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
actions.defineHttp({
|
actions.defineHttp({
|
||||||
|
@ -70,7 +70,7 @@ actions.defineHttp({
|
||||||
});
|
});
|
||||||
|
|
||||||
// //////////////////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////////////////
|
||||||
// / @brief installs a Foxx application
|
// / @brief installs a Foxx service
|
||||||
// //////////////////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
actions.defineHttp({
|
actions.defineHttp({
|
||||||
|
@ -89,7 +89,7 @@ actions.defineHttp({
|
||||||
});
|
});
|
||||||
|
|
||||||
// //////////////////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////////////////
|
||||||
// / @brief uninstalls a Foxx application
|
// / @brief uninstalls a Foxx service
|
||||||
// //////////////////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
actions.defineHttp({
|
actions.defineHttp({
|
||||||
|
@ -108,7 +108,7 @@ actions.defineHttp({
|
||||||
});
|
});
|
||||||
|
|
||||||
// //////////////////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////////////////
|
||||||
// / @brief replaces a Foxx application
|
// / @brief replaces a Foxx service
|
||||||
// //////////////////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
actions.defineHttp({
|
actions.defineHttp({
|
||||||
|
@ -128,7 +128,7 @@ actions.defineHttp({
|
||||||
});
|
});
|
||||||
|
|
||||||
// //////////////////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////////////////
|
||||||
// / @brief upgrades a Foxx application
|
// / @brief upgrades a Foxx service
|
||||||
// //////////////////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
actions.defineHttp({
|
actions.defineHttp({
|
||||||
|
@ -148,7 +148,7 @@ actions.defineHttp({
|
||||||
});
|
});
|
||||||
|
|
||||||
// //////////////////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////////////////
|
||||||
// / @brief configures a Foxx application
|
// / @brief configures a Foxx service
|
||||||
// //////////////////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
actions.defineHttp({
|
actions.defineHttp({
|
||||||
|
@ -170,7 +170,7 @@ actions.defineHttp({
|
||||||
});
|
});
|
||||||
|
|
||||||
// //////////////////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////////////////
|
||||||
// / @brief Gets the configuration of a Foxx application
|
// / @brief Gets the configuration of a Foxx service
|
||||||
// //////////////////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
actions.defineHttp({
|
actions.defineHttp({
|
||||||
|
@ -188,7 +188,7 @@ actions.defineHttp({
|
||||||
});
|
});
|
||||||
|
|
||||||
// //////////////////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////////////////
|
||||||
// / @brief configures a Foxx application's dependencies
|
// / @brief configures a Foxx service's dependencies
|
||||||
// //////////////////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
actions.defineHttp({
|
actions.defineHttp({
|
||||||
|
@ -207,7 +207,7 @@ actions.defineHttp({
|
||||||
});
|
});
|
||||||
|
|
||||||
// //////////////////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////////////////
|
||||||
// / @brief Gets the dependencies of a Foxx application
|
// / @brief Gets the dependencies of a Foxx service
|
||||||
// //////////////////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
actions.defineHttp({
|
actions.defineHttp({
|
||||||
|
@ -225,7 +225,7 @@ actions.defineHttp({
|
||||||
});
|
});
|
||||||
|
|
||||||
// //////////////////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////////////////
|
||||||
// / @brief Toggles the development mode of a foxx application
|
// / @brief Toggles the development mode of a foxx service
|
||||||
// //////////////////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
actions.defineHttp({
|
actions.defineHttp({
|
||||||
|
|
|
@ -984,15 +984,15 @@ function foxxRouting (req, res, options, next) {
|
||||||
var mount = options.mount;
|
var mount = options.mount;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var app = foxxManager.lookupService(mount);
|
var service = foxxManager.lookupService(mount);
|
||||||
var devel = app.isDevelopment;
|
var devel = service.isDevelopment;
|
||||||
|
|
||||||
if (devel || !options.hasOwnProperty('routing')) {
|
if (devel || !options.hasOwnProperty('routing')) {
|
||||||
delete options.error;
|
delete options.error;
|
||||||
|
|
||||||
if (devel) {
|
if (devel) {
|
||||||
foxxManager.rescanFoxx(mount); // TODO can move this to somewhere else?
|
foxxManager.rescanFoxx(mount); // TODO can move this to somewhere else?
|
||||||
app = foxxManager.lookupService(mount);
|
service = foxxManager.lookupService(mount);
|
||||||
}
|
}
|
||||||
|
|
||||||
options.routing = flattenRoutingTree(buildRoutingTree([foxxManager.routes(mount)]));
|
options.routing = flattenRoutingTree(buildRoutingTree([foxxManager.routes(mount)]));
|
||||||
|
|
|
@ -24,23 +24,23 @@ describe('Foxx Manager', function () {
|
||||||
var deps1 = {hello: {name: 'world', required: true, version: '*'}};
|
var deps1 = {hello: {name: 'world', required: true, version: '*'}};
|
||||||
var deps2 = {clobbered: {name: 'completely', required: true, version: '*'}};
|
var deps2 = {clobbered: {name: 'completely', required: true, version: '*'}};
|
||||||
|
|
||||||
var app = FoxxManager.lookupService(mount);
|
var service = FoxxManager.lookupService(mount);
|
||||||
expect(app.manifest.dependencies).to.eql({});
|
expect(service.manifest.dependencies).to.eql({});
|
||||||
var filename = app.main.context.fileName('manifest.json');
|
var filename = service.main.context.fileName('manifest.json');
|
||||||
var rawJson = fs.readFileSync(filename, 'utf-8');
|
var rawJson = fs.readFileSync(filename, 'utf-8');
|
||||||
var json = JSON.parse(rawJson);
|
var json = JSON.parse(rawJson);
|
||||||
|
|
||||||
json.dependencies = deps1;
|
json.dependencies = deps1;
|
||||||
fs.writeFileSync(filename, JSON.stringify(json));
|
fs.writeFileSync(filename, JSON.stringify(json));
|
||||||
FoxxManager.scanFoxx(mount, {replace: true});
|
FoxxManager.scanFoxx(mount, {replace: true});
|
||||||
app = FoxxManager.lookupService(mount);
|
service = FoxxManager.lookupService(mount);
|
||||||
expect(app.manifest.dependencies).to.eql(deps1);
|
expect(service.manifest.dependencies).to.eql(deps1);
|
||||||
|
|
||||||
json.dependencies = deps2;
|
json.dependencies = deps2;
|
||||||
fs.writeFileSync(filename, JSON.stringify(json));
|
fs.writeFileSync(filename, JSON.stringify(json));
|
||||||
FoxxManager.scanFoxx(mount, {replace: true});
|
FoxxManager.scanFoxx(mount, {replace: true});
|
||||||
app = FoxxManager.lookupService(mount);
|
service = FoxxManager.lookupService(mount);
|
||||||
expect(app.manifest.dependencies).to.eql(deps2);
|
expect(service.manifest.dependencies).to.eql(deps2);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue