[484] | 1 | /* |
---|
| 2 | * grunt-banner |
---|
| 3 | * https://github.com/mattstyles/grunt-banner |
---|
| 4 | * |
---|
| 5 | * Copyright (c) 2013 Matt Styles |
---|
| 6 | * Licensed under the MIT license. |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | 'use strict'; |
---|
| 10 | |
---|
| 11 | module.exports = function( grunt ) { |
---|
| 12 | |
---|
| 13 | // Project configuration. |
---|
| 14 | grunt.initConfig({ |
---|
| 15 | jshint: { |
---|
| 16 | all: [ |
---|
| 17 | 'Gruntfile.js', |
---|
| 18 | 'tasks/*.js', |
---|
| 19 | '<%= nodeunit.tests %>' |
---|
| 20 | ], |
---|
| 21 | options: { |
---|
| 22 | jshintrc: '.jshintrc' |
---|
| 23 | } |
---|
| 24 | }, |
---|
| 25 | |
---|
| 26 | // Before generating any new files, remove any previously-created files. |
---|
| 27 | clean: { |
---|
| 28 | tests: ['tmp'] |
---|
| 29 | }, |
---|
| 30 | |
---|
| 31 | appConfig: { |
---|
| 32 | def: 'STRING' |
---|
| 33 | }, |
---|
| 34 | |
---|
| 35 | // Configuration to be run (and then tested). |
---|
| 36 | usebanner: { |
---|
| 37 | bannerTop: { |
---|
| 38 | options: { |
---|
| 39 | position: 'top', |
---|
| 40 | banner: '// the banner' |
---|
| 41 | }, |
---|
| 42 | files: { |
---|
| 43 | src: [ 'test/fixtures/some.js' ] |
---|
| 44 | } |
---|
| 45 | }, |
---|
| 46 | |
---|
| 47 | bannerBottom: { |
---|
| 48 | options: { |
---|
| 49 | position: 'bottom', |
---|
| 50 | banner: '// the banner' |
---|
| 51 | }, |
---|
| 52 | files: { |
---|
| 53 | src: [ 'test/fixtures/someBottom.js' ] |
---|
| 54 | } |
---|
| 55 | } |
---|
| 56 | }, |
---|
| 57 | |
---|
| 58 | // Unit tests. |
---|
| 59 | nodeunit: { |
---|
| 60 | tests: ['test/*_test.js'] |
---|
| 61 | } |
---|
| 62 | |
---|
| 63 | }); |
---|
| 64 | |
---|
| 65 | // Actually load this plugin's task(s). |
---|
| 66 | grunt.loadTasks('tasks'); |
---|
| 67 | |
---|
| 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 | |
---|
| 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', 'usebanner', 'nodeunit']); |
---|
| 76 | |
---|
| 77 | // By default, lint and run all tests. |
---|
| 78 | grunt.registerTask('default', ['jshint', 'test']); |
---|
| 79 | |
---|
| 80 | }; |
---|