From e0940342ea2c1e4ef6dc3575b67366705fb38b82 Mon Sep 17 00:00:00 2001 From: Inga Lovinde <52715130+inga-lovinde@users.noreply.github.com> Date: Fri, 21 Feb 2014 17:31:10 +0400 Subject: [PATCH] Implemented writefile task --- BuildServer/lib/tasks/writefile.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 BuildServer/lib/tasks/writefile.js diff --git a/BuildServer/lib/tasks/writefile.js b/BuildServer/lib/tasks/writefile.js new file mode 100644 index 0000000..d60017b --- /dev/null +++ b/BuildServer/lib/tasks/writefile.js @@ -0,0 +1,23 @@ +"use strict"; + +var fs = require('fs'); +var async = require('async'); +var glob = require('glob'); + +module.exports = function (params, processor) { + return { + process: function () { + var filePath = processor.context.exported + "/" + params.filename; + processor.onInfo("Writing to " + filePath); + + fs.writeFile(filePath, params.data, function(err) { + if (err) { + processor.onError("Unable to write file: " + err); + } else { + processor.onInfo("Written file"); + } + return processor.done(); + }); + } + }; +};