gulp-notify
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -23,3 +23,2 @@ var through = require("through2"); | ||
var stream = this; | ||
report(reporter, file, options, templateOptions, function (err) { | ||
@@ -26,0 +25,0 @@ err && stream.emit("error", err); |
var template = require("lodash.template"); | ||
var gutil = require("gulp-util"); | ||
var api = require("./extra_api"); | ||
var extend = require("node.extend"); | ||
@@ -26,5 +27,35 @@ "use strict"; | ||
function generate (outputData, object, title, message, templateOptions) { | ||
if (object instanceof Error) { | ||
var titleTemplate = template(title); | ||
var messageTemplate = template(message); | ||
return extend(outputData, { | ||
title: titleTemplate({ | ||
error: object, | ||
options: templateOptions | ||
}), | ||
message: messageTemplate({ | ||
error: object, | ||
options: templateOptions | ||
}) | ||
}); | ||
} | ||
return extend(outputData, { | ||
title: gutil.template(title, { | ||
file: object, | ||
options: templateOptions | ||
}), | ||
message: gutil.template(message, { | ||
file: object, | ||
options: templateOptions | ||
}) | ||
}); | ||
} | ||
function constructOptions (options, object, templateOptions) { | ||
var message = object.path || object.message || object, | ||
title = !(object instanceof Error) ? "Gulp notification" : "Error running Gulp"; | ||
title = !(object instanceof Error) ? "Gulp notification" : "Error running Gulp", | ||
outputData = {}; | ||
@@ -40,40 +71,16 @@ if (typeof options === "function") { | ||
if (typeof options === "object") { | ||
if (typeof options.title === "function") { | ||
title = options.title(object); | ||
outputData = extend(true, {}, options); | ||
if (typeof outputData.title === "function") { | ||
title = outputData.title(object); | ||
} else { | ||
title = options.title || title; | ||
title = outputData.title || title; | ||
} | ||
if (typeof options.message === "function") { | ||
message = options.message(object); | ||
if (typeof outputData.message === "function") { | ||
message = outputData.message(object); | ||
} else { | ||
message = options.message || message; | ||
message = outputData.message || message; | ||
} | ||
} else { | ||
options = {}; | ||
} | ||
if (object instanceof Error) { | ||
var titleTemplate = template(title); | ||
var messageTemplate = template(message); | ||
options.title = titleTemplate({ | ||
error: object, | ||
options: templateOptions | ||
}); | ||
options.message = messageTemplate({ | ||
error: object, | ||
options: templateOptions | ||
}); | ||
} else { | ||
options.title = gutil.template(title, { | ||
file: object, | ||
options: templateOptions | ||
}); | ||
options.message = gutil.template(message, { | ||
file: object, | ||
options: templateOptions | ||
}); | ||
} | ||
return options; | ||
return generate(outputData, object, title, message, templateOptions); | ||
} |
{ | ||
"name": "gulp-notify", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "A plugin for Gulp to send messages to Mac Notification Center or Linux' notify-send", | ||
@@ -31,3 +31,4 @@ "keywords": [ | ||
"lodash.template": "~2.4.1", | ||
"node-notifier": "^2.0.0-alpha" | ||
"node-notifier": "^2.0.2", | ||
"node.extend": "^1.0.9" | ||
}, | ||
@@ -34,0 +35,0 @@ "devDependencies": { |
38840
839
5
+ Addednode.extend@^1.0.9
+ Addedhas@1.0.4(transitive)
+ Addedis@3.3.0(transitive)
+ Addednode.extend@1.1.8(transitive)
Updatednode-notifier@^2.0.2