You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.1 KiB
48 lines
1.1 KiB
11 years ago
|
"use strict";
|
||
|
|
||
|
var spawn = require('child_process').spawn;
|
||
|
|
||
|
module.exports = function (params, processor) {
|
||
|
return {
|
||
|
process: function () {
|
||
|
var result = "",
|
||
|
error = "",
|
||
|
builder = spawn("../DotNetBuilder/bin/Debug/MicroBuildServer.DotNetBuilder.exe", ["compile"]);
|
||
|
|
||
|
builder.stdout.on('data', function (data) {
|
||
|
result += data;
|
||
|
});
|
||
|
builder.stderr.on('data', function (data) {
|
||
|
error += data;
|
||
|
});
|
||
|
builder.on('exit', function (code) {
|
||
|
if (code !== 0) {
|
||
|
error = "Return code is " + code + "\r\n" + error;
|
||
|
processor.onError(error);
|
||
|
return processor.done();
|
||
|
}
|
||
|
|
||
|
var report = JSON.parse(result);
|
||
|
var messages = report.Messages;
|
||
|
for (var i = 0; i < messages.length; i++) {
|
||
|
switch(messages[i].Type) {
|
||
|
case "info":
|
||
|
processor.onInfo(messages[i].Body);
|
||
|
break;
|
||
|
case "warn":
|
||
|
processor.onWarn(messages[i].Body);
|
||
|
break;
|
||
|
default:
|
||
|
processor.onError(messages[i].Body);
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
return processor.done();
|
||
|
});
|
||
|
|
||
|
builder.stdin.write(JSON.stringify(params));
|
||
|
builder.stdin.end();
|
||
|
}
|
||
|
};
|
||
|
};
|