Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 229 lines (196 sloc) 6.174 kb
7a77fda 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');
3
4 module.exports = function(grunt) {
5 //grunt plugins
6 grunt.loadNpmTasks('grunt-contrib-clean');
7 grunt.loadNpmTasks('grunt-contrib-copy');
8 grunt.loadNpmTasks('grunt-contrib-connect');
9 grunt.loadNpmTasks('grunt-contrib-compress');
93d7e60 Brian Ford chore(build): add check for merge conflicts, ddescribe, and iit
btford authored
10 grunt.loadNpmTasks('grunt-ddescribe-iit');
11 grunt.loadNpmTasks('grunt-merge-conflict');
52519d4 Vojta Jina chore(travis): speed up the build
vojtajina authored
12 grunt.loadNpmTasks('grunt-parallel');
7a77fda Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
13 grunt.loadTasks('lib/grunt');
14
15 var NG_VERSION = util.getVersion();
ce53fbd Dave Geddes chore(Grunt): don't remove root dir from zip
geddski authored
16 var dist = 'angular-'+ NG_VERSION.full;
7a77fda Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
17
18
19 //global beforeEach
20 util.init();
21
22
23 //config
24 grunt.initConfig({
25 NG_VERSION: NG_VERSION,
26
52519d4 Vojta Jina chore(travis): speed up the build
vojtajina authored
27 parallel: {
28 travis: {
29 options: {
30 stream: true,
31 },
32 tasks: [
33 util.parallelTask('test:modules'),
34 util.parallelTask('test:jquery'),
35 util.parallelTask('test:jqlite'),
36 util.parallelTask('test:e2e')
37 ]
38 }
39 },
40
7a77fda Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
41 connect: {
42 devserver: {
43 options: {
44 port: 8000,
5727eaf Igor Minar chore(Gruntfile): run webserver on 0.0.0.0
IgorMinar authored
45 hostname: '0.0.0.0',
7a77fda 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 },
52519d4 Vojta Jina chore(travis): speed up the build
vojtajina authored
60 testserver: {
61 options: {
4656e38 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',
52519d4 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 }
7a77fda Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
83 },
84
85
86 test: {
91fa865 Vojta Jina chore: use Karma
vojtajina authored
87 jqlite: 'karma-jqlite.conf.js',
88 jquery: 'karma-jquery.conf.js',
89 modules: 'karma-modules.conf.js',
7a77fda 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
91fa865 Vojta Jina chore: use Karma
vojtajina authored
91 end2end: 'karma-e2e.conf.js'
7a77fda Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
92 },
93
94
95 autotest: {
91fa865 Vojta Jina chore: use Karma
vojtajina authored
96 jqlite: 'karma-jqlite.conf.js',
97 jquery: 'karma-jquery.conf.js'
7a77fda Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
98 },
99
100
101 clean: {build: ['build']},
102
103
104 build: {
105 scenario: {
106 dest: 'build/angular-scenario.js',
107 src: [
108 'lib/jquery/jquery.js',
109 util.wrap([files['angularSrc'], files['angularScenario']], 'ngScenario/angular')
110 ],
111 styles: {
112 css: ['css/angular.css', 'css/angular-scenario.css']
113 }
114 },
115 angular: {
116 dest: 'build/angular.js',
117 src: util.wrap([files['angularSrc']], 'angular'),
118 styles: {
119 css: ['css/angular.css'],
120 minify: true
121 }
122 },
123 loader: {
124 dest: 'build/angular-loader.js',
125 src: util.wrap(['src/loader.js'], 'loader')
126 },
127 mocks: {
128 dest: 'build/angular-mocks.js',
129 src: ['src/ngMock/angular-mocks.js'],
130 strict: false
131 },
132 sanitize: {
133 dest: 'build/angular-sanitize.js',
134 src: util.wrap([
135 'src/ngSanitize/sanitize.js',
136 'src/ngSanitize/directive/ngBindHtml.js',
137 'src/ngSanitize/filter/linky.js',
138 ], 'module')
139 },
140 resource: {
141 dest: 'build/angular-resource.js',
142 src: util.wrap(['src/ngResource/resource.js'], 'module')
143 },
144 cookies: {
145 dest: 'build/angular-cookies.js',
146 src: util.wrap(['src/ngCookies/cookies.js'], 'module')
147 },
148 bootstrap: {
149 dest: 'build/angular-bootstrap.js',
150 src: util.wrap(['src/bootstrap/bootstrap.js'], 'module')
151 },
152 bootstrapPrettify: {
153 dest: 'build/angular-bootstrap-prettify.js',
154 src: util.wrap(['src/bootstrap/bootstrap-prettify.js', 'src/bootstrap/google-prettify/prettify.js'], 'module'),
155 styles: {
156 css: ['src/bootstrap/google-prettify/prettify.css'],
157 minify: true
158 }
159 }
160 },
161
162
163 min: {
164 angular: 'build/angular.js',
165 cookies: 'build/angular-cookies.js',
166 loader: 'build/angular-loader.js',
167 resource: 'build/angular-resource.js',
168 sanitize: 'build/angular-sanitize.js',
169 bootstrap: 'build/angular-bootstrap.js',
170 bootstrapPrettify: 'build/angular-bootstrap-prettify.js',
171 },
172
173
174 docs: {
175 process: ['build/docs/*.html', 'build/docs/.htaccess']
176 },
177
178
93d7e60 Brian Ford chore(build): add check for merge conflicts, ddescribe, and iit
btford authored
179 "ddescribe-iit": {
180 files: [
181 'test/**/*.js',
182 '!test/ngScenario/DescribeSpec.js'
183 ]
184 },
185
186 "merge-conflict": {
187 files: [
188 'src/**/*',
189 'test/**/*',
190 'docs/**/*',
191 'css/**/*'
192 ]
193 },
194
195
7a77fda Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
196 copy: {
197 i18n: {
198 files: [
199 { src: 'src/ngLocale/**', dest: 'build/i18n/', expand: true, flatten: true }
200 ]
201 }
202 },
203
204
205 compress: {
206 build: {
e87fb8a Igor Minar chore(grunt): ensure that grunt uses zip for compression
IgorMinar authored
207 options: {archive: 'build/' + dist +'.zip', mode: 'zip'},
4816f7e Igor Minar chore(Grunt): include dot files in the final zip
IgorMinar authored
208 src: ['**'], cwd: 'build', expand: true, dot: true, dest: dist + '/'
7a77fda Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
209 }
210 },
211
212
213 write: {
214 versionTXT: {file: 'build/version.txt', val: NG_VERSION.full},
215 versionJSON: {file: 'build/version.json', val: JSON.stringify(NG_VERSION)}
216 }
217 });
218
219
220 //alias tasks
221 grunt.registerTask('test:unit', ['test:jqlite', 'test:jquery', 'test:modules']);
222 grunt.registerTask('minify', ['clean', 'build', 'minall']);
223 grunt.registerTask('test:e2e', ['connect:testserver', 'test:end2end']);
224 grunt.registerTask('webserver', ['connect:devserver']);
225 grunt.registerTask('package', ['clean', 'buildall', 'minall', 'docs', 'copy', 'write', 'compress']);
93d7e60 Brian Ford chore(build): add check for merge conflicts, ddescribe, and iit
btford authored
226 grunt.registerTask('ci-checks', ['ddescribe-iit', 'merge-conflict']);
7a77fda Dave Geddes chore(Grunt): switch from Rake to Grunt
geddski authored
227 grunt.registerTask('default', ['package']);
228 };
Something went wrong with that request. Please try again.