From 5d05d43e016ce66f8e961867870e4755f6b86ed6 Mon Sep 17 00:00:00 2001 From: Mehrdad Reshadi Date: Mon, 29 Aug 2016 14:30:04 -0700 Subject: [PATCH 1/7] simple unified way for creating publist xyzTask api --- lib/api.js | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/lib/api.js b/lib/api.js index 322ec243..3c08f47c 100644 --- a/lib/api.js +++ b/lib/api.js @@ -351,9 +351,21 @@ var api = new (function () { } }; - this.packageTask = function (name, version, definition) { - return new jake.PackageTask(name, version, definition); - }; + function createApi(jakeTaskConstructorGetter) { + return function() { + var jakeTaskConstructor = jakeTaskConstructorGetter(); + if (!jakeTaskConstructor) console.error("INVALID TASK CTOR"); + + var ctor = function () {} + , t; + ctor.prototype = jakeTaskConstructor.prototype; + t = new ctor(); + jakeTaskConstructor.apply(t, arguments); + return t; + }; + } + + this.packageTask = createApi(function() { return jake.PackageTask;}); this.publishTask = function (name, prereqs, opts, definition) { return new jake.PublishTask(name, prereqs, opts, definition); @@ -368,14 +380,7 @@ var api = new (function () { return new jake.WatchTask(name, taskNames, definition); }; - this.testTask = function () { - var ctor = function () {} - , t; - ctor.prototype = jake.TestTask.prototype; - t = new ctor(); - jake.TestTask.apply(t, arguments); - return t; - }; + this.testTask = createApi(function() { return jake.TestTask;}); })(); From aa398779c398bc0628a44af18c32f52c0d521c7e Mon Sep 17 00:00:00 2001 From: Mehrdad Reshadi Date: Mon, 29 Aug 2016 14:30:04 -0700 Subject: [PATCH 2/7] simple unified way for creating public xyzTask() api --- lib/api.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/api.js b/lib/api.js index 3c08f47c..687c512d 100644 --- a/lib/api.js +++ b/lib/api.js @@ -354,7 +354,6 @@ var api = new (function () { function createApi(jakeTaskConstructorGetter) { return function() { var jakeTaskConstructor = jakeTaskConstructorGetter(); - if (!jakeTaskConstructor) console.error("INVALID TASK CTOR"); var ctor = function () {} , t; From 878a1d45d5f48f13e52cba1b3f428414c0619e24 Mon Sep 17 00:00:00 2001 From: Jeff Carnes Date: Tue, 27 Sep 2016 14:07:00 -0700 Subject: [PATCH 3/7] 322 - Upgrade minimatch to 3.x Upon installing the older version of minimatch, npm would emit the following error: npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 48ae3955..d0e4d914 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "preferGlobal": true, "dependencies": { "filelist": "0.0.x", - "minimatch": "0.2.x", + "minimatch": "3.x", "chalk": "0.4.x", "utilities": "1.0.x", "async": "0.9.x" From 836c4588803051dea2332ebeccc79e9ab09ed8ed Mon Sep 17 00:00:00 2001 From: mde Date: Wed, 5 Oct 2016 12:05:44 -0700 Subject: [PATCH 4/7] Allow custom publish function, not just command --- lib/publish_task.js | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/lib/publish_task.js b/lib/publish_task.js index f8334719..d062b783 100644 --- a/lib/publish_task.js +++ b/lib/publish_task.js @@ -63,6 +63,7 @@ var PublishTask = function () { this.prereqs = prereqs; this.packageFiles = new FileList(); this.publishCmd = opts.publishCmd || 'npm publish %filename'; + this.publishMessage = opts.publishMessage || 'BOOM! Published.'; this.gitCmd = opts.gitCmd || 'git'; this.versionFiles = opts.versionFiles || ['package.json']; this.scheduleDelay = 5000; @@ -253,15 +254,26 @@ PublishTask.prototype = new (function () { cmd = self.publishCmd.replace(/%filename/gi, filename); } - // Hackity hack -- NPM publish sometimes returns errror like: - // Error sending version data\nnpm ERR! - // Error: forbidden 0.2.4 is modified, should match modified time - setTimeout(function () { - jake.exec(cmd, function () { - console.log('BOOM! Published.'); + if (typeof cmd == 'function') { + cmd(function (err) { + if (err) { + throw err; + } + console.log(self.publishMessage); complete(); - }, {printStdout: true, printStderr: true}); - }, self.scheduleDelay); + }); + } + else { + // Hackity hack -- NPM publish sometimes returns errror like: + // Error sending version data\nnpm ERR! + // Error: forbidden 0.2.4 is modified, should match modified time + setTimeout(function () { + jake.exec(cmd, function () { + console.log(self.publishMessage); + complete(); + }, {printStdout: true, printStderr: true}); + }, self.scheduleDelay); + } }); task('cleanup', {async: true}, function () { From 4984229b5e0ab32ea8bd7fb5387abf31b0cd1a1a Mon Sep 17 00:00:00 2001 From: mde Date: Wed, 5 Oct 2016 12:06:19 -0700 Subject: [PATCH 5/7] Version 8.0.14 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d0e4d914..28f2d33f 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "make", "rake" ], - "version": "8.0.13", + "version": "8.0.14", "author": "Matthew Eernisse (http://fleegix.org)", "license": "Apache-2.0", "bin": { From 2b62d6039ab402ce4190ec9c74ea4998622b8db2 Mon Sep 17 00:00:00 2001 From: mde Date: Mon, 10 Oct 2016 18:36:43 -0700 Subject: [PATCH 6/7] Don't overwrite `file` API cmd with 'file' utils namespace --- lib/jake.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/jake.js b/lib/jake.js index 22a1bc71..e34d938b 100644 --- a/lib/jake.js +++ b/lib/jake.js @@ -45,15 +45,15 @@ var Invocation = function (taskName, args) { // Globalize jake and top-level API methods (e.g., `task`, `desc`) utils.mixin(global, api); -// Also add top-level API methods to exported object for those who don't want to -// use the globals -utils.mixin(jake, api); - // Copy utils onto base jake utils.mixin(jake, utils); // File utils should be aliased directly on base jake as well utils.mixin(jake, utils.file); +// Also add top-level API methods to exported object for those who don't want to +// use the globals (`file` here will overwrite the 'file' utils namespace) +utils.mixin(jake, api); + utils.mixin(jake, new (function () { this._invocationChain = []; From b53c427e76f38a064c0a47442b1f8eb5175d23a9 Mon Sep 17 00:00:00 2001 From: mde Date: Mon, 10 Oct 2016 18:57:04 -0700 Subject: [PATCH 7/7] Version 8.0.15 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 28f2d33f..153abd8a 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "make", "rake" ], - "version": "8.0.14", + "version": "8.0.15", "author": "Matthew Eernisse (http://fleegix.org)", "license": "Apache-2.0", "bin": {