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