1
0
Fork 0

Fixed script invocation and configure/set-deps.

This commit is contained in:
Alan Plum 2015-05-26 19:04:33 +02:00
parent c83eac8bbc
commit 9296e6ea23
2 changed files with 16 additions and 14 deletions

View File

@ -211,11 +211,11 @@
/// Output: /// Output:
/// - /// -
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
var script = function(name, mount, options) { var script = function(mount, name, options) {
checkParameter( checkParameter(
"script(<name>, <mount>, [<options>])", "script(<mount>, <name>, [<options>])",
[ [ "Script name", "string" ], [ "Mount path", "string" ] ], [ [ "Mount path", "string" ], [ "Script name", "string" ] ],
[ name, mount ] ); [ mount, name ] );
var res; var res;
var req = { var req = {
name: name, name: name,
@ -564,14 +564,16 @@
try { try {
switch (type) { switch (type) {
case "setup": case "setup":
script("setup", args[1]); script(args[1], "setup");
break; break;
case "teardown": case "teardown":
script("teardown", args[1]); script(args[1], "teardown");
break; break;
case "script": case "script":
options = extractOptions(args); options = args.slice(3).map(function (arg) {
script(args[2], args[1], options); return JSON.parse(arg);
});
script(args[1], args[2], options);
break; break;
case "tests": case "tests":
options = extractOptions(args); options = extractOptions(args);
@ -659,7 +661,7 @@
res.mount); res.mount);
break; break;
case "configure": case "configure":
options = extractOptions(args); options = extractOptions(args).configuration || {};
res = configure(args[1], options); res = configure(args[1], options);
printf("Reconfigured Application %s version %s on mount point %s\n", printf("Reconfigured Application %s version %s on mount point %s\n",
res.name, res.name,
@ -671,7 +673,7 @@
printf("Configuration options:\n%s\n", JSON.stringify(res, undefined, 2)); printf("Configuration options:\n%s\n", JSON.stringify(res, undefined, 2));
break; break;
case "set-dependencies": case "set-dependencies":
options = extractOptions(args); options = extractOptions(args).configuration || {};
res = setDependencies(args[1], options); res = setDependencies(args[1], options);
printf("Reconfigured dependencies of Application %s version %s on mount point %s\n", printf("Reconfigured dependencies of Application %s version %s on mount point %s\n",
res.name, res.name,
@ -705,8 +707,8 @@
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
exports.install = install; exports.install = install;
exports.setup = script.bind(null, "setup"); exports.setup = function (mount, opts) {return script(mount, "setup", opts);};
exports.teardown = script.bind(null, "teardown"); exports.teardown = function (mount, opts) {return script(mount, "teardown", opts);};
exports.script = script; exports.script = script;
exports.tests = tests; exports.tests = tests;
exports.uninstall = uninstall; exports.uninstall = uninstall;

View File

@ -1498,8 +1498,8 @@ exports.syncWithFolder = syncWithFolder;
exports.install = install; exports.install = install;
exports.runTests = runTests; exports.runTests = runTests;
exports.runScript = runScript; exports.runScript = runScript;
exports.setup = R.partialRight(runScript, 'setup'); exports.setup = R.partial(runScript, 'setup');
exports.teardown = R.partialRight(runScript, 'teardown'); exports.teardown = R.partial(runScript, 'teardown');
exports.uninstall = uninstall; exports.uninstall = uninstall;
exports.replace = replace; exports.replace = replace;
exports.upgrade = upgrade; exports.upgrade = upgrade;