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.

60 lines
1.5 KiB

  1. /*
  2. * grunt-contrib-clean
  3. * http://gruntjs.com/
  4. *
  5. * Copyright (c) 2012 Tim Branyen, contributors
  6. * Licensed under the MIT license.
  7. */
  8. 'use strict';
  9. module.exports = function(grunt) {
  10. // Project configuration.
  11. grunt.initConfig({
  12. jshint: {
  13. all: [
  14. 'Gruntfile.js',
  15. 'tasks/*.js',
  16. '<%= nodeunit.tests %>'
  17. ],
  18. options: {
  19. jshintrc: '.jshintrc'
  20. },
  21. },
  22. // Configuration to be run (and then tested).
  23. clean: {
  24. short: ['tmp/sample_short'],
  25. long: {
  26. src: ['tmp/sample_long'],
  27. },
  28. },
  29. // Unit tests.
  30. nodeunit: {
  31. tests: ['test/*_test.js'],
  32. },
  33. });
  34. // Actually load this plugin's task(s).
  35. grunt.loadTasks('tasks');
  36. // These plugins provide necessary tasks.
  37. grunt.loadNpmTasks('grunt-contrib-jshint');
  38. grunt.loadNpmTasks('grunt-contrib-nodeunit');
  39. grunt.loadNpmTasks('grunt-contrib-internal');
  40. // Setup a test helper to create some folders to clean.
  41. grunt.registerTask('copy', 'Copy fixtures to a temp location.', function() {
  42. grunt.file.copy('test/fixtures/sample_long/long.txt', 'tmp/sample_long/long.txt');
  43. grunt.file.copy('test/fixtures/sample_short/short.txt', 'tmp/sample_short/short.txt');
  44. });
  45. // Whenever the 'test' task is run, first create some files to be cleaned,
  46. // then run this plugin's task(s), then test the result.
  47. grunt.registerTask('test', ['copy', 'clean', 'nodeunit']);
  48. // By default, lint and run all tests.
  49. grunt.registerTask('default', ['jshint', 'test', 'build-contrib']);
  50. };