forked from phase2/grunt-drupal-tasks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotify.js
40 lines (36 loc) · 1.32 KB
/
notify.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
module.exports = function(grunt) {
/**
* Define "notify" tasks.
*/
if ((grunt.option('quiet') || process.env.GDT_QUIET) && !grunt.option('notify')) {
return;
}
grunt.loadNpmTasks('grunt-notify');
var guessProjectName = require('grunt-notify/lib/util/guessProjectName');
// Set the default threshold.
var threshold = grunt.config('config.notify.threshold') || 10;
// If the notify flag is used, drop the threshold to ensure notifications are
// triggered.
if (grunt.option('notify')) {
threshold = 0;
}
grunt.config('notify_hooks', {
options: {
// title needs to be reset to the same as the grunt-notify default because
// the guessing mechanism thinks that grunt-drupal-tasks is the project.
title: guessProjectName(),
// Only trigger success messages if the process has taken longer than the
// configured notifyThreshold.
success: true,
// The 'threshold' option is currently implemented to be triggered if
// enabled is falsy. If enabled is truthy the threshold is moot.
enabled: grunt.option('notify'),
threshold: threshold,
duration: 5,
// Supposed to suppress notify_hooks log header, but not working.
gruntLogHeader: false
}
});
// This is required if you use any options.
grunt.task.run('notify_hooks');
};