|
| 1 | +'use strict'; |
| 2 | + |
| 3 | +module.exports = function (grunt) { |
| 4 | + require('time-grunt')(grunt); |
| 5 | + require('load-grunt-tasks')(grunt); |
| 6 | + |
| 7 | + grunt.config.init({ |
| 8 | + BuildConfig: { |
| 9 | + testDirectory: 'test', |
| 10 | + exampleDirectory: 'example', |
| 11 | + targetDirectory: 'target' |
| 12 | + }, |
| 13 | + |
| 14 | + clean: { |
| 15 | + options: { |
| 16 | + force: true |
| 17 | + }, |
| 18 | + dot: 'true', |
| 19 | + target: { |
| 20 | + src: [ |
| 21 | + '<%=BuildConfig.targetDirectory%>/**' |
| 22 | + ] |
| 23 | + } |
| 24 | + }, |
| 25 | + |
| 26 | + jsonlint: { |
| 27 | + full: { |
| 28 | + src: [ |
| 29 | + '*.json' |
| 30 | + ] |
| 31 | + } |
| 32 | + }, |
| 33 | + |
| 34 | + jshint: { |
| 35 | + full: { |
| 36 | + files: { |
| 37 | + src: [ |
| 38 | + 'angular-web-notification.js' |
| 39 | + ] |
| 40 | + } |
| 41 | + }, |
| 42 | + options: { |
| 43 | + jshintrc: true |
| 44 | + } |
| 45 | + }, |
| 46 | + |
| 47 | + jslint: { |
| 48 | + full: { |
| 49 | + src: [ |
| 50 | + 'angular-web-notification.js' |
| 51 | + ], |
| 52 | + options: { |
| 53 | + edition: 'latest', |
| 54 | + failOnError: true |
| 55 | + }, |
| 56 | + directives: { |
| 57 | + browser: true, |
| 58 | + vars: true, |
| 59 | + plusplus: true |
| 60 | + } |
| 61 | + } |
| 62 | + }, |
| 63 | + |
| 64 | + eslint: { |
| 65 | + full: { |
| 66 | + options: { |
| 67 | + config: '.eslintrc' |
| 68 | + }, |
| 69 | + src: [ |
| 70 | + 'angular-web-notification.js' |
| 71 | + ] |
| 72 | + } |
| 73 | + }, |
| 74 | + |
| 75 | + todos: { |
| 76 | + options: { |
| 77 | + priorities: { |
| 78 | + high: /(todo|TODO|fixme|FIXME)/ |
| 79 | + } |
| 80 | + }, |
| 81 | + full: { |
| 82 | + src: [ |
| 83 | + 'angular-web-notification.js', |
| 84 | + '<%=BuildConfig.testDirectory%>/**/*.js', |
| 85 | + '<%=BuildConfig.exampleDirectory%>/**/*.js' |
| 86 | + ] |
| 87 | + } |
| 88 | + }, |
| 89 | + |
| 90 | + blanket: { |
| 91 | + full: { |
| 92 | + options: { |
| 93 | + 'data-cover-only': 'angular-web-notification.js' |
| 94 | + }, |
| 95 | + files: { |
| 96 | + 'target/coverage/': ['./'] |
| 97 | + } |
| 98 | + } |
| 99 | + }, |
| 100 | + |
| 101 | + karma: { |
| 102 | + full: { |
| 103 | + configFile: 'karma.conf.js', |
| 104 | + singleRun: true, |
| 105 | + browsers: ['PhantomJS'] |
| 106 | + } |
| 107 | + }, |
| 108 | + |
| 109 | + coveralls: { |
| 110 | + options: { |
| 111 | + force: true |
| 112 | + }, |
| 113 | + full: { |
| 114 | + src: '<%=BuildConfig.targetDirectory%>/coverage/report/*.info' |
| 115 | + } |
| 116 | + }, |
| 117 | + |
| 118 | + jsdoc2md: { |
| 119 | + api: { |
| 120 | + options: { |
| 121 | + index: true, |
| 122 | + 'private': false |
| 123 | + }, |
| 124 | + src: 'angular-web-notification.js', |
| 125 | + dest: 'docs/api.md' |
| 126 | + } |
| 127 | + } |
| 128 | + }); |
| 129 | + |
| 130 | + grunt.registerTask('full', 'Run all build steps.', [ |
| 131 | + 'jsonlint:full', |
| 132 | + 'jshint:full', |
| 133 | + 'jslint:full', |
| 134 | + 'eslint:full', |
| 135 | + 'todos:full', |
| 136 | + 'jsdoc2md:api', |
| 137 | + 'coverage' |
| 138 | + ]); |
| 139 | + |
| 140 | + grunt.registerTask('coverage', 'Run all module tests cases.', [ |
| 141 | + 'clean:target', |
| 142 | + 'karma:full' |
| 143 | + ]); |
| 144 | + |
| 145 | + grunt.registerTask('continuesIntegration', 'Run all module tests cases.', [ |
| 146 | + 'jsonlint:full', |
| 147 | + 'jshint:full', |
| 148 | + 'jslint:full', |
| 149 | + 'eslint:full', |
| 150 | + 'todos:full', |
| 151 | + 'coverage', |
| 152 | + 'coveralls:full' |
| 153 | + ]); |
| 154 | +}; |
0 commit comments