diff --git a/js/server/modules/org/arangodb/foxx/manager.js b/js/server/modules/org/arangodb/foxx/manager.js index 4df95641ea..fd11aac4c4 100644 --- a/js/server/modules/org/arangodb/foxx/manager.js +++ b/js/server/modules/org/arangodb/foxx/manager.js @@ -1177,6 +1177,47 @@ exports.unmount = function (mount) { return { appId: doc.app, mount: doc.mount, options: doc.options }; }; +//////////////////////////////////////////////////////////////////////////////// +/// @brief returnes git information of a Foxx application +/// +/// Input: +/// * name: application name +/// +/// Output: +/// * name: application name +/// * git: git information +//////////////////////////////////////////////////////////////////////////////// + +exports.gitinfo = function (key) { + 'use strict'; + + var _ = require("underscore"), gitinfo, + aal = getStorage(), + result = aal.toArray().concat(exports.developmentMounts()), + path = module.appPath(), + foxxPath, completePath, gitfile, gitcontent; + + _.each(result, function(k) { + + if (k.name === key) { + foxxPath = k.path; + } + }); + + completePath = path+"/"+foxxPath; + gitfile = completePath + "/gitinfo.json"; + + if (fs.isFile(gitfile)) { + gitcontent = fs.read(gitfile); + gitinfo = {git: true, url: JSON.parse(gitcontent), name: key}; + } + else { + gitinfo = {}; + } + + return gitinfo; +}; + //////////////////////////////////////////////////////////////////////////////// /// @brief returnes mount points of a Foxx application /// @@ -1191,7 +1232,7 @@ exports.unmount = function (mount) { exports.mountinfo = function (key) { 'use strict'; - var _ = require("underscore"), mountinfo = [], tmp; + var _ = require("underscore"), mountinfo = []; if (key === undefined) { _.each(exports.appRoutes(), function(m) { @@ -1571,6 +1612,9 @@ exports.fetchFromGithub = function (url, name, version) { fs.makeDirectoryRecursive(path); fs.unzipFile(realFile, path, false, true); + var gitFilename = "/gitinfo.json"; + fs.write(path+gitFilename, JSON.stringify(url)); + this.scanAppDirectory(); return "app:" + source.name + ":" + source.version; };