Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 334 lines (298 sloc) 9.873 kb
36831ec Michał Gołębiowski refactor(jshint): reduce duplication & test all JS files
mzgol authored
1 'use strict';
2
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
3 var files = require('./angularFiles').files;
4 var util = require('./lib/grunt/utils.js');
d1214af Pete Bacon Darwin chore(build): refactor build version information
petebacondarwin authored
5 var versionInfo = require('./lib/versions/version-info');
265f0b5 Pete Bacon Darwin fix(build): get promise A+ tests to run on windows
petebacondarwin authored
6 var path = require('path');
2240c11 ⭐caitp⭐ chore(tests): implement e2e test harness outside of docs app
caitp authored
7 var e2e = require('./test/e2e/tools');
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
8
9 module.exports = function(grunt) {
10 //grunt plugins
e7ac7aa PatrickJS chore(Gruntfile.js, package.json): use load-grunt-tasks and move grunt-c...
gdi2290 authored
11 require('load-grunt-tasks')(grunt);
12
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
13 grunt.loadTasks('lib/grunt');
6bdaa4b Jeff Cross feat(benchpress): configure benchpress grunt task
jeffbcross authored
14 grunt.loadNpmTasks('angular-benchpress');
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
15
d1214af Pete Bacon Darwin chore(build): refactor build version information
petebacondarwin authored
16 var NG_VERSION = versionInfo.currentVersion;
aa249ae Tobias Bosch chore(release): calculate the cdnVersion on every build
tbosch authored
17 NG_VERSION.cdn = versionInfo.cdnVersion;
8a96393 Dave Geddes chore(Grunt): don't remove root dir from zip
geddski authored
18 var dist = 'angular-'+ NG_VERSION.full;
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
19
20 //global beforeEach
21 util.init();
22
23
24 //config
25 grunt.initConfig({
26 NG_VERSION: NG_VERSION,
6bdaa4b Jeff Cross feat(benchpress): configure benchpress grunt task
jeffbcross authored
27 bp_build: {
28 options: {
29 buildPath: 'build/benchmarks',
30 benchmarksPath: 'benchmarks'
31 }
32 },
2c2adbc Vojta Jina chore(travis): speed up the build
vojtajina authored
33
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
34 connect: {
35 devserver: {
36 options: {
37 port: 8000,
5fd39e0 Igor Minar chore(Gruntfile): run webserver on 0.0.0.0
IgorMinar authored
38 hostname: '0.0.0.0',
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
39 base: '.',
40 keepalive: true,
41 middleware: function(connect, options){
7f4d24c Michał Gołębiowski chore(npm): update npm dependencies
mzgol authored
42 var base = Array.isArray(options.base) ? options.base[options.base.length - 1] : options.base;
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
43 return [
b9479ee Tobias Bosch chore(ngCsp): add e2e tests
tbosch authored
44 util.conditionalCsp(),
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
45 util.rewrite(),
2240c11 ⭐caitp⭐ chore(tests): implement e2e test harness outside of docs app
caitp authored
46 e2e.middleware(),
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
47 connect.favicon('images/favicon.ico'),
7f4d24c Michał Gołębiowski chore(npm): update npm dependencies
mzgol authored
48 connect.static(base),
49 connect.directory(base)
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
50 ];
51 }
52 }
53 },
2c2adbc Vojta Jina chore(travis): speed up the build
vojtajina authored
54 testserver: {
55 options: {
b73c46c Vojta Jina chore: fix Travis build
vojtajina authored
56 // We use end2end task (which does not start the webserver)
57 // and start the webserver as a separate process (in travis_build.sh)
58 // to avoid https://github.com/joyent/libuv/issues/826
59 port: 8000,
60 hostname: '0.0.0.0',
2c2adbc Vojta Jina chore(travis): speed up the build
vojtajina authored
61 middleware: function(connect, options){
7f4d24c Michał Gołębiowski chore(npm): update npm dependencies
mzgol authored
62 var base = Array.isArray(options.base) ? options.base[options.base.length - 1] : options.base;
2c2adbc Vojta Jina chore(travis): speed up the build
vojtajina authored
63 return [
64 function(req, resp, next) {
65 // cache get requests to speed up tests on travis
66 if (req.method === 'GET') {
67 resp.setHeader('Cache-control', 'public, max-age=3600');
68 }
69
70 next();
71 },
b9479ee Tobias Bosch chore(ngCsp): add e2e tests
tbosch authored
72 util.conditionalCsp(),
2240c11 ⭐caitp⭐ chore(tests): implement e2e test harness outside of docs app
caitp authored
73 e2e.middleware(),
2c2adbc Vojta Jina chore(travis): speed up the build
vojtajina authored
74 connect.favicon('images/favicon.ico'),
7f4d24c Michał Gołębiowski chore(npm): update npm dependencies
mzgol authored
75 connect.static(base)
2c2adbc Vojta Jina chore(travis): speed up the build
vojtajina authored
76 ];
77 }
78 }
79 }
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
80 },
81
82
05b41ee Matias Niemelä fix(grunt): ensure all dependent tasks are called for all test task
matsko authored
83 tests: {
c2e215f Vojta Jina chore: use Karma
vojtajina authored
84 jqlite: 'karma-jqlite.conf.js',
85 jquery: 'karma-jquery.conf.js',
b72ea59 Pete Bacon Darwin chore(docs-app): re-activate docs-app test tasks
petebacondarwin authored
86 docs: 'karma-docs.conf.js',
7aef2d5 Julie Ralph test(docs): convert example end to end doc tests from scenario runner to...
juliemr authored
87 modules: 'karma-modules.conf.js'
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
88 },
89
90
91 autotest: {
c2e215f Vojta Jina chore: use Karma
vojtajina authored
92 jqlite: 'karma-jqlite.conf.js',
63c1e5b Igor Minar chore(grunt): add autotest:modules target
IgorMinar authored
93 jquery: 'karma-jquery.conf.js',
77c4fc6 Matias Niemelä chore(ngdocs): setup karma-docs testing suite to test docs components
matsko authored
94 modules: 'karma-modules.conf.js',
b72ea59 Pete Bacon Darwin chore(docs-app): re-activate docs-app test tasks
petebacondarwin authored
95 docs: 'karma-docs.conf.js'
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
96 },
97
98
84467d8 Julie Ralph refactor(testing): run end to end tests on separate browsers in parallel
juliemr authored
99 protractor: {
0e85ca9 Julie Ralph chore(testing): run end to end tests on firefox and safari as well as ch...
juliemr authored
100 normal: 'protractor-conf.js',
39c82f3 Julie Ralph chore(travis): reorganize protractor configs to group by spec instead of...
juliemr authored
101 travis: 'protractor-travis-conf.js',
0e85ca9 Julie Ralph chore(testing): run end to end tests on firefox and safari as well as ch...
juliemr authored
102 jenkins: 'protractor-jenkins-conf.js'
2ed4ad5 Julie Ralph feat(build): add a grunt test for running protractor tests extracted fro...
juliemr authored
103 },
104
105
e848099 jamestalmage chore(tests): add Promises/A+ Test Suite to the build
jamestalmage authored
106 clean: {
107 build: ['build'],
108 tmp: ['tmp']
109 },
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
110
934a95d Pete Bacon Darwin chore(grunt): add jshint tasks
petebacondarwin authored
111 jshint: {
05ef1bd chore(grunt): update to latest jshint task
James Brewer authored
112 options: {
113 jshintrc: true,
114 },
36831ec Michał Gołębiowski refactor(jshint): reduce duplication & test all JS files
mzgol authored
115 node: {
116 files: { src: ['*.js', 'lib/**/*.js'] },
117 },
accd35b Shahar Talmi chore(jshint): enforce jshint for tests
shahata authored
118 tests: {
119 files: { src: 'test/**/*.js' },
120 },
934a95d Pete Bacon Darwin chore(grunt): add jshint tasks
petebacondarwin authored
121 ng: {
122 files: { src: files['angularSrc'] },
123 },
124 ngAnimate: {
125 files: { src: 'src/ngAnimate/**/*.js' },
126 },
127 ngCookies: {
128 files: { src: 'src/ngCookies/**/*.js' },
129 },
130 ngLocale: {
131 files: { src: 'src/ngLocale/**/*.js' },
132 },
0f4016c Matias Niemelä feat(NgMessages): introduce the NgMessages module and directives
matsko authored
133 ngMessages: {
134 files: { src: 'src/ngMessages/**/*.js' },
135 },
934a95d Pete Bacon Darwin chore(grunt): add jshint tasks
petebacondarwin authored
136 ngMock: {
137 files: { src: 'src/ngMock/**/*.js' },
138 },
139 ngResource: {
140 files: { src: 'src/ngResource/**/*.js' },
141 },
142 ngRoute: {
143 files: { src: 'src/ngRoute/**/*.js' },
144 },
145 ngSanitize: {
146 files: { src: 'src/ngSanitize/**/*.js' },
147 },
148 ngScenario: {
149 files: { src: 'src/ngScenario/**/*.js' },
150 },
151 ngTouch: {
152 files: { src: 'src/ngTouch/**/*.js' },
d1434c9 arbus feat(ngAria): add an ngAria module to make a11y easier
arbus authored
153 },
154 ngAria: {
155 files: {src: 'src/ngAria/**/*.js'},
934a95d Pete Bacon Darwin chore(grunt): add jshint tasks
petebacondarwin authored
156 }
157 },
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
158
7f4edaf Igor Minar chore(build): add jscs code style check to our build
IgorMinar authored
159 jscs: {
160 src: ['src/**/*.js', 'test/**/*.js'],
161 options: {
162 config: ".jscs.json"
163 }
164 },
165
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
166 build: {
167 scenario: {
168 dest: 'build/angular-scenario.js',
169 src: [
9e7cb3c Michał Gołębiowski feat(jQuery): upgrade to jQuery to 2.1.1
mzgol authored
170 'bower_components/jquery/dist/jquery.js',
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
171 util.wrap([files['angularSrc'], files['angularScenario']], 'ngScenario/angular')
172 ],
173 styles: {
174 css: ['css/angular.css', 'css/angular-scenario.css']
175 }
176 },
177 angular: {
178 dest: 'build/angular.js',
179 src: util.wrap([files['angularSrc']], 'angular'),
180 styles: {
181 css: ['css/angular.css'],
a86cf20 Tobias Bosch fix: don't inline css in csp mode.
tbosch authored
182 generateCspCssFile: true,
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
183 minify: true
184 }
185 },
186 loader: {
187 dest: 'build/angular-loader.js',
934a95d Pete Bacon Darwin chore(grunt): add jshint tasks
petebacondarwin authored
188 src: util.wrap(files['angularLoader'], 'loader')
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
189 },
94ec84e Brian Ford chore(ngMobile): rename module ngTouch and file to angular-touch.js
btford authored
190 touch: {
191 dest: 'build/angular-touch.js',
934a95d Pete Bacon Darwin chore(grunt): add jshint tasks
petebacondarwin authored
192 src: util.wrap(files['angularModules']['ngTouch'], 'module')
707c65d feat(ngMobile): add ngMobile module with mobile-specific ngClick
Braden Shepherdson authored
193 },
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
194 mocks: {
195 dest: 'build/angular-mocks.js',
5bd6596 David Mosher chore(mocks): wrap angular-mocks.js in closure
davemo authored
196 src: util.wrap(files['angularModules']['ngMock'], 'module'),
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
197 strict: false
198 },
199 sanitize: {
200 dest: 'build/angular-sanitize.js',
934a95d Pete Bacon Darwin chore(grunt): add jshint tasks
petebacondarwin authored
201 src: util.wrap(files['angularModules']['ngSanitize'], 'module')
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
202 },
203 resource: {
204 dest: 'build/angular-resource.js',
934a95d Pete Bacon Darwin chore(grunt): add jshint tasks
petebacondarwin authored
205 src: util.wrap(files['angularModules']['ngResource'], 'module')
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
206 },
0f4016c Matias Niemelä feat(NgMessages): introduce the NgMessages module and directives
matsko authored
207 messages: {
208 dest: 'build/angular-messages.js',
209 src: util.wrap(files['angularModules']['ngMessages'], 'module')
210 },
81923f1 Matias Niemelä feat(ngAnimate): complete rewrite of animations
matsko authored
211 animate: {
212 dest: 'build/angular-animate.js',
934a95d Pete Bacon Darwin chore(grunt): add jshint tasks
petebacondarwin authored
213 src: util.wrap(files['angularModules']['ngAnimate'], 'module')
81923f1 Matias Niemelä feat(ngAnimate): complete rewrite of animations
matsko authored
214 },
5599b55 Igor Minar refactor($route): pull $route and friends into angular-route.js
IgorMinar authored
215 route: {
216 dest: 'build/angular-route.js',
934a95d Pete Bacon Darwin chore(grunt): add jshint tasks
petebacondarwin authored
217 src: util.wrap(files['angularModules']['ngRoute'], 'module')
5599b55 Igor Minar refactor($route): pull $route and friends into angular-route.js
IgorMinar authored
218 },
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
219 cookies: {
220 dest: 'build/angular-cookies.js',
934a95d Pete Bacon Darwin chore(grunt): add jshint tasks
petebacondarwin authored
221 src: util.wrap(files['angularModules']['ngCookies'], 'module')
e848099 jamestalmage chore(tests): add Promises/A+ Test Suite to the build
jamestalmage authored
222 },
d1434c9 arbus feat(ngAria): add an ngAria module to make a11y easier
arbus authored
223 aria: {
224 dest: 'build/angular-aria.js',
225 src: util.wrap(files['angularModules']['ngAria'], 'module')
226 },
e848099 jamestalmage chore(tests): add Promises/A+ Test Suite to the build
jamestalmage authored
227 "promises-aplus-adapter": {
228 dest:'tmp/promises-aplus-adapter++.js',
229 src:['src/ng/q.js','lib/promises-aplus/promises-aplus-test-adapter.js']
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
230 }
231 },
232
233
234 min: {
235 angular: 'build/angular.js',
81923f1 Matias Niemelä feat(ngAnimate): complete rewrite of animations
matsko authored
236 animate: 'build/angular-animate.js',
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
237 cookies: 'build/angular-cookies.js',
238 loader: 'build/angular-loader.js',
14f5734 Matias Niemelä chore(Gruntfile): remember to minify ngMessages
matsko authored
239 messages: 'build/angular-messages.js',
94ec84e Brian Ford chore(ngMobile): rename module ngTouch and file to angular-touch.js
btford authored
240 touch: 'build/angular-touch.js',
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
241 resource: 'build/angular-resource.js',
5599b55 Igor Minar refactor($route): pull $route and friends into angular-route.js
IgorMinar authored
242 route: 'build/angular-route.js',
d1434c9 arbus feat(ngAria): add an ngAria module to make a11y easier
arbus authored
243 sanitize: 'build/angular-sanitize.js',
244 aria: 'build/angular-aria.js'
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
245 },
246
247
31631b2 Brian Ford chore(build): add check for merge conflicts, ddescribe, and iit
btford authored
248 "ddescribe-iit": {
249 files: [
e9fad96 Julie Ralph chore(grunt): check files in src for ddescribe/iit
juliemr authored
250 'src/**/*.js',
31631b2 Brian Ford chore(build): add check for merge conflicts, ddescribe, and iit
btford authored
251 'test/**/*.js',
e9fad96 Julie Ralph chore(grunt): check files in src for ddescribe/iit
juliemr authored
252 '!test/ngScenario/DescribeSpec.js',
d9b90d7 Matias Niemelä feat(attrs): trigger observers for specific ng-attributes
matsko authored
253 '!src/ng/directive/attrs.js', // legitimate xit here
e9fad96 Julie Ralph chore(grunt): check files in src for ddescribe/iit
juliemr authored
254 '!src/ngScenario/**/*.js'
31631b2 Brian Ford chore(build): add check for merge conflicts, ddescribe, and iit
btford authored
255 ]
256 },
257
258 "merge-conflict": {
259 files: [
260 'src/**/*',
261 'test/**/*',
262 'docs/**/*',
263 'css/**/*'
264 ]
265 },
266
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
267 copy: {
268 i18n: {
269 files: [
270 { src: 'src/ngLocale/**', dest: 'build/i18n/', expand: true, flatten: true }
271 ]
272 }
273 },
274
275
276 compress: {
277 build: {
79a88ec Igor Minar chore(grunt): ensure that grunt uses zip for compression
IgorMinar authored
278 options: {archive: 'build/' + dist +'.zip', mode: 'zip'},
36831ec Michał Gołębiowski refactor(jshint): reduce duplication & test all JS files
mzgol authored
279 src: ['**'],
280 cwd: 'build',
281 expand: true,
282 dot: true,
283 dest: dist + '/'
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
284 }
285 },
286
7f4d24c Michał Gołębiowski chore(npm): update npm dependencies
mzgol authored
287 shell: {
288 "promises-aplus-tests": {
289 options: {
290 stdout: false,
291 stderr: true,
292 failOnError: true
e848099 jamestalmage chore(tests): add Promises/A+ Test Suite to the build
jamestalmage authored
293 },
7f4d24c Michał Gołębiowski chore(npm): update npm dependencies
mzgol authored
294 command: path.normalize('./node_modules/.bin/promises-aplus-tests tmp/promises-aplus-adapter++.js')
e848099 jamestalmage chore(tests): add Promises/A+ Test Suite to the build
jamestalmage authored
295 }
296 },
297
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
298
299 write: {
300 versionTXT: {file: 'build/version.txt', val: NG_VERSION.full},
301 versionJSON: {file: 'build/version.json', val: JSON.stringify(NG_VERSION)}
8c10db3 Tobias Bosch chore(build): automate cutting a release, publishing to bower and to cod...
tbosch authored
302 },
303
304 bump: {
305 options: {
306 files: ['package.json'],
307 commit: false,
308 createTag: false,
309 push: false
310 }
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
311 }
312 });
313
314
315 //alias tasks
2a4f92e Pete Bacon Darwin chore(grunt): add jscs task to test task
petebacondarwin authored
316 grunt.registerTask('test', 'Run unit, docs and e2e tests with Karma', ['jshint', 'jscs', 'package','test:unit','test:promises-aplus', 'tests:docs', 'test:protractor']);
953fa4c Matias Niemelä chore(grunt): fix up the help text for the new test commands
matsko authored
317 grunt.registerTask('test:jqlite', 'Run the unit tests with Karma' , ['tests:jqlite']);
318 grunt.registerTask('test:jquery', 'Run the jQuery unit tests with Karma', ['tests:jquery']);
9f7c5ce Vibhuti chore(gruntFile): ensure build is run before test:modules
Vibhuti authored
319 grunt.registerTask('test:modules', 'Run the Karma module tests with Karma', ['build', 'tests:modules']);
b72ea59 Pete Bacon Darwin chore(docs-app): re-activate docs-app test tasks
petebacondarwin authored
320 grunt.registerTask('test:docs', 'Run the doc-page tests with Karma', ['package', 'tests:docs']);
9f7c5ce Vibhuti chore(gruntFile): ensure build is run before test:modules
Vibhuti authored
321 grunt.registerTask('test:unit', 'Run unit, jQuery and Karma module tests with Karma', ['test:jqlite', 'test:jquery', 'test:modules']);
84467d8 Julie Ralph refactor(testing): run end to end tests on separate browsers in parallel
juliemr authored
322 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 Julie Ralph chore(travis): reorganize protractor configs to group by spec instead of...
juliemr authored
323 grunt.registerTask('test:travis-protractor', 'Run the end to end tests with Protractor for Travis CI builds', ['connect:testserver', 'protractor:travis']);
324 grunt.registerTask('test:ci-protractor', 'Run the end to end tests with Protractor for Jenkins CI builds', ['webdriver', 'connect:testserver', 'protractor:jenkins']);
7aef2d5 Julie Ralph test(docs): convert example end to end doc tests from scenario runner to...
juliemr authored
325 grunt.registerTask('test:e2e', 'Alias for test:protractor', ['test:protractor']);
e848099 jamestalmage chore(tests): add Promises/A+ Test Suite to the build
jamestalmage authored
326 grunt.registerTask('test:promises-aplus',['build:promises-aplus-adapter','shell:promises-aplus-tests']);
05b41ee Matias Niemelä fix(grunt): ensure all dependent tasks are called for all test task
matsko authored
327
aa5a162 Ken Sheedlo chore(bower): write grunt task for running bower
ksheedlo authored
328 grunt.registerTask('minify', ['bower','clean', 'build', 'minall']);
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
329 grunt.registerTask('webserver', ['connect:devserver']);
aa5a162 Ken Sheedlo chore(bower): write grunt task for running bower
ksheedlo authored
330 grunt.registerTask('package', ['bower','clean', 'buildall', 'minall', 'collect-errors', 'docs', 'copy', 'write', 'compress']);
7f4edaf Igor Minar chore(build): add jscs code style check to our build
IgorMinar authored
331 grunt.registerTask('ci-checks', ['ddescribe-iit', 'merge-conflict', 'jshint', 'jscs']);
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
332 grunt.registerTask('default', ['package']);
333 };
Something went wrong with that request. Please try again.