Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 293 lines (259 sloc) 8.692 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: {
05ef1bd chore(grunt): update to latest jshint task
James Brewer authored
109 options: {
110 jshintrc: true,
111 },
934a95d Pete Bacon Darwin chore(grunt): add jshint tasks
petebacondarwin authored
112 ng: {
113 files: { src: files['angularSrc'] },
114 },
115 ngAnimate: {
116 files: { src: 'src/ngAnimate/**/*.js' },
117 },
118 ngCookies: {
119 files: { src: 'src/ngCookies/**/*.js' },
120 },
121 ngLocale: {
122 files: { src: 'src/ngLocale/**/*.js' },
123 },
124 ngMock: {
125 files: { src: 'src/ngMock/**/*.js' },
126 },
127 ngResource: {
128 files: { src: 'src/ngResource/**/*.js' },
129 },
130 ngRoute: {
131 files: { src: 'src/ngRoute/**/*.js' },
132 },
133 ngSanitize: {
134 files: { src: 'src/ngSanitize/**/*.js' },
135 },
136 ngScenario: {
137 files: { src: 'src/ngScenario/**/*.js' },
138 },
139 ngTouch: {
140 files: { src: 'src/ngTouch/**/*.js' },
141 }
142 },
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
143
144 build: {
145 scenario: {
146 dest: 'build/angular-scenario.js',
147 src: [
576269b Ken Sheedlo fix(bower): update bower usage and resources
ksheedlo authored
148 'bower_components/jquery/jquery.js',
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
149 util.wrap([files['angularSrc'], files['angularScenario']], 'ngScenario/angular')
150 ],
151 styles: {
152 css: ['css/angular.css', 'css/angular-scenario.css']
153 }
154 },
155 angular: {
156 dest: 'build/angular.js',
157 src: util.wrap([files['angularSrc']], 'angular'),
158 styles: {
159 css: ['css/angular.css'],
a86cf20 Tobias Bosch fix: don't inline css in csp mode.
tbosch authored
160 generateCspCssFile: true,
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
161 minify: true
162 }
163 },
164 loader: {
165 dest: 'build/angular-loader.js',
934a95d Pete Bacon Darwin chore(grunt): add jshint tasks
petebacondarwin authored
166 src: util.wrap(files['angularLoader'], 'loader')
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
167 },
94ec84e Brian Ford chore(ngMobile): rename module ngTouch and file to angular-touch.js
btford authored
168 touch: {
169 dest: 'build/angular-touch.js',
934a95d Pete Bacon Darwin chore(grunt): add jshint tasks
petebacondarwin authored
170 src: util.wrap(files['angularModules']['ngTouch'], 'module')
707c65d feat(ngMobile): add ngMobile module with mobile-specific ngClick
Braden Shepherdson authored
171 },
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
172 mocks: {
173 dest: 'build/angular-mocks.js',
5bd6596 David Mosher chore(mocks): wrap angular-mocks.js in closure
davemo authored
174 src: util.wrap(files['angularModules']['ngMock'], 'module'),
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
175 strict: false
176 },
177 sanitize: {
178 dest: 'build/angular-sanitize.js',
934a95d Pete Bacon Darwin chore(grunt): add jshint tasks
petebacondarwin authored
179 src: util.wrap(files['angularModules']['ngSanitize'], 'module')
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
180 },
181 resource: {
182 dest: 'build/angular-resource.js',
934a95d Pete Bacon Darwin chore(grunt): add jshint tasks
petebacondarwin authored
183 src: util.wrap(files['angularModules']['ngResource'], 'module')
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
184 },
81923f1 Matias Niemelä feat(ngAnimate): complete rewrite of animations
matsko authored
185 animate: {
186 dest: 'build/angular-animate.js',
934a95d Pete Bacon Darwin chore(grunt): add jshint tasks
petebacondarwin authored
187 src: util.wrap(files['angularModules']['ngAnimate'], 'module')
81923f1 Matias Niemelä feat(ngAnimate): complete rewrite of animations
matsko authored
188 },
5599b55 Igor Minar refactor($route): pull $route and friends into angular-route.js
IgorMinar authored
189 route: {
190 dest: 'build/angular-route.js',
934a95d Pete Bacon Darwin chore(grunt): add jshint tasks
petebacondarwin authored
191 src: util.wrap(files['angularModules']['ngRoute'], 'module')
5599b55 Igor Minar refactor($route): pull $route and friends into angular-route.js
IgorMinar authored
192 },
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
193 cookies: {
194 dest: 'build/angular-cookies.js',
934a95d Pete Bacon Darwin chore(grunt): add jshint tasks
petebacondarwin authored
195 src: util.wrap(files['angularModules']['ngCookies'], 'module')
e848099 James Talmage chore(tests): add Promises/A+ Test Suite to the build
jamestalmage authored
196 },
197 "promises-aplus-adapter": {
198 dest:'tmp/promises-aplus-adapter++.js',
199 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
200 }
201 },
202
203
204 min: {
205 angular: 'build/angular.js',
81923f1 Matias Niemelä feat(ngAnimate): complete rewrite of animations
matsko authored
206 animate: 'build/angular-animate.js',
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
207 cookies: 'build/angular-cookies.js',
208 loader: 'build/angular-loader.js',
94ec84e Brian Ford chore(ngMobile): rename module ngTouch and file to angular-touch.js
btford authored
209 touch: 'build/angular-touch.js',
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
210 resource: 'build/angular-resource.js',
5599b55 Igor Minar refactor($route): pull $route and friends into angular-route.js
IgorMinar authored
211 route: 'build/angular-route.js',
f56125d Matias Niemelä chore(ngdocs): setup bower as the package manager for the docs pages
matsko authored
212 sanitize: 'build/angular-sanitize.js'
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
213 },
214
215
216 docs: {
217 process: ['build/docs/*.html', 'build/docs/.htaccess']
218 },
219
c317a7b Pete Bacon Darwin chore(grunt): grunt-jasmine-node uses different config
petebacondarwin authored
220 "jasmine_node": {
221 projectRoot: 'docs/spec'
71bc1b7 Pete Bacon Darwin chore(doc_gen): add task to run doc-gen specs
petebacondarwin authored
222 },
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
223
31631b2 Brian Ford chore(build): add check for merge conflicts, ddescribe, and iit
btford authored
224 "ddescribe-iit": {
225 files: [
226 'test/**/*.js',
227 '!test/ngScenario/DescribeSpec.js'
228 ]
229 },
230
231 "merge-conflict": {
232 files: [
233 'src/**/*',
234 'test/**/*',
235 'docs/**/*',
236 'css/**/*'
237 ]
238 },
239
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
240 copy: {
241 i18n: {
242 files: [
243 { src: 'src/ngLocale/**', dest: 'build/i18n/', expand: true, flatten: true }
244 ]
245 }
246 },
247
248
249 compress: {
250 build: {
79a88ec Igor Minar chore(grunt): ensure that grunt uses zip for compression
IgorMinar authored
251 options: {archive: 'build/' + dist +'.zip', mode: 'zip'},
d38d844 Igor Minar chore(Grunt): include dot files in the final zip
IgorMinar authored
252 src: ['**'], cwd: 'build', expand: true, dot: true, dest: dist + '/'
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
253 }
254 },
255
e848099 James Talmage chore(tests): add Promises/A+ Test Suite to the build
jamestalmage authored
256 shell:{
257 "promises-aplus-tests":{
258 options:{
259 //stdout:true,
260 stderr:true,
261 failOnError:true
262 },
265f0b5 Pete Bacon Darwin fix(build): get promise A+ tests to run on windows
petebacondarwin authored
263 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
264 }
265 },
266
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
267
268 write: {
269 versionTXT: {file: 'build/version.txt', val: NG_VERSION.full},
270 versionJSON: {file: 'build/version.json', val: JSON.stringify(NG_VERSION)}
271 }
272 });
273
274
275 //alias tasks
3e79c9b Pete Bacon Darwin chore(grunt): add jshint to the test task
petebacondarwin authored
276 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
277 grunt.registerTask('test:jqlite', 'Run the unit tests with Karma' , ['tests:jqlite']);
278 grunt.registerTask('test:jquery', 'Run the jQuery unit tests with Karma', ['tests:jquery']);
279 grunt.registerTask('test:modules', 'Run the Karma module tests with Karma', ['tests:modules']);
280 grunt.registerTask('test:docs', 'Run the doc-page tests with Karma', ['package', 'tests:docs']);
281 grunt.registerTask('test:unit', 'Run unit, jQuery and Karma module tests with Karma', ['tests:jqlite', 'tests:jquery', 'tests:modules']);
282 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
283 grunt.registerTask('test:docgen', ['jasmine_node']);
e848099 James Talmage chore(tests): add Promises/A+ Test Suite to the build
jamestalmage authored
284 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
285
aa5a162 Ken Sheedlo chore(bower): write grunt task for running bower
ksheedlo authored
286 grunt.registerTask('minify', ['bower','clean', 'build', 'minall']);
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
287 grunt.registerTask('webserver', ['connect:devserver']);
aa5a162 Ken Sheedlo chore(bower): write grunt task for running bower
ksheedlo authored
288 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
289 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
290 grunt.registerTask('ci-checks', ['ddescribe-iit', 'merge-conflict', 'jshint', 'test:docgen']);
79b51d5 Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
291 grunt.registerTask('default', ['package']);
292 };
Something went wrong with that request. Please try again.