Skip to content

Commit

Permalink
Emit events
Browse files Browse the repository at this point in the history
Example usage with `grunt-notify` (in Gruntfile.coffee):

	grunt.event.on 'coffeelint:any', (status, message) ->
		grunt.config ['notify', 'coffeelint'], options:
			title: "Coffeelint #{status}"
			message: message
		grunt.task.run 'notify:coffeelint'



Resolves #14
  • Loading branch information
es128 committed Jun 10, 2013
1 parent ccc8e81 commit f196196
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tasks/coffeelint.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = function(grunt) {
grunt.verbose.ok();
} else {
errors.forEach(function(error) {
var status;
var status, message;

if (error.level === 'error') {
errorCount += 1;
Expand All @@ -29,8 +29,12 @@ module.exports = function(grunt) {
return;
}

grunt.log.writeln(status + ' ' + file + ':' + error.lineNumber + ' ' + error.message + ' (' + error.rule + ')');
});
message = file + ':' + error.lineNumber + ' ' + error.message + ' (' + error.rule + ')';

grunt.log.writeln(status + ' ' + message);

grunt.event.emit('coffeelint:' + error.level, error.level, message);
grunt.event.emit('coffeelint:any', error.level, message); });
}
});

Expand Down

0 comments on commit f196196

Please sign in to comment.