From 3b018d9853af3a932a3901ba0555042d59b28b97 Mon Sep 17 00:00:00 2001 From: nelak Date: Mon, 14 Mar 2016 03:25:27 +0000 Subject: [PATCH] Added support for ignoring files --- lib/consign.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/consign.js b/lib/consign.js index eb6b874..b3311f6 100644 --- a/lib/consign.js +++ b/lib/consign.js @@ -30,7 +30,8 @@ function Consign(options) { logger: console, verbose: true, extensions: [], - loggingType: 'info' + loggingType: 'info', + ignore: false }; this._files = []; @@ -106,6 +107,15 @@ Consign.prototype._setLocations = function(parent, entity, push) { this._log(['!', this._['Ignoring extension'], ':', extension]); return this; } + + var ignoreRegex = new RegExp(this._options.ignore + '.*(' + this._options.extensions.join('|') +')', 'gi') + , filename = path.basename(location) + ; + + if (this._options.ignore && ignoreRegex.test(filename)) { + this._log(['!', this._['Ignoring file'], ':', filename]); + return this; + } if (push && this._files.indexOf(location) === -1) { this._files.push(location);