|
79b51d5
geddski authored
|
||
| 1 | var files = require('./angularFiles').files; | |
| 2 | var util = require('./lib/grunt/utils.js'); | |
|
265f0b5
petebacondarwin authored
|
||
| 3 | var path = require('path'); | |
|
79b51d5
geddski authored
|
||
| 4 | ||
| 5 | module.exports = function(grunt) { | |
| 6 | //grunt plugins | |
|
e7ac7aa
gdi2290 authored
|
||
| 7 | require('load-grunt-tasks')(grunt); | |
| 8 | ||
|
79b51d5
geddski authored
|
||
| 9 | grunt.loadTasks('lib/grunt'); | |
| 10 | ||
| 11 | var NG_VERSION = util.getVersion(); | |
|
8a96393
geddski authored
|
||
| 12 | var dist = 'angular-'+ NG_VERSION.full; | |
|
79b51d5
geddski authored
|
||
| 13 | ||
| 14 | ||
| 15 | //global beforeEach | |
| 16 | util.init(); | |
| 17 | ||
| 18 | ||
| 19 | //config | |
| 20 | grunt.initConfig({ | |
| 21 | NG_VERSION: NG_VERSION, | |
| 22 | ||
|
2c2adbc
vojtajina authored
|
||
| 23 | parallel: { | |
| 24 | travis: { | |
| 25 | tasks: [ | |
|
e848099
jamestalmage authored
|
||
| 26 | util.parallelTask(['test:unit', 'test:docgen', 'test:promises-aplus', 'tests:docs'], {stream: true}), | |
|
7909ebe
vojtajina authored
|
||
| 27 | util.parallelTask(['test:e2e']) | |
|
2c2adbc
vojtajina authored
|
||
| 28 | ] | |
| 29 | } | |
| 30 | }, | |
| 31 | ||
|
79b51d5
geddski authored
|
||
| 32 | connect: { | |
| 33 | devserver: { | |
| 34 | options: { | |
| 35 | port: 8000, | |
|
5fd39e0
IgorMinar authored
|
||
| 36 | hostname: '0.0.0.0', | |
|
79b51d5
geddski authored
|
||
| 37 | base: '.', | |
| 38 | keepalive: true, | |
| 39 | middleware: function(connect, options){ | |
| 40 | return [ | |
| 41 | //uncomment to enable CSP | |
| 42 | // util.csp(), | |
| 43 | util.rewrite(), | |
| 44 | connect.favicon('images/favicon.ico'), | |
| 45 | connect.static(options.base), | |
| 46 | connect.directory(options.base) | |
| 47 | ]; | |
| 48 | } | |
| 49 | } | |
| 50 | }, | |
|
2c2adbc
vojtajina authored
|
||
| 51 | testserver: { | |
| 52 | options: { | |
|
b73c46c
vojtajina authored
|
||
| 53 | // We use end2end task (which does not start the webserver) | |
| 54 | // and start the webserver as a separate process (in travis_build.sh) | |
| 55 | // to avoid https://github.com/joyent/libuv/issues/826 | |
| 56 | port: 8000, | |
| 57 | hostname: '0.0.0.0', | |
|
2c2adbc
vojtajina authored
|
||
| 58 | middleware: function(connect, options){ | |
| 59 | return [ | |
| 60 | function(req, resp, next) { | |
| 61 | // cache get requests to speed up tests on travis | |
| 62 | if (req.method === 'GET') { | |
| 63 | resp.setHeader('Cache-control', 'public, max-age=3600'); | |
| 64 | } | |
| 65 | ||
| 66 | next(); | |
| 67 | }, | |
| 68 | connect.favicon('images/favicon.ico'), | |
| 69 | connect.static(options.base) | |
| 70 | ]; | |
| 71 | } | |
| 72 | } | |
| 73 | } | |
|
79b51d5
geddski authored
|
||
| 74 | }, | |
| 75 | ||
| 76 | ||
|
05b41ee
matsko authored
|
||
| 77 | tests: { | |
|
c2e215f
vojtajina authored
|
||
| 78 | jqlite: 'karma-jqlite.conf.js', | |
| 79 | jquery: 'karma-jquery.conf.js', | |
|
77c4fc6
matsko authored
|
||
| 80 | docs: 'karma-docs.conf.js', | |
|
7aef2d5
juliemr authored
|
||
| 81 | modules: 'karma-modules.conf.js' | |
|
79b51d5
geddski authored
|
||
| 82 | }, | |
| 83 | ||
| 84 | ||
| 85 | autotest: { | |
|
c2e215f
vojtajina authored
|
||
| 86 | jqlite: 'karma-jqlite.conf.js', | |
|
63c1e5b
IgorMinar authored
|
||
| 87 | jquery: 'karma-jquery.conf.js', | |
|
77c4fc6
matsko authored
|
||
| 88 | modules: 'karma-modules.conf.js', | |
|
05b41ee
matsko authored
|
||
| 89 | docs: 'karma-docs.conf.js' | |
|
79b51d5
geddski authored
|
||
| 90 | }, | |
| 91 | ||
| 92 | ||
|
84467d8
juliemr authored
|
||
| 93 | protractor: { | |
|
0e85ca9
juliemr authored
|
||
| 94 | normal: 'protractor-conf.js', | |
|
e645f7c
juliemr authored
|
||
| 95 | jquery: 'protractor-jquery-conf.js', | |
|
0e85ca9
juliemr authored
|
||
| 96 | jenkins: 'protractor-jenkins-conf.js' | |
|
2ed4ad5
juliemr authored
|
||
| 97 | }, | |
| 98 | ||
| 99 | ||
|
e848099
jamestalmage authored
|
||
| 100 | clean: { | |
| 101 | build: ['build'], | |
| 102 | tmp: ['tmp'] | |
| 103 | }, | |
|
79b51d5
geddski authored
|
||
| 104 | ||
|
934a95d
petebacondarwin authored
|
||
| 105 | jshint: { | |
|
05ef1bd
James Brewer authored
|
||
| 106 | options: { | |
| 107 | jshintrc: true, | |
| 108 | }, | |
|
934a95d
petebacondarwin authored
|
||
| 109 | ng: { | |
| 110 | files: { src: files['angularSrc'] }, | |
| 111 | }, | |
| 112 | ngAnimate: { | |
| 113 | files: { src: 'src/ngAnimate/**/*.js' }, | |
| 114 | }, | |
| 115 | ngCookies: { | |
| 116 | files: { src: 'src/ngCookies/**/*.js' }, | |
| 117 | }, | |
| 118 | ngLocale: { | |
| 119 | files: { src: 'src/ngLocale/**/*.js' }, | |
| 120 | }, | |
| 121 | ngMock: { | |
| 122 | files: { src: 'src/ngMock/**/*.js' }, | |
| 123 | }, | |
| 124 | ngResource: { | |
| 125 | files: { src: 'src/ngResource/**/*.js' }, | |
| 126 | }, | |
| 127 | ngRoute: { | |
| 128 | files: { src: 'src/ngRoute/**/*.js' }, | |
| 129 | }, | |
| 130 | ngSanitize: { | |
| 131 | files: { src: 'src/ngSanitize/**/*.js' }, | |
| 132 | }, | |
| 133 | ngScenario: { | |
| 134 | files: { src: 'src/ngScenario/**/*.js' }, | |
| 135 | }, | |
| 136 | ngTouch: { | |
| 137 | files: { src: 'src/ngTouch/**/*.js' }, | |
| 138 | } | |
| 139 | }, | |
|
79b51d5
geddski authored
|
||
| 140 | ||
|
7f4edaf
IgorMinar authored
|
||
| 141 | jscs: { | |
| 142 | src: ['src/**/*.js', 'test/**/*.js'], | |
| 143 | options: { | |
| 144 | config: ".jscs.json" | |
| 145 | } | |
| 146 | }, | |
| 147 | ||
|
79b51d5
geddski authored
|
||
| 148 | build: { | |
| 149 | scenario: { | |
| 150 | dest: 'build/angular-scenario.js', | |
| 151 | src: [ | |
|
576269b
ksheedlo authored
|
||
| 152 | 'bower_components/jquery/jquery.js', | |
|
79b51d5
geddski authored
|
||
| 153 | util.wrap([files['angularSrc'], files['angularScenario']], 'ngScenario/angular') | |
| 154 | ], | |
| 155 | styles: { | |
| 156 | css: ['css/angular.css', 'css/angular-scenario.css'] | |
| 157 | } | |
| 158 | }, | |
| 159 | angular: { | |
| 160 | dest: 'build/angular.js', | |
| 161 | src: util.wrap([files['angularSrc']], 'angular'), | |
| 162 | styles: { | |
| 163 | css: ['css/angular.css'], | |
|
a86cf20
tbosch authored
|
||
| 164 | generateCspCssFile: true, | |
|
79b51d5
geddski authored
|
||
| 165 | minify: true | |
| 166 | } | |
| 167 | }, | |
| 168 | loader: { | |
| 169 | dest: 'build/angular-loader.js', | |
|
934a95d
petebacondarwin authored
|
||
| 170 | src: util.wrap(files['angularLoader'], 'loader') | |
|
79b51d5
geddski authored
|
||
| 171 | }, | |
|
94ec84e
btford authored
|
||
| 172 | touch: { | |
| 173 | dest: 'build/angular-touch.js', | |
|
934a95d
petebacondarwin authored
|
||
| 174 | src: util.wrap(files['angularModules']['ngTouch'], 'module') | |
|
707c65d
|
||
| 175 | }, | |
|
79b51d5
geddski authored
|
||
| 176 | mocks: { | |
| 177 | dest: 'build/angular-mocks.js', | |
|
5bd6596
davemo authored
|
||
| 178 | src: util.wrap(files['angularModules']['ngMock'], 'module'), | |
|
79b51d5
geddski authored
|
||
| 179 | strict: false | |
| 180 | }, | |
| 181 | sanitize: { | |
| 182 | dest: 'build/angular-sanitize.js', | |
|
934a95d
petebacondarwin authored
|
||
| 183 | src: util.wrap(files['angularModules']['ngSanitize'], 'module') | |
|
79b51d5
geddski authored
|
||
| 184 | }, | |
| 185 | resource: { | |
| 186 | dest: 'build/angular-resource.js', | |
|
934a95d
petebacondarwin authored
|
||
| 187 | src: util.wrap(files['angularModules']['ngResource'], 'module') | |
|
79b51d5
geddski authored
|
||
| 188 | }, | |
|
81923f1
matsko authored
|
||
| 189 | animate: { | |
| 190 | dest: 'build/angular-animate.js', | |
|
934a95d
petebacondarwin authored
|
||
| 191 | src: util.wrap(files['angularModules']['ngAnimate'], 'module') | |
|
81923f1
matsko authored
|
||
| 192 | }, | |
|
5599b55
IgorMinar authored
|
||
| 193 | route: { | |
| 194 | dest: 'build/angular-route.js', | |
|
934a95d
petebacondarwin authored
|
||
| 195 | src: util.wrap(files['angularModules']['ngRoute'], 'module') | |
|
5599b55
IgorMinar authored
|
||
| 196 | }, | |
|
79b51d5
geddski authored
|
||
| 197 | cookies: { | |
| 198 | dest: 'build/angular-cookies.js', | |
|
934a95d
petebacondarwin authored
|
||
| 199 | src: util.wrap(files['angularModules']['ngCookies'], 'module') | |
|
e848099
jamestalmage authored
|
||
| 200 | }, | |
| 201 | "promises-aplus-adapter": { | |
| 202 | dest:'tmp/promises-aplus-adapter++.js', | |
| 203 | src:['src/ng/q.js','lib/promises-aplus/promises-aplus-test-adapter.js'] | |
|
79b51d5
geddski authored
|
||
| 204 | } | |
| 205 | }, | |
| 206 | ||
| 207 | ||
| 208 | min: { | |
| 209 | angular: 'build/angular.js', | |
|
81923f1
matsko authored
|
||
| 210 | animate: 'build/angular-animate.js', | |
|
79b51d5
geddski authored
|
||
| 211 | cookies: 'build/angular-cookies.js', | |
| 212 | loader: 'build/angular-loader.js', | |
|
94ec84e
btford authored
|
||
| 213 | touch: 'build/angular-touch.js', | |
|
79b51d5
geddski authored
|
||
| 214 | resource: 'build/angular-resource.js', | |
|
5599b55
IgorMinar authored
|
||
| 215 | route: 'build/angular-route.js', | |
|
f56125d
matsko authored
|
||
| 216 | sanitize: 'build/angular-sanitize.js' | |
|
79b51d5
geddski authored
|
||
| 217 | }, | |
| 218 | ||
| 219 | ||
| 220 | docs: { | |
| 221 | process: ['build/docs/*.html', 'build/docs/.htaccess'] | |
| 222 | }, | |
| 223 | ||
|
c317a7b
petebacondarwin authored
|
||
| 224 | "jasmine_node": { | |
| 225 | projectRoot: 'docs/spec' | |
|
71bc1b7
petebacondarwin authored
|
||
| 226 | }, | |
|
79b51d5
geddski authored
|
||
| 227 | ||
|
31631b2
btford authored
|
||
| 228 | "ddescribe-iit": { | |
| 229 | files: [ | |
| 230 | 'test/**/*.js', | |
| 231 | '!test/ngScenario/DescribeSpec.js' | |
| 232 | ] | |
| 233 | }, | |
| 234 | ||
| 235 | "merge-conflict": { | |
| 236 | files: [ | |
| 237 | 'src/**/*', | |
| 238 | 'test/**/*', | |
| 239 | 'docs/**/*', | |
| 240 | 'css/**/*' | |
| 241 | ] | |
| 242 | }, | |
| 243 | ||
|
79b51d5
geddski authored
|
||
| 244 | copy: { | |
| 245 | i18n: { | |
| 246 | files: [ | |
| 247 | { src: 'src/ngLocale/**', dest: 'build/i18n/', expand: true, flatten: true } | |
| 248 | ] | |
| 249 | } | |
| 250 | }, | |
| 251 | ||
| 252 | ||
| 253 | compress: { | |
| 254 | build: { | |
|
79a88ec
IgorMinar authored
|
||
| 255 | options: {archive: 'build/' + dist +'.zip', mode: 'zip'}, | |
|
d38d844
IgorMinar authored
|
||
| 256 | src: ['**'], cwd: 'build', expand: true, dot: true, dest: dist + '/' | |
|
79b51d5
geddski authored
|
||
| 257 | } | |
| 258 | }, | |
| 259 | ||
|
e848099
jamestalmage authored
|
||
| 260 | shell:{ | |
| 261 | "promises-aplus-tests":{ | |
| 262 | options:{ | |
| 263 | //stdout:true, | |
| 264 | stderr:true, | |
| 265 | failOnError:true | |
| 266 | }, | |
|
265f0b5
petebacondarwin authored
|
||
| 267 | command:path.normalize('./node_modules/.bin/promises-aplus-tests tmp/promises-aplus-adapter++.js') | |
|
e848099
jamestalmage authored
|
||
| 268 | } | |
| 269 | }, | |
| 270 | ||
|
79b51d5
geddski authored
|
||
| 271 | ||
| 272 | write: { | |
| 273 | versionTXT: {file: 'build/version.txt', val: NG_VERSION.full}, | |
| 274 | versionJSON: {file: 'build/version.json', val: JSON.stringify(NG_VERSION)} | |
|
8c10db3
tbosch authored
|
||
| 275 | }, | |
| 276 | ||
| 277 | bump: { | |
| 278 | options: { | |
| 279 | files: ['package.json'], | |
| 280 | commit: false, | |
| 281 | createTag: false, | |
| 282 | push: false | |
| 283 | } | |
|
79b51d5
geddski authored
|
||
| 284 | } | |
| 285 | }); | |
| 286 | ||
| 287 | ||
| 288 | //alias tasks | |
|
7aef2d5
juliemr authored
|
||
| 289 | grunt.registerTask('test', 'Run unit, docs and e2e tests with Karma', ['jshint', 'package','test:unit','test:promises-aplus', 'tests:docs', 'test:protractor']); | |
|
953fa4c
matsko authored
|
||
| 290 | grunt.registerTask('test:jqlite', 'Run the unit tests with Karma' , ['tests:jqlite']); | |
| 291 | grunt.registerTask('test:jquery', 'Run the jQuery unit tests with Karma', ['tests:jquery']); | |
| 292 | grunt.registerTask('test:modules', 'Run the Karma module tests with Karma', ['tests:modules']); | |
| 293 | grunt.registerTask('test:docs', 'Run the doc-page tests with Karma', ['package', 'tests:docs']); | |
| 294 | grunt.registerTask('test:unit', 'Run unit, jQuery and Karma module tests with Karma', ['tests:jqlite', 'tests:jquery', 'tests:modules']); | |
|
84467d8
juliemr authored
|
||
| 295 | grunt.registerTask('test:protractor', 'Run the end to end tests with Protractor and keep a test server running in the background', ['webdriver', 'connect:testserver', 'protractor:normal']); | |
|
e645f7c
juliemr authored
|
||
| 296 | grunt.registerTask('test:jq-protractor', 'Run the end to end tests against jquery with Protractor and keep a test server running in the background', ['webdriver', 'connect:testserver', 'protractor:jquery']); | |
|
84467d8
juliemr authored
|
||
| 297 | grunt.registerTask('test:ci-protractor', 'Run the end to end tests with Protractor and keep a test server running in the background', ['webdriver', 'connect:testserver', 'protractor:jenkins']); | |
|
7aef2d5
juliemr authored
|
||
| 298 | grunt.registerTask('test:e2e', 'Alias for test:protractor', ['test:protractor']); | |
|
c317a7b
petebacondarwin authored
|
||
| 299 | grunt.registerTask('test:docgen', ['jasmine_node']); | |
|
e848099
jamestalmage authored
|
||
| 300 | grunt.registerTask('test:promises-aplus',['build:promises-aplus-adapter','shell:promises-aplus-tests']); | |
|
05b41ee
matsko authored
|
||
| 301 | ||
|
aa5a162
ksheedlo authored
|
||
| 302 | grunt.registerTask('minify', ['bower','clean', 'build', 'minall']); | |
|
79b51d5
geddski authored
|
||
| 303 | grunt.registerTask('webserver', ['connect:devserver']); | |
|
aa5a162
ksheedlo authored
|
||
| 304 | grunt.registerTask('package', ['bower','clean', 'buildall', 'minall', 'collect-errors', 'docs', 'copy', 'write', 'compress']); | |
|
7f4edaf
IgorMinar authored
|
||
| 305 | grunt.registerTask('ci-checks', ['ddescribe-iit', 'merge-conflict', 'jshint', 'jscs']); | |
|
79b51d5
geddski authored
|
||
| 306 | grunt.registerTask('default', ['package']); | |
| 307 | }; |