Compare commits

...

4 Commits

Author SHA1 Message Date
c1f1500ffc 0.0.10 2015-11-30 09:49:58 +01:00
e42c5004c2 updated structure 2015-11-30 09:49:52 +01:00
e0c4a10411 0.0.9 2015-11-24 13:51:07 +01:00
6deab0541f update deps 2015-11-24 13:49:02 +01:00
5 changed files with 77 additions and 77 deletions

View File

@ -1,48 +1,48 @@
/// <reference path="typings/tsd.d.ts" />
var through = require("through2");
var path = require("path");
var beautylog = require("beautylog");
//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 (cb) {
if (gulpCallFunction.executionMode == "atEnd") {
runFunctionNames();
}
cb();
};
var beautylog = require("beautylog")("os");
module.exports = function (functionsToExecute, executionMode, logBool) {
if (executionMode === void 0) { executionMode = 'forEach'; }
if (logBool === void 0) { logBool = false; }
//important vars
var gulpCallFunction = {
executionMode: 'forEach',
functionsToExecute: undefined,
logBool: false
};
gulpCallFunction.functionsToExecute = functionsToExecute;
gulpCallFunction.executionMode = executionMode;
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);
};

View File

@ -1,6 +1,6 @@
{
"name": "gulp-callfunction",
"version": "0.0.8",
"version": "0.0.10",
"description": "accepts a function call as parameter to execute in gulp pipeline",
"main": "index.js",
"scripts": {
@ -29,7 +29,7 @@
"gulp-typescript": "^2.9.2"
},
"dependencies": {
"beautylog": "0.0.15",
"beautylog": "1.0.4",
"through2": "^2.0.0"
}
}

View File

@ -1,8 +1,9 @@
/// <reference path="typings/tsd.d.ts" />
var gulp = require("gulp");
var gulpCallFunction = require("./index.js");
var beautylog = require("beautylog")("os");
var myFunction = function () {
console.log("Hello World!");
beautylog.log("Hello World!");
};
gulp.task('default', function () {
gulp.src('./test/test.md')

View File

@ -1,47 +1,45 @@
/// <reference path="typings/tsd.d.ts" />
var through = require("through2");
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 () {
if (typeof gulpCallFunction.functionsToExecute == "function" ) {
gulpCallFunction.functionsToExecute();
} else if (Array.isArray(gulpCallFunction.functionsToExecute)) {
for (var anyFunction in gulpCallFunction.functionsToExecute) {
anyFunction();
module.exports = function (functionsToExecuteArg:any|any[],executionModeArg:string = 'forEach', logBoolArg = false) {
//important vars
var gulpCallFunction = {
executionMode: executionModeArg, //can be forEach or atEnd
functionsToExecute: functionsToExecuteArg,
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) {
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 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();
};
module.exports = function (functionsToExecute:any|any[],executionMode:string = 'forEach', logBool = false) {
gulpCallFunction.functionsToExecute = functionsToExecute;
gulpCallFunction.executionMode = executionMode;
gulpCallFunction.logBool = logBool;
var atEnd = function(cb) {
if (gulpCallFunction.executionMode == "atEnd") {
runFunctionNames();
}
cb();
};
return through.obj(forEach,atEnd);
};

View File

@ -1,9 +1,10 @@
/// <reference path="typings/tsd.d.ts" />
var gulp = require("gulp");
var gulpCallFunction = require("./index.js");
var beautylog = require("beautylog")("os");
var myFunction = function () {
console.log("Hello World!");
beautylog.log("Hello World!");
}
gulp.task('default',function() {