gulp-notify
Advanced tools
Comparing version 1.0.0-beta to 1.1.0
var through = require("through2"); | ||
var report = require('./report'); | ||
var notifier = require("node-notifier"); | ||
var Notification = require("node-notifier"); | ||
@@ -8,2 +8,3 @@ "use strict"; | ||
module.exports = function (options) { | ||
var reporter; | ||
@@ -13,3 +14,8 @@ options = options || {}; | ||
var reporter = options.notifier || notifier.notify; | ||
if (options.notifier) { | ||
reporter = options.notifier; | ||
} else { | ||
var notifier = new Notification(options); | ||
var reporter = notifier.notify.bind(notifier); | ||
} | ||
var lastFile = null; | ||
@@ -16,0 +22,0 @@ |
@@ -34,2 +34,6 @@ var template = require("lodash.template"); | ||
if (typeof options === "string") { | ||
message = options; | ||
} | ||
if (typeof options === "object") { | ||
@@ -47,33 +51,29 @@ if (typeof options.title === "function") { | ||
} | ||
} else { | ||
options = {}; | ||
} | ||
if (typeof options === "string") { | ||
message = options; | ||
} | ||
if (object instanceof Error) { | ||
var titleTemplate = template(title); | ||
var messageTemplate = template(message); | ||
return { | ||
title: titleTemplate({ | ||
error: object, | ||
options: templateOptions | ||
}), | ||
message: messageTemplate({ | ||
error: object, | ||
options: templateOptions | ||
}) | ||
}; | ||
} | ||
return { | ||
title: gutil.template(title, { | ||
options.title = titleTemplate({ | ||
error: object, | ||
options: templateOptions | ||
}); | ||
options.message = messageTemplate({ | ||
error: object, | ||
options: templateOptions | ||
}); | ||
} else { | ||
options.title = gutil.template(title, { | ||
file: object, | ||
options: templateOptions | ||
}), | ||
message: gutil.template(message, { | ||
}); | ||
options.message = gutil.template(message, { | ||
file: object, | ||
options: templateOptions | ||
}) | ||
}; | ||
}); | ||
} | ||
return options; | ||
} |
{ | ||
"name": "gulp-notify", | ||
"version": "1.0.0-beta", | ||
"version": "1.1.0", | ||
"description": "A plugin for Gulp to send messages to Mac Notification Center or Linux' notify-send", | ||
@@ -28,6 +28,6 @@ "keywords": [ | ||
"dependencies": { | ||
"node-notifier": "~1.2.1", | ||
"through2": "~0.4.0", | ||
"gulp-util": "~2.2.12", | ||
"lodash.template": "~2.4.1" | ||
"lodash.template": "~2.4.1", | ||
"node-notifier": "^2.0.0-alpha" | ||
}, | ||
@@ -49,2 +49,2 @@ "devDependencies": { | ||
] | ||
} | ||
} |
@@ -79,2 +79,33 @@ /*global describe, it*/ | ||
it('should call notifier with extra options untouched', function(done) { | ||
var testString = "this is a test"; | ||
var testIcon = "face-cool"; | ||
var mockedNotify = notify.withReporter(mockGenerator(function (opts) { | ||
should.exist(opts); | ||
should.exist(opts.icon); | ||
should.exist(opts.message); | ||
String(opts.icon).should.equal(testIcon); | ||
String(opts.message).should.equal(testString); | ||
})); | ||
var instream = gulp.src(join(__dirname, "./fixtures/*.txt")), | ||
outstream = mockedNotify({ | ||
message: testString, | ||
icon: testIcon | ||
}); | ||
outstream.on('data', function(file) { | ||
should.exist(file); | ||
should.exist(file.path); | ||
should.exist(file.contents); | ||
}); | ||
outstream.on('end', function() { | ||
done(); | ||
}); | ||
instream.pipe(outstream); | ||
}); | ||
it('should emit error when sub-module returns error', function(done) { | ||
@@ -81,0 +112,0 @@ var mockedNotify = notify.withReporter(function (options, callback) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
37279
805
0
+ Addedgrowler@0.0.1(transitive)
+ Addednode-notifier@2.0.6(transitive)
+ Addedshellwords@0.1.1(transitive)
+ Addedunderscore@1.13.7(transitive)
- Removednode-notifier@1.2.1(transitive)
Updatednode-notifier@^2.0.0-alpha