1
0
Fork 0

install fix for Foxx apps

This commit is contained in:
Jan Steemann 2015-02-24 13:51:41 +01:00
parent 3baf9b8270
commit 6ce1f2892e
2 changed files with 20 additions and 5 deletions

View File

@ -662,10 +662,25 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
var _scanFoxx = function(mount, options, activateDevelopment) { var _scanFoxx = function(mount, options, activateDevelopment) {
options = options || { };
var dbname = arangodb.db._name(); var dbname = arangodb.db._name();
delete appCache[dbname][mount]; delete appCache[dbname][mount];
var app = createApp(mount, options, activateDevelopment); var app = createApp(mount, options, activateDevelopment);
utils.getStorage().save(app.toJSON()); try {
utils.getStorage().save(app.toJSON());
}
catch (err) {
if (! options.replace ||
err.errorNum !== errors.ERROR_ARANGO_UNIQUE_CONSTRAINT_VIOLATED.code) {
throw err;
}
var old = utils.getStorage().firstExample({ mount: mount });
if (old === null) {
throw new Error("Could not find app for mountpoint '" + mount + "'.");
}
var manifest = app.toJSON().manifest;
utils.getStorage().update(old, { manifest: manifest });
}
return app; return app;
}; };
@ -732,6 +747,7 @@
// Ohterwise move will fail. // Ohterwise move will fail.
fs.removeDirectory(targetPath); fs.removeDirectory(targetPath);
initCache();
try { try {
if (appInfo === "EMPTY") { if (appInfo === "EMPTY") {
// Make Empty app // Make Empty app
@ -756,7 +772,6 @@
} }
throw e; throw e;
} }
initCache();
try { try {
db._executeTransaction({ db._executeTransaction({
collections: { collections: {
@ -1063,7 +1078,7 @@
var collection = utils.getStorage(); var collection = utils.getStorage();
var transAction = function() { var transAction = function() {
mount = transformPathToMount(folders[i]); mount = transformPathToMount(folders[i]);
_scanFoxx(mount); _scanFoxx(mount, { replace: true });
}; };
for (i = 0; i < l; ++i) { for (i = 0; i < l; ++i) {
db._executeTransaction({ db._executeTransaction({

View File

@ -54,7 +54,7 @@ describe("Foxx Manager", function() {
it("should be able to install all apps from appstore", function() { it("should be able to install all apps from appstore", function() {
var mount = "/unittest/testApps"; var mount = "/unittest/testApps";
try { try {
FoxxManager.uninstall(mount); FoxxManager.uninstall(mount, { force: true });
} catch(e) { } catch(e) {
} }
var list = FoxxManager.availableJson(); var list = FoxxManager.availableJson();
@ -67,7 +67,7 @@ describe("Foxx Manager", function() {
} catch(e) { } catch(e) {
expect(e).toBeUndefined("Could not install " + app.name); expect(e).toBeUndefined("Could not install " + app.name);
try { try {
FoxxManager.uninstall(mount); FoxxManager.uninstall(mount, { force: true });
} catch(err) { } catch(err) {
} }
} }