forked from m-koopman/gulp-build-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.js
50 lines (39 loc) · 1.14 KB
/
build.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"use strict";
var gulp = require("gulp"),
gutil = require("gulp-util"),
dateformat = require("dateformat");
var notify = require("gulp-notify");
function getLogPrefix( str ) {
var color = gutil.colors.yellow;
if ( str[ 0 ] == "!" ) {
str = str.substring( 1, str.length );
color = gutil.colors.red;
}
return ( "[ " + color( str ) + " ]");
}
notify.logLevel(0);
var Build = {};
Build.log = function() {
var time = "["+gutil.colors.grey(dateformat(new Date(), "HH:MM:ss"))+"]";
process.stdout.write(time + " ");
var args = Array.prototype.slice.call(arguments);
if (args.length > 1) {
process.stdout.write(getLogPrefix(args.shift()) + " ");
}
console.log.apply(console, args);
};
Build.error = function(title, message) {
gulp.src("")
.pipe( notify({
title: title,
message: message
}));
};
Build.globsToString = function(globArray) {
var globs_string = String(globArray);
if (globs_string[ 0 ] == "[") {
globs_string = globs_string.substring(1, globs_string.length - 1);
}
return globs_string;
};
module.exports = Build;