Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 310 lines (273 sloc) 9.202 kb
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
1 var files = require('./angularFiles').files;
2 var util = require('./lib/grunt/utils.js');
265f0b5 Pete Bacon Darwin fix(build): get promise A+ tests to run on windows
petebacondarwin authored
3 var path = require('path');
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
4
5 module.exports = function(grunt) {
6 //grunt plugins
8c10db3 Tobias Bosch chore(build): automate cutting a release, publishing to bower and to cod...
tbosch authored
7 grunt.loadNpmTasks('grunt-bump');
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
8 grunt.loadNpmTasks('grunt-contrib-clean');
9 grunt.loadNpmTasks('grunt-contrib-copy');
10 grunt.loadNpmTasks('grunt-contrib-connect');
11 grunt.loadNpmTasks('grunt-contrib-compress');
dd7cb15 Jorik Tangelder chore(npm): grunt-contrib-jasmine-node changed name
jtangelder authored
12 grunt.loadNpmTasks('grunt-jasmine-node');
31631b2 Brian Ford chore(build): add check for merge conflicts, ddescribe, and iit
btford authored
13 grunt.loadNpmTasks('grunt-ddescribe-iit');
14 grunt.loadNpmTasks('grunt-merge-conflict');
2c2adbc Vojta Jina chore(travis): speed up the build
vojtajina authored
15 grunt.loadNpmTasks('grunt-parallel');
e848099 James Talmage chore(tests): add Promises/A+ Test Suite to the build
jamestalmage authored
16 grunt.loadNpmTasks('grunt-shell');
934a95d Pete Bacon Darwin chore(grunt): add jshint tasks
petebacondarwin authored
17 grunt.loadNpmTasks('grunt-contrib-jshint');
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
18 grunt.loadTasks('lib/grunt');
19
20 var NG_VERSION = util.getVersion();
8a96393 Dave Geddes chore(Grunt): don't remove root dir from zip
geddski authored
21 var dist = 'angular-'+ NG_VERSION.full;
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
22
23
24 //global beforeEach
25 util.init();
26
27
28 //config
29 grunt.initConfig({
30 NG_VERSION: NG_VERSION,
31
2c2adbc Vojta Jina chore(travis): speed up the build
vojtajina authored
32 parallel: {
33 travis: {
34 tasks: [
e848099 James Talmage chore(tests): add Promises/A+ Test Suite to the build
jamestalmage authored
35 util.parallelTask(['test:unit', 'test:docgen', 'test:promises-aplus', 'tests:docs'], {stream: true}),
7909ebe Vojta Jina chore: run more browsers on Travis (IE8,IE9,IE10,Safari,FF)
vojtajina authored
36 util.parallelTask(['test:e2e'])
2c2adbc Vojta Jina chore(travis): speed up the build
vojtajina authored
37 ]
38 }
39 },
40
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
41 connect: {
42 devserver: {
43 options: {
44 port: 8000,
5fd39e0 Igor Minar chore(Gruntfile): run webserver on 0.0.0.0
IgorMinar authored
45 hostname: '0.0.0.0',
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
46 base: '.',
47 keepalive: true,
48 middleware: function(connect, options){
49 return [
50 //uncomment to enable CSP
51 // util.csp(),
52 util.rewrite(),
53 connect.favicon('images/favicon.ico'),
54 connect.static(options.base),
55 connect.directory(options.base)
56 ];
57 }
58 }
59 },
2c2adbc Vojta Jina chore(travis): speed up the build
vojtajina authored
60 testserver: {
61 options: {
b73c46c Vojta Jina chore: fix Travis build
vojtajina authored
62 // We use end2end task (which does not start the webserver)
63 // and start the webserver as a separate process (in travis_build.sh)
64 // to avoid https://github.com/joyent/libuv/issues/826
65 port: 8000,
66 hostname: '0.0.0.0',
2c2adbc Vojta Jina chore(travis): speed up the build
vojtajina authored
67 middleware: function(connect, options){
68 return [
69 function(req, resp, next) {
70 // cache get requests to speed up tests on travis
71 if (req.method === 'GET') {
72 resp.setHeader('Cache-control', 'public, max-age=3600');
73 }
74
75 next();
76 },
77 connect.favicon('images/favicon.ico'),
78 connect.static(options.base)
79 ];
80 }
81 }
82 }
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
83 },
84
85
05b41ee Matias Niemelä fix(grunt): ensure all dependent tasks are called for all test task
matsko authored
86 tests: {
c2e215f Vojta Jina chore: use Karma
vojtajina authored
87 jqlite: 'karma-jqlite.conf.js',
88 jquery: 'karma-jquery.conf.js',
77c4fc6 Matias Niemelä chore(ngdocs): setup karma-docs testing suite to test docs components
matsko authored
89 docs: 'karma-docs.conf.js',
c2e215f Vojta Jina chore: use Karma
vojtajina authored
90 modules: 'karma-modules.conf.js',
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
91 //NOTE run grunt test:e2e instead and it will start a webserver for you
c2e215f Vojta Jina chore: use Karma
vojtajina authored
92 end2end: 'karma-e2e.conf.js'
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
93 },
94
95
96 autotest: {
c2e215f Vojta Jina chore: use Karma
vojtajina authored
97 jqlite: 'karma-jqlite.conf.js',
63c1e5b Igor Minar chore(grunt): add autotest:modules target
IgorMinar authored
98 jquery: 'karma-jquery.conf.js',
77c4fc6 Matias Niemelä chore(ngdocs): setup karma-docs testing suite to test docs components
matsko authored
99 modules: 'karma-modules.conf.js',
05b41ee Matias Niemelä fix(grunt): ensure all dependent tasks are called for all test task
matsko authored
100 docs: 'karma-docs.conf.js'
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
101 },
102
103
2ed4ad5 Julie Ralph feat(build): add a grunt test for running protractor tests extracted fro...
juliemr authored
104 runprotractor: {
105 normal: 'protractor-conf.js'
106 },
107
108
e848099 James Talmage chore(tests): add Promises/A+ Test Suite to the build
jamestalmage authored
109 clean: {
110 build: ['build'],
111 tmp: ['tmp']
112 },
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
113
934a95d Pete Bacon Darwin chore(grunt): add jshint tasks
petebacondarwin authored
114 jshint: {
05ef1bd chore(grunt): update to latest jshint task
James Brewer authored
115 options: {
116 jshintrc: true,
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 },
130 ngMock: {
131 files: { src: 'src/ngMock/**/*.js' },
132 },
133 ngResource: {
134 files: { src: 'src/ngResource/**/*.js' },
135 },
136 ngRoute: {
137 files: { src: 'src/ngRoute/**/*.js' },
138 },
139 ngSanitize: {
140 files: { src: 'src/ngSanitize/**/*.js' },
141 },
142 ngScenario: {
143 files: { src: 'src/ngScenario/**/*.js' },
144 },
145 ngTouch: {
146 files: { src: 'src/ngTouch/**/*.js' },
147 }
148 },
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
149
150 build: {
151 scenario: {
152 dest: 'build/angular-scenario.js',
153 src: [
576269b Ken Sheedlo fix(bower): update bower usage and resources
ksheedlo authored
154 'bower_components/jquery/jquery.js',
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
155 util.wrap([files['angularSrc'], files['angularScenario']], 'ngScenario/angular')
156 ],
157 styles: {
158 css: ['css/angular.css', 'css/angular-scenario.css']
159 }
160 },
161 angular: {
162 dest: 'build/angular.js',
163 src: util.wrap([files['angularSrc']], 'angular'),
164 styles: {
165 css: ['css/angular.css'],
a86cf20 Tobias Bosch fix: don't inline css in csp mode.
tbosch authored
166 generateCspCssFile: true,
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
167 minify: true
168 }
169 },
170 loader: {
171 dest: 'build/angular-loader.js',
934a95d Pete Bacon Darwin chore(grunt): add jshint tasks
petebacondarwin authored
172 src: util.wrap(files['angularLoader'], 'loader')
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
173 },
94ec84e Brian Ford chore(ngMobile): rename module ngTouch and file to angular-touch.js
btford authored
174 touch: {
175 dest: 'build/angular-touch.js',
934a95d Pete Bacon Darwin chore(grunt): add jshint tasks
petebacondarwin authored
176 src: util.wrap(files['angularModules']['ngTouch'], 'module')
707c65d feat(ngMobile): add ngMobile module with mobile-specific ngClick
Braden Shepherdson authored
177 },
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
178 mocks: {
179 dest: 'build/angular-mocks.js',
5bd6596 David Mosher chore(mocks): wrap angular-mocks.js in closure
davemo authored
180 src: util.wrap(files['angularModules']['ngMock'], 'module'),
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
181 strict: false
182 },
183 sanitize: {
184 dest: 'build/angular-sanitize.js',
934a95d Pete Bacon Darwin chore(grunt): add jshint tasks
petebacondarwin authored
185 src: util.wrap(files['angularModules']['ngSanitize'], 'module')
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
186 },
187 resource: {
188 dest: 'build/angular-resource.js',
934a95d Pete Bacon Darwin chore(grunt): add jshint tasks
petebacondarwin authored
189 src: util.wrap(files['angularModules']['ngResource'], 'module')
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
190 },
81923f1 Matias Niemelä feat(ngAnimate): complete rewrite of animations
matsko authored
191 animate: {
192 dest: 'build/angular-animate.js',
934a95d Pete Bacon Darwin chore(grunt): add jshint tasks
petebacondarwin authored
193 src: util.wrap(files['angularModules']['ngAnimate'], 'module')
81923f1 Matias Niemelä feat(ngAnimate): complete rewrite of animations
matsko authored
194 },
5599b55 Igor Minar refactor($route): pull $route and friends into angular-route.js
IgorMinar authored
195 route: {
196 dest: 'build/angular-route.js',
934a95d Pete Bacon Darwin chore(grunt): add jshint tasks
petebacondarwin authored
197 src: util.wrap(files['angularModules']['ngRoute'], 'module')
5599b55 Igor Minar refactor($route): pull $route and friends into angular-route.js
IgorMinar authored
198 },
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
199 cookies: {
200 dest: 'build/angular-cookies.js',
934a95d Pete Bacon Darwin chore(grunt): add jshint tasks
petebacondarwin authored
201 src: util.wrap(files['angularModules']['ngCookies'], 'module')
e848099 James Talmage chore(tests): add Promises/A+ Test Suite to the build
jamestalmage authored
202 },
203 "promises-aplus-adapter": {
204 dest:'tmp/promises-aplus-adapter++.js',
205 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
206 }
207 },
208
209
210 min: {
211 angular: 'build/angular.js',
81923f1 Matias Niemelä feat(ngAnimate): complete rewrite of animations
matsko authored
212 animate: 'build/angular-animate.js',
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
213 cookies: 'build/angular-cookies.js',
214 loader: 'build/angular-loader.js',
94ec84e Brian Ford chore(ngMobile): rename module ngTouch and file to angular-touch.js
btford authored
215 touch: 'build/angular-touch.js',
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
216 resource: 'build/angular-resource.js',
5599b55 Igor Minar refactor($route): pull $route and friends into angular-route.js
IgorMinar authored
217 route: 'build/angular-route.js',
f56125d Matias Niemelä chore(ngdocs): setup bower as the package manager for the docs pages
matsko authored
218 sanitize: 'build/angular-sanitize.js'
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
219 },
220
221
222 docs: {
223 process: ['build/docs/*.html', 'build/docs/.htaccess']
224 },
225
c317a7b Pete Bacon Darwin chore(grunt): grunt-jasmine-node uses different config
petebacondarwin authored
226 "jasmine_node": {
227 projectRoot: 'docs/spec'
71bc1b7 Pete Bacon Darwin chore(doc_gen): add task to run doc-gen specs
petebacondarwin authored
228 },
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
229
31631b2 Brian Ford chore(build): add check for merge conflicts, ddescribe, and iit
btford authored
230 "ddescribe-iit": {
231 files: [
232 'test/**/*.js',
233 '!test/ngScenario/DescribeSpec.js'
234 ]
235 },
236
237 "merge-conflict": {
238 files: [
239 'src/**/*',
240 'test/**/*',
241 'docs/**/*',
242 'css/**/*'
243 ]
244 },
245
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
246 copy: {
247 i18n: {
248 files: [
249 { src: 'src/ngLocale/**', dest: 'build/i18n/', expand: true, flatten: true }
250 ]
251 }
252 },
253
254
255 compress: {
256 build: {
79a88ec Igor Minar chore(grunt): ensure that grunt uses zip for compression
IgorMinar authored
257 options: {archive: 'build/' + dist +'.zip', mode: 'zip'},
d38d844 Igor Minar chore(Grunt): include dot files in the final zip
IgorMinar authored
258 src: ['**'], cwd: 'build', expand: true, dot: true, dest: dist + '/'
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
259 }
260 },
261
e848099 James Talmage chore(tests): add Promises/A+ Test Suite to the build
jamestalmage authored
262 shell:{
263 "promises-aplus-tests":{
264 options:{
265 //stdout:true,
266 stderr:true,
267 failOnError:true
268 },
265f0b5 Pete Bacon Darwin fix(build): get promise A+ tests to run on windows
petebacondarwin authored
269 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
270 }
271 },
272
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
273
274 write: {
275 versionTXT: {file: 'build/version.txt', val: NG_VERSION.full},
276 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
277 },
278
279 bump: {
280 options: {
281 files: ['package.json'],
282 commit: false,
283 createTag: false,
284 push: false
285 }
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
286 }
287 });
288
289
290 //alias tasks
2ed4ad5 Julie Ralph feat(build): add a grunt test for running protractor tests extracted fro...
juliemr authored
291 grunt.registerTask('test', 'Run unit, docs and e2e tests with Karma', ['jshint', 'package','test:unit','test:promises-aplus', 'tests:docs', 'test:e2e', 'webdriver', 'runprotractor:normal']);
953fa4c Matias Niemelä chore(grunt): fix up the help text for the new test commands
matsko authored
292 grunt.registerTask('test:jqlite', 'Run the unit tests with Karma' , ['tests:jqlite']);
293 grunt.registerTask('test:jquery', 'Run the jQuery unit tests with Karma', ['tests:jquery']);
294 grunt.registerTask('test:modules', 'Run the Karma module tests with Karma', ['tests:modules']);
295 grunt.registerTask('test:docs', 'Run the doc-page tests with Karma', ['package', 'tests:docs']);
296 grunt.registerTask('test:unit', 'Run unit, jQuery and Karma module tests with Karma', ['tests:jqlite', 'tests:jquery', 'tests:modules']);
297 grunt.registerTask('test:e2e', 'Run the end to end tests with Karma and keep a test server running in the background', ['connect:testserver', 'tests:end2end']);
2ed4ad5 Julie Ralph feat(build): add a grunt test for running protractor tests extracted fro...
juliemr authored
298 // This should eventually replace test:e2e
299 grunt.registerTask('test:protractor', 'Run the end to end tests with Protractor and keep a test server running in the background', ['webdriver', 'connect:testserver', 'runprotractor:normal']);
c317a7b Pete Bacon Darwin chore(grunt): grunt-jasmine-node uses different config
petebacondarwin authored
300 grunt.registerTask('test:docgen', ['jasmine_node']);
e848099 James Talmage chore(tests): add Promises/A+ Test Suite to the build
jamestalmage authored
301 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
302
aa5a162 Ken Sheedlo chore(bower): write grunt task for running bower
ksheedlo authored
303 grunt.registerTask('minify', ['bower','clean', 'build', 'minall']);
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
304 grunt.registerTask('webserver', ['connect:devserver']);
aa5a162 Ken Sheedlo chore(bower): write grunt task for running bower
ksheedlo authored
305 grunt.registerTask('package', ['bower','clean', 'buildall', 'minall', 'collect-errors', 'docs', 'copy', 'write', 'compress']);
3379eeb Vojta Jina chore(travis): run bower install twice to make sure it does
vojtajina authored
306 grunt.registerTask('package-without-bower', ['clean', 'buildall', 'minall', 'collect-errors', 'docs', 'copy', 'write', 'compress']);
d5c5e2b Vojta Jina chore: run docs unit test only once
vojtajina authored
307 grunt.registerTask('ci-checks', ['ddescribe-iit', 'merge-conflict', 'jshint']);
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
308 grunt.registerTask('default', ['package']);
309 };
Something went wrong with that request. Please try again.