Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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