Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Cleaned up arguments escaping which was causing problems when buildin…

…g with Rhino. Bump to 0.1.5
  • Loading branch information...
commit 36083f241d0c96ef84f44c65dd31587eeb07a420 1 parent 891077f
Tom Robinson authored
Showing with 16 additions and 17 deletions.
  1. +15 −16 lib/jake.js
  2. +1 −1  package.json
View
31 lib/jake.js
@@ -22,14 +22,16 @@
// IN THE SOFTWARE.
//
-var FILE = require("file"),
- SYSTEM = require("system"),
+var FILE = require("file");
+var SYSTEM = require("system");
+var UTIL = require("util");
+var OS = require("os");
- Task = require("jake/task").Task,
- FileTask = require("jake/filetask").FileTask,
- FileCreationTask = require("jake/filecreationtask").FileCreationTask,
- TaskManager = require("jake/taskmanager").TaskManager,
- Application = require("jake/application").Application;
+var Task = require("jake/task").Task;
+var FileTask = require("jake/filetask").FileTask;
+var FileCreationTask = require("jake/filecreationtask").FileCreationTask;
+var TaskManager = require("jake/taskmanager").TaskManager;
+var Application = require("jake/application").Application;
// Exports
exports.Task = Task;
@@ -106,15 +108,13 @@ exports.FileList = require("jake/filelist").FileList;
end
*/
+// record the initial SYSTEM.env so we know what needs to be serialized later
+var envInitial = Object.freeze(UTIL.copy(SYSTEM.env));
function serializeEnv(/*Object*/ env)
{
- var serialized = "";
-
- for (variable in env)
- if (env.hasOwnProperty(variable))
- serialized += variable + "=\"" + env[variable] + "\" ";
-
- return serialized;
+ return Object.keys(env).map(function(key) {
+ return (env[key] !== envInitial[key]) ? key + "=" + OS.enquote(env[key]) : null;
+ }).filter(function(x) { return !!x; }).join(" ");
}
exports.subjake = function(/*Array<String> | String*/ directories, /*String*/ aTaskName, /*Object*/ env)
@@ -122,13 +122,12 @@ exports.subjake = function(/*Array<String> | String*/ directories, /*String*/ aT
if (!Array.isArray(directories))
directories = [directories];
- var OS = require("os");
directories.forEach(function(/*String*/ aDirectory)
{
if (FILE.isDirectory(aDirectory))
{
- if (OS.system("cd " + aDirectory + " && " + serializeEnv(env) + " jake " + aTaskName))
+ if (OS.system("cd " + OS.enquote(aDirectory) + " && " + serializeEnv(env) + " jake " + OS.enquote(aTaskName)))
OS.exit(1);
}
});
View
2  package.json
@@ -3,5 +3,5 @@
"author": "Francisco Tolmasky (http://tolmasky.com/)",
"description": "A build system for CommonJS, lifted from Rake",
"keywords": ["build", "jake", "rake", "make"],
- "version":"0.1.4"
+ "version":"0.1.5"
}
Please sign in to comment.
Something went wrong with that request. Please try again.