1 | 'use strict';
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | module.exports = function (grunt) {
|
10 | grunt.initConfig({
|
11 | jsbeautifier: {
|
12 | files: ['<%= jshint.all %>'],
|
13 | options: {
|
14 | config: '.jsbeautify'
|
15 | }
|
16 | },
|
17 | simplemocha: {
|
18 | options: {
|
19 | globals: ['should', 'navigator'],
|
20 | timeout: 3000,
|
21 | ignoreLeaks: false,
|
22 | ui: 'bdd',
|
23 | reporter: 'spec'
|
24 | },
|
25 | all: {
|
26 | src: 'test/**/*.js'
|
27 | }
|
28 | },
|
29 | jshint: {
|
30 | options: {
|
31 | jshintrc: '.jshintrc'
|
32 | },
|
33 | all: [
|
34 | 'Gruntfile.js',
|
35 | 'index.js',
|
36 | 'lib/**/*.js',
|
37 | 'test/**/*.js',
|
38 | 'package.json'
|
39 | ]
|
40 | },
|
41 | jsdoc: {
|
42 | dist: {
|
43 | src: ['lib/**/*.js', 'test/**/*.js'],
|
44 | options: {
|
45 | destination: 'doc/html',
|
46 | configure: 'jsdoc.json'
|
47 | }
|
48 | }
|
49 | },
|
50 | watch: {
|
51 | scripts: {
|
52 | files: ['<%= jshint.all %>'],
|
53 | tasks: ['newer:simplemocha:all', 'newer:jshint:all', 'newer:jsbeautifier'],
|
54 | options: {
|
55 | interrupt: true
|
56 | }
|
57 | }
|
58 | }
|
59 | });
|
60 |
|
61 |
|
62 | for (var key in grunt.file.readJSON('package.json').devDependencies) {
|
63 | if (key.indexOf('grunt') === 0 && key !== 'grunt') {
|
64 | grunt.loadNpmTasks(key);
|
65 | }
|
66 | }
|
67 | grunt.registerTask('lint', 'jshint', 'jsbeautifier');
|
68 | grunt.registerTask('doc', 'jsdoc');
|
69 | grunt.registerTask('test', 'simplemocha');
|
70 | grunt.registerTask('default', ['lint', 'doc', 'test']);
|
71 | };
|