You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
765 B

  1. /*
  2. * grunt-contrib-watch
  3. * http://gruntjs.com/
  4. *
  5. * Copyright (c) 2013 "Cowboy" Ben Alman, contributors
  6. * Licensed under the MIT license.
  7. */
  8. module.exports = function(grunt) {
  9. 'use strict';
  10. grunt.registerMultiTask('echo', 'A task that echos a message.', function() {
  11. var msg = this.data.message || 'I do absolutely nothing.';
  12. var wait = this.data.wait || grunt.option('wait') || 0;
  13. var fail = this.data.fail || false;
  14. var done = this.async();
  15. // After a given time print a message or fail
  16. setTimeout(function() {
  17. if (fail) {
  18. grunt.fail.fatal(msg, fail);
  19. } else {
  20. grunt.log.writeln(msg);
  21. done();
  22. }
  23. }, wait);
  24. // Keep the process alive
  25. setInterval(function() {}, 250);
  26. });
  27. };