From 2485a8925e330136c3bd746a4dac104fc9c4cdab Mon Sep 17 00:00:00 2001 From: Inga Lovinde <52715130+inga-lovinde@users.noreply.github.com> Date: Fri, 18 Apr 2014 17:22:07 +0400 Subject: [PATCH] Implemented copy command --- BuildServer/lib/tasks/copy.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 BuildServer/lib/tasks/copy.js diff --git a/BuildServer/lib/tasks/copy.js b/BuildServer/lib/tasks/copy.js new file mode 100644 index 0000000..e5a2d74 --- /dev/null +++ b/BuildServer/lib/tasks/copy.js @@ -0,0 +1,26 @@ +"use strict"; + +var fs = require('fs'); +var fse = require('fs-extra'); +var async = require('async'); +var glob = require('glob'); + +module.exports = function (params, processor) { + return { + process: function () { + var sourceFilePath = processor.context.exported + "/" + params.filename, + targetFilePath = processor.context.release + "/" + params.filename; + + processor.onInfo("Copying " + sourceFilePath + " to " + targetFilePath); + + fse.copy(sourceFilePath, targetFilePath, function(err) { + if (err) { + processor.onError("Unable to copy file: " + err); + } else { + processor.onInfo("Copied file"); + } + return processor.done(); + }); + } + }; +};