From ba166f7d6a0a0a78491f3aa30b390d46845f1051 Mon Sep 17 00:00:00 2001 From: Inga Lovinde <52715130+inga-lovinde@users.noreply.github.com> Date: Thu, 10 Mar 2016 08:51:36 +0300 Subject: [PATCH] Copyglob task implemented --- BuildServer/lib/tasks/copyglob.js | 39 +++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 BuildServer/lib/tasks/copyglob.js diff --git a/BuildServer/lib/tasks/copyglob.js b/BuildServer/lib/tasks/copyglob.js new file mode 100644 index 0000000..d49e5f3 --- /dev/null +++ b/BuildServer/lib/tasks/copyglob.js @@ -0,0 +1,39 @@ +"use strict"; + +var fse = require('fs-extra'); +var glob = require('glob'); + +module.exports = function (params, processor) { + return { + process: function () { + glob(params.mask, { + dot: true, + cwd: processor.context.exported + }, function (err, files) { + if (err) { + processor.onError(err); + return processor.done(); + } + + if (!files || !files.length) { + return processor.done(); + } + + return processor.processTask({ + type: "parallel", + params: { + tasks: files.map(function (file) { + return { + name: file, + type: "copy", + params: { + filename: file + } + }; + }) + } + }, processor.done.bind(processor)); + }); + } + }; +};