Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
c1f1500ffc | |||
e42c5004c2 | |||
e0c4a10411 | |||
6deab0541f | |||
22e3dc6136 | |||
e69e8df875 | |||
4cb24a4a6d | |||
ebac042791 | |||
d8fc992ba3 | |||
82def89388 | |||
4b832bbf95 |
@ -10,7 +10,7 @@ deploy:
|
|||||||
provider: npm
|
provider: npm
|
||||||
email: npm@smart-coordination.com
|
email: npm@smart-coordination.com
|
||||||
api_key:
|
api_key:
|
||||||
secure: AcM6ooFjEIaWOC84QMxxugV3GtkMEoMI6zxy4oB9u9xihLopVZnm6c8FxIr+Wl2Ykjwj2deOuC7Q7QLtfH8/n4cVj1x7c32DJ21XJsE6uGm2opT7bSMm/NgcIvbkzWdPSyG8OpJEu8l///+YTceLdLV2Tn4lPobZRgu0KIF3Pg0Fo2V/0kSH/gSjlbLBgMBx1QrO2y52VHMdqWs3VwMIv1lEEicUsbnBg1z03I/Ka+JZQPCDYGgHu7y62zgB36mdkNVg8pyvGrrTSWeMVyHc8SSvBoqszVUeXfs4d4tcw0+vPsIJD5hDzAGOtH+3KO2Bgi87UB/Dgd5xw92+zQxhKnKewFiyTvANFXoag5UooPupWKhu5DljZ27CkgLX/N/AF6eTuQR0ffW92Bvz2YWis5JC75+HGFV2tBI7hRinScc00J0vOAqqVpp81PD6BXQDX2y5y77arArJVQTC5irOYL20x3UMBB7fOpTkYV9T2NxzR6OBv4P6MLWPbnmFr+zpjkzBxHeJMOosb+9W6TAbVmouM5SfnFU5bBYh2gF52Yz2FnfpDzclVZW/OI0YcAtIdozbHRcJ1s6pVkPqZIqKcCM+jVhzvt8NTnehSOqjFyIV9rcbsYQplLs8b9ntmcuRLCPatXMGFQM/y9Sjw4is0gHhRMjxQo32bfIiX1CTqVo=
|
secure: ZgxvXgxlJlDDx4sv2H+M0Z36sZHDKEYRntudQWKLaDt1T2VojfsigNORrDZcHCs6FZo8t2Klsqte8PqDvAn7BxXIo5K86aaZOyulcHnmDQS6rBhJYHm01qJj2B+t03EozcsueYGcQIVyFLBnKl5Yj8GdQ6iVGbimHvgym/Bbo6pKQlKHvv7a+tOSmtRffeG4jZU454MYqc38ZPtKftdknk7m4T0wUP2l9Y1jKva8Zjd4+cw+xOhFAStkySrq8uNBEINN8e5vqvaOxq1d7V8evK7JQLjDtLOaj67cHJ3u7ZjHA2zk1j/Rs7X2jkeqqRbG1zhSHUjjqvnZRzC6ygswOHBBnSzF9P+tN7+jcNcn09PLsKh/HyXq/aRFKsNtvKjUey4cM27yt/LRLis70hrRTgR9EDZ/Q4Aoa/P/ObYf0XDE1rH08nngeASdmGFN+6n6idSq8C7IQ/YfmmQBhIhTSaNSGsYcG827fB5EZLoojCDOuNIrfyMOJHrSy14rgNWiGRj7C0md4yP7qGP53JPU9pPZLzRiD2/y9KuZ4qnE/edj9+POmVCr+uz2ILFQcTkEb9gItfMQGLd5m5MtPHgVFcoslU14O8o5WyFdG80xDHBvyy+1TsqnyRPwwlLwzepqZeUltZKXiOMDRIRurDRC1jtwcf8kJmWboio3GLIdQFU=
|
||||||
on:
|
on:
|
||||||
tags: true
|
tags: true
|
||||||
repo: pushrocks/gulp-callfunction
|
repo: pushrocks/gulp-callfunction
|
||||||
|
@ -4,6 +4,7 @@ accepts call to execute in gulp pipeline.
|
|||||||
### build status/Dependencies
|
### build status/Dependencies
|
||||||
[](https://travis-ci.org/pushrocks/gulp-callfunction)
|
[](https://travis-ci.org/pushrocks/gulp-callfunction)
|
||||||
[](https://david-dm.org/pushrocks/gulp-callfunction)
|
[](https://david-dm.org/pushrocks/gulp-callfunction)
|
||||||
|
[](https://david-dm.org/pushrocks/gulp-callfunction#info=devDependencies)
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
```javascript
|
```javascript
|
||||||
|
73
index.js
73
index.js
@ -1,47 +1,48 @@
|
|||||||
/// <reference path="typings/tsd.d.ts" />
|
/// <reference path="typings/tsd.d.ts" />
|
||||||
var through = require("through2");
|
var through = require("through2");
|
||||||
var path = require("path");
|
var path = require("path");
|
||||||
var beautylog = require("beautylog");
|
var beautylog = require("beautylog")("os");
|
||||||
//important vars
|
|
||||||
var gulpCallFunction = {
|
|
||||||
executionMode: 'forEach',
|
|
||||||
functionsToExecute: undefined,
|
|
||||||
logBool: false
|
|
||||||
};
|
|
||||||
var runFunctionNames = function () {
|
|
||||||
if (typeof gulpCallFunction.functionsToExecute == "function") {
|
|
||||||
gulpCallFunction.functionsToExecute();
|
|
||||||
}
|
|
||||||
else if (Array.isArray(gulpCallFunction.functionsToExecute)) {
|
|
||||||
for (var anyFunction in gulpCallFunction.functionsToExecute) {
|
|
||||||
anyFunction();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
beautylog.error('gulp-callfunction: something is strange with the given arguments');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var forEach = function (file, enc, cb) {
|
|
||||||
if (gulpCallFunction.logBool)
|
|
||||||
beautylog.log(gulpCallFunction.executionMode);
|
|
||||||
if (gulpCallFunction.executionMode === 'forEach') {
|
|
||||||
if (gulpCallFunction.logBool)
|
|
||||||
beautylog.log('is forEach');
|
|
||||||
runFunctionNames();
|
|
||||||
}
|
|
||||||
//tell gulp that we are complete
|
|
||||||
return cb(null, file);
|
|
||||||
};
|
|
||||||
var atEnd = function () {
|
|
||||||
if (gulpCallFunction.executionMode == "atEnd") {
|
|
||||||
runFunctionNames();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
module.exports = function (functionsToExecute, executionMode, logBool) {
|
module.exports = function (functionsToExecute, executionMode, logBool) {
|
||||||
if (executionMode === void 0) { executionMode = 'forEach'; }
|
if (executionMode === void 0) { executionMode = 'forEach'; }
|
||||||
if (logBool === void 0) { logBool = false; }
|
if (logBool === void 0) { logBool = false; }
|
||||||
|
//important vars
|
||||||
|
var gulpCallFunction = {
|
||||||
|
executionMode: 'forEach',
|
||||||
|
functionsToExecute: undefined,
|
||||||
|
logBool: false
|
||||||
|
};
|
||||||
gulpCallFunction.functionsToExecute = functionsToExecute;
|
gulpCallFunction.functionsToExecute = functionsToExecute;
|
||||||
gulpCallFunction.executionMode = executionMode;
|
gulpCallFunction.executionMode = executionMode;
|
||||||
gulpCallFunction.logBool = logBool;
|
gulpCallFunction.logBool = logBool;
|
||||||
|
var runFunctionNames = function () {
|
||||||
|
if (typeof gulpCallFunction.functionsToExecute == "function") {
|
||||||
|
gulpCallFunction.functionsToExecute();
|
||||||
|
}
|
||||||
|
else if (Array.isArray(gulpCallFunction.functionsToExecute)) {
|
||||||
|
for (var anyFunction in gulpCallFunction.functionsToExecute) {
|
||||||
|
anyFunction();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
beautylog.error('gulp-callfunction: something is strange with the given arguments');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var forEach = function (file, enc, cb) {
|
||||||
|
if (gulpCallFunction.logBool)
|
||||||
|
beautylog.log(gulpCallFunction.executionMode);
|
||||||
|
if (gulpCallFunction.executionMode === 'forEach') {
|
||||||
|
if (gulpCallFunction.logBool)
|
||||||
|
beautylog.log('is forEach');
|
||||||
|
runFunctionNames();
|
||||||
|
}
|
||||||
|
//tell gulp that we are complete
|
||||||
|
return cb(null, file);
|
||||||
|
};
|
||||||
|
var atEnd = function (cb) {
|
||||||
|
if (gulpCallFunction.executionMode == "atEnd") {
|
||||||
|
runFunctionNames();
|
||||||
|
}
|
||||||
|
cb();
|
||||||
|
};
|
||||||
return through.obj(forEach, atEnd);
|
return through.obj(forEach, atEnd);
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "gulp-callfunction",
|
"name": "gulp-callfunction",
|
||||||
"version": "0.0.4",
|
"version": "0.0.10",
|
||||||
"description": "accepts a function call as parameter to execute in gulp pipeline",
|
"description": "accepts a function call as parameter to execute in gulp pipeline",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -29,7 +29,7 @@
|
|||||||
"gulp-typescript": "^2.9.2"
|
"gulp-typescript": "^2.9.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"beautylog": "0.0.15",
|
"beautylog": "1.0.4",
|
||||||
"through2": "^2.0.0"
|
"through2": "^2.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
3
test.js
3
test.js
@ -1,8 +1,9 @@
|
|||||||
/// <reference path="typings/tsd.d.ts" />
|
/// <reference path="typings/tsd.d.ts" />
|
||||||
var gulp = require("gulp");
|
var gulp = require("gulp");
|
||||||
var gulpCallFunction = require("./index.js");
|
var gulpCallFunction = require("./index.js");
|
||||||
|
var beautylog = require("beautylog")("os");
|
||||||
var myFunction = function () {
|
var myFunction = function () {
|
||||||
console.log("Hello World!");
|
beautylog.log("Hello World!");
|
||||||
};
|
};
|
||||||
gulp.task('default', function () {
|
gulp.task('default', function () {
|
||||||
gulp.src('./test/test.md')
|
gulp.src('./test/test.md')
|
||||||
|
69
ts/index.ts
69
ts/index.ts
@ -1,46 +1,45 @@
|
|||||||
/// <reference path="typings/tsd.d.ts" />
|
/// <reference path="typings/tsd.d.ts" />
|
||||||
var through = require("through2");
|
var through = require("through2");
|
||||||
var path = require("path");
|
var path = require("path");
|
||||||
var beautylog = require("beautylog");
|
var beautylog = require("beautylog")("os");
|
||||||
|
|
||||||
//important vars
|
|
||||||
var gulpCallFunction = {
|
|
||||||
executionMode: 'forEach', //can be forEach or atEnd
|
|
||||||
functionsToExecute: undefined,
|
|
||||||
logBool: false
|
|
||||||
};
|
|
||||||
|
|
||||||
var runFunctionNames = function () {
|
module.exports = function (functionsToExecuteArg:any|any[],executionModeArg:string = 'forEach', logBoolArg = false) {
|
||||||
if (typeof gulpCallFunction.functionsToExecute == "function" ) {
|
//important vars
|
||||||
gulpCallFunction.functionsToExecute();
|
var gulpCallFunction = {
|
||||||
} else if (Array.isArray(gulpCallFunction.functionsToExecute)) {
|
executionMode: executionModeArg, //can be forEach or atEnd
|
||||||
for (var anyFunction in gulpCallFunction.functionsToExecute) {
|
functionsToExecute: functionsToExecuteArg,
|
||||||
anyFunction();
|
logBool: logBoolArg
|
||||||
|
};
|
||||||
|
|
||||||
|
var runFunctionNames = function () {
|
||||||
|
if (typeof gulpCallFunction.functionsToExecute == "function" ) {
|
||||||
|
gulpCallFunction.functionsToExecute();
|
||||||
|
} else if (Array.isArray(gulpCallFunction.functionsToExecute)) {
|
||||||
|
for (var anyFunction in gulpCallFunction.functionsToExecute) {
|
||||||
|
anyFunction();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
beautylog.error('gulp-callfunction: something is strange with the given arguments');
|
||||||
}
|
}
|
||||||
} else {
|
};
|
||||||
beautylog.error('gulp-callfunction: something is strange with the given arguments');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
var forEach = function (file, enc, cb) {
|
var forEach = function (file, enc, cb) {
|
||||||
if (gulpCallFunction.logBool) beautylog.log(gulpCallFunction.executionMode);
|
if (gulpCallFunction.logBool) beautylog.log(gulpCallFunction.executionMode);
|
||||||
if (gulpCallFunction.executionMode === 'forEach') {
|
if (gulpCallFunction.executionMode === 'forEach') {
|
||||||
if(gulpCallFunction.logBool) beautylog.log('is forEach');
|
if(gulpCallFunction.logBool) beautylog.log('is forEach');
|
||||||
runFunctionNames();
|
runFunctionNames();
|
||||||
}
|
}
|
||||||
//tell gulp that we are complete
|
//tell gulp that we are complete
|
||||||
return cb(null, file);
|
return cb(null, file);
|
||||||
};
|
};
|
||||||
|
|
||||||
var atEnd = function() {
|
var atEnd = function(cb) {
|
||||||
if (gulpCallFunction.executionMode == "atEnd") {
|
if (gulpCallFunction.executionMode == "atEnd") {
|
||||||
runFunctionNames();
|
runFunctionNames();
|
||||||
}
|
}
|
||||||
};
|
cb();
|
||||||
module.exports = function (functionsToExecute:any|any[],executionMode:string = 'forEach', logBool = false) {
|
};
|
||||||
gulpCallFunction.functionsToExecute = functionsToExecute;
|
|
||||||
gulpCallFunction.executionMode = executionMode;
|
|
||||||
gulpCallFunction.logBool = logBool;
|
|
||||||
return through.obj(forEach,atEnd);
|
return through.obj(forEach,atEnd);
|
||||||
};
|
};
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
/// <reference path="typings/tsd.d.ts" />
|
/// <reference path="typings/tsd.d.ts" />
|
||||||
var gulp = require("gulp");
|
var gulp = require("gulp");
|
||||||
var gulpCallFunction = require("./index.js");
|
var gulpCallFunction = require("./index.js");
|
||||||
|
var beautylog = require("beautylog")("os");
|
||||||
|
|
||||||
var myFunction = function () {
|
var myFunction = function () {
|
||||||
console.log("Hello World!");
|
beautylog.log("Hello World!");
|
||||||
}
|
}
|
||||||
|
|
||||||
gulp.task('default',function() {
|
gulp.task('default',function() {
|
||||||
|
Reference in New Issue
Block a user