From 0bbbd53d4d0bf190b3b96b00eaf375b212cda23c Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Fri, 17 Jan 2014 14:04:10 +0100 Subject: [PATCH] added fm.rescan() method Conflicts: CHANGELOG --- CHANGELOG | 4 ++++ js/actions/api-foxx.js | 18 ++++++++++++++++++ js/client/modules/org/arangodb/foxx/manager.js | 17 +++++++++++++++++ js/server/modules/org/arangodb/foxx/manager.js | 11 +++++++++++ 4 files changed, 50 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index ca930dd316..f6d890c140 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -108,6 +108,10 @@ v1.5.0 (XXXX-XX-XX) v1.4.6 (XXXX-XX-XX) ------------------- +* added fm.rescan() method for Foxx-Manager + +* fixed issue #734: foxx cookie and route problem + * added method `fm.configJson` for arangosh * include `startupPath` in result of API `/_api/foxx/config` diff --git a/js/actions/api-foxx.js b/js/actions/api-foxx.js index fbd55f8170..a8001f7455 100644 --- a/js/actions/api-foxx.js +++ b/js/actions/api-foxx.js @@ -145,6 +145,24 @@ actions.defineHttp({ } }) }); + +//////////////////////////////////////////////////////////////////////////////// +/// @brief rescans the FOXX application directory +//////////////////////////////////////////////////////////////////////////////// + +actions.defineHttp({ + url : "_admin/foxx/rescan", + context : "admin", + prefix : false, + + callback: easyPostCallback({ + body: true, + callback: function (body) { + foxxManager.scanAppDirectory(); + return true; + } + }) +}); //////////////////////////////////////////////////////////////////////////////// /// @brief sets up a FOXX application diff --git a/js/client/modules/org/arangodb/foxx/manager.js b/js/client/modules/org/arangodb/foxx/manager.js index 786399f717..8f3b568951 100644 --- a/js/client/modules/org/arangodb/foxx/manager.js +++ b/js/client/modules/org/arangodb/foxx/manager.js @@ -683,6 +683,9 @@ exports.run = function (args) { exports.mount(args[1], args[2]); } } + else if (type === 'rescan') { + exports.rescan(); + } else if (type === 'setup') { exports.setup(args[1]); } @@ -821,6 +824,18 @@ exports.fetch = function (type, location, version) { return arangosh.checkRequestResult(res); }; +//////////////////////////////////////////////////////////////////////////////// +/// @brief rescans the FOXX application directory +//////////////////////////////////////////////////////////////////////////////// + +exports.rescan = function () { + 'use strict'; + + var res = arango.POST("/_admin/foxx/rescan", ""); + + return arangosh.checkRequestResult(res); +}; + //////////////////////////////////////////////////////////////////////////////// /// @brief mounts a FOXX application //////////////////////////////////////////////////////////////////////////////// @@ -1435,6 +1450,8 @@ exports.help = function () { "setup" : "setup executes the setup script (app must already be mounted)", "install" : "fetches a foxx application from the central foxx-apps repository, mounts it to a local URL " + "and sets it up", + "rescan" : "rescans the foxx application directory on the server side (only needed if server-side apps " + + "directory is modified by other processes)", "replace" : "replaces an aleady existing foxx application with the current local version", "teardown" : "teardown execute the teardown script (app must be still be mounted)", "unmount" : "unmounts a mounted foxx application", diff --git a/js/server/modules/org/arangodb/foxx/manager.js b/js/server/modules/org/arangodb/foxx/manager.js index 14f208c226..039dfc2776 100644 --- a/js/server/modules/org/arangodb/foxx/manager.js +++ b/js/server/modules/org/arangodb/foxx/manager.js @@ -822,6 +822,17 @@ exports.scanAppDirectory = function () { scanDirectory(module.appPath()); }; +//////////////////////////////////////////////////////////////////////////////// +/// @brief rescans the FOXX application directory +/// this function is a trampoline for scanAppDirectory +/// the shorter function name is only here to keep compatibility with the +/// client-side foxx manager +//////////////////////////////////////////////////////////////////////////////// + +exports.rescan = function () { + return exports.scanAppDirectory(); +}; + //////////////////////////////////////////////////////////////////////////////// /// @brief mounts a FOXX application ///