Gruntfile.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * grunt-contrib-concat
  3. * http://gruntjs.com/
  4. *
  5. * Copyright (c) 2012 "Cowboy" Ben Alman, 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. // Before generating any new files, remove any previously-created files.
  23. clean: {
  24. tests: ['tmp']
  25. },
  26. // Configuration to be run (and then tested).
  27. banner_property: 'AWESOME',
  28. concat: {
  29. default_options: {
  30. files: {
  31. 'tmp/default_options': ['test/fixtures/file1', 'test/fixtures/file2']
  32. }
  33. },
  34. custom_options: {
  35. options: {
  36. separator: '\n;\n',
  37. banner: '/* THIS TEST IS <%= banner_property %> */\n',
  38. footer: 'dude'
  39. },
  40. files: {
  41. 'tmp/custom_options': ['test/fixtures/file1', 'test/fixtures/file2']
  42. }
  43. },
  44. handling_invalid_files: {
  45. src: ['test/fixtures/file1', 'invalid_file/should_warn/but_not_fail', 'test/fixtures/file2'],
  46. dest: 'tmp/handling_invalid_files',
  47. nonull: true,
  48. },
  49. process_function: {
  50. options: {
  51. process: function(src, filepath) {
  52. return '// Source: ' + filepath + '\n' +
  53. src.replace(/file(\d)/, 'f$1');
  54. }
  55. },
  56. files: {
  57. 'tmp/process_function': ['test/fixtures/file1', 'test/fixtures/file2']
  58. }
  59. },
  60. },
  61. // Unit tests.
  62. nodeunit: {
  63. tests: ['test/*_test.js']
  64. }
  65. });
  66. // Actually load this plugin's task(s).
  67. grunt.loadTasks('tasks');
  68. // These plugins provide necessary tasks.
  69. grunt.loadNpmTasks('grunt-contrib-jshint');
  70. grunt.loadNpmTasks('grunt-contrib-clean');
  71. grunt.loadNpmTasks('grunt-contrib-nodeunit');
  72. grunt.loadNpmTasks('grunt-contrib-internal');
  73. // Whenever the "test" task is run, first clean the "tmp" dir, then run this
  74. // plugin's task(s), then test the result.
  75. grunt.registerTask('test', ['clean', 'concat', 'nodeunit']);
  76. // By default, lint and run all tests.
  77. grunt.registerTask('default', ['jshint', 'test', 'build-contrib']);
  78. };