Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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