| 
									
										
										
										
											2013-11-15 07:07:14 +08:00
										 |  |  | module.exports = function(grunt) { | 
					
						
							| 
									
										
										
										
											2015-01-05 00:51:48 +08:00
										 |  |  |   "use strict"; | 
					
						
							| 
									
										
										
										
											2013-11-15 07:07:14 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   // Concat and Minify the src directory into dist
 | 
					
						
							|  |  |  |   grunt.registerTask('build', [ | 
					
						
							|  |  |  |     'jshint:source', | 
					
						
							| 
									
										
										
										
											2014-04-06 16:47:14 +08:00
										 |  |  |     'jshint:tests', | 
					
						
							| 
									
										
										
										
											2015-03-03 17:20:52 +08:00
										 |  |  |     'jscs', | 
					
						
							| 
									
										
										
										
											2015-09-12 17:49:14 +08:00
										 |  |  |     'tslint', | 
					
						
							| 
									
										
										
										
											2015-09-10 18:42:24 +08:00
										 |  |  |     'clean:release', | 
					
						
							|  |  |  |     'copy:public_to_gen', | 
					
						
							| 
									
										
										
										
											2015-09-10 17:26:40 +08:00
										 |  |  |     'typescript:build', | 
					
						
							|  |  |  |     'karma:test', | 
					
						
							| 
									
										
										
										
											2015-09-25 07:19:49 +08:00
										 |  |  |     'phantomjs', | 
					
						
							| 
									
										
										
										
											2015-09-10 17:26:40 +08:00
										 |  |  |     'css', | 
					
						
							| 
									
										
										
										
											2013-11-15 07:07:14 +08:00
										 |  |  |     'htmlmin:build', | 
					
						
							| 
									
										
										
										
											2014-06-01 22:57:59 +08:00
										 |  |  |     'ngtemplates', | 
					
						
							| 
									
										
										
										
											2013-11-15 07:07:14 +08:00
										 |  |  |     'cssmin:build', | 
					
						
							| 
									
										
										
										
											2015-02-03 20:36:04 +08:00
										 |  |  |     'ngAnnotate:build', | 
					
						
							| 
									
										
										
										
											2015-09-10 22:47:38 +08:00
										 |  |  |     'requirejs:build', | 
					
						
							|  |  |  |     'concat:js', | 
					
						
							|  |  |  |     'clean:temp', | 
					
						
							|  |  |  |     'filerev', | 
					
						
							|  |  |  |     'remapFilerev', | 
					
						
							|  |  |  |     'usemin', | 
					
						
							|  |  |  |     'uglify:genDir' | 
					
						
							| 
									
										
										
										
											2013-11-15 07:07:14 +08:00
										 |  |  |   ]); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-13 18:11:31 +08:00
										 |  |  |   // task to add [[.AppSubUrl]] to reved path
 | 
					
						
							| 
									
										
										
										
											2015-09-10 18:42:24 +08:00
										 |  |  |   grunt.registerTask('remapFilerev', function() { | 
					
						
							|  |  |  |     var root = grunt.config().genDir; | 
					
						
							| 
									
										
										
										
											2015-03-13 18:11:31 +08:00
										 |  |  |     var summary = grunt.filerev.summary; | 
					
						
							|  |  |  |     var fixed = {}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     for(var key in summary){ | 
					
						
							|  |  |  |       if(summary.hasOwnProperty(key)){ | 
					
						
							|  |  |  |         var orig = key.replace(root, root+'/[[.AppSubUrl]]'); | 
					
						
							|  |  |  |         var revved = summary[key].replace(root, root+'/[[.AppSubUrl]]'); | 
					
						
							|  |  |  |         fixed[orig] = revved; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     grunt.filerev.summary = fixed; | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-01 22:28:28 +08:00
										 |  |  |   grunt.registerTask('build-post-process', function() { | 
					
						
							| 
									
										
										
										
											2015-09-10 19:34:32 +08:00
										 |  |  |     grunt.config('copy.public_gen_to_temp', { | 
					
						
							| 
									
										
										
										
											2015-03-03 17:18:24 +08:00
										 |  |  |       expand: true, | 
					
						
							| 
									
										
										
										
											2015-09-10 18:42:24 +08:00
										 |  |  |       cwd: '<%= genDir %>', | 
					
						
							| 
									
										
										
										
											2015-03-03 17:18:24 +08:00
										 |  |  |       src: '**/*', | 
					
						
							| 
									
										
										
										
											2015-09-10 19:34:32 +08:00
										 |  |  |       dest: '<%= tempDir %>/public/', | 
					
						
							| 
									
										
										
										
											2015-03-03 17:18:24 +08:00
										 |  |  |     }); | 
					
						
							|  |  |  |     grunt.config('copy.backend_bin', { | 
					
						
							|  |  |  |       cwd: 'bin', | 
					
						
							|  |  |  |       expand: true, | 
					
						
							| 
									
										
										
										
											2015-04-20 14:10:23 +08:00
										 |  |  |       src: ['*'], | 
					
						
							| 
									
										
										
										
											2015-03-03 17:18:24 +08:00
										 |  |  |       options: { mode: true}, | 
					
						
							| 
									
										
										
										
											2015-09-10 19:34:32 +08:00
										 |  |  |       dest: '<%= tempDir %>/bin/' | 
					
						
							| 
									
										
										
										
											2013-11-15 07:07:14 +08:00
										 |  |  |     }); | 
					
						
							| 
									
										
										
										
											2015-03-03 17:18:24 +08:00
										 |  |  |     grunt.config('copy.backend_files', { | 
					
						
							|  |  |  |       expand: true, | 
					
						
							| 
									
										
										
										
											2015-03-03 17:20:52 +08:00
										 |  |  |       src: ['conf/defaults.ini', 'conf/sample.ini', 'vendor/**/*', 'scripts/*'], | 
					
						
							| 
									
										
										
										
											2015-03-03 17:18:24 +08:00
										 |  |  |       options: { mode: true}, | 
					
						
							| 
									
										
										
										
											2015-09-10 19:34:32 +08:00
										 |  |  |       dest: '<%= tempDir %>' | 
					
						
							| 
									
										
										
										
											2015-03-03 17:18:24 +08:00
										 |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-10 19:34:32 +08:00
										 |  |  |     grunt.task.run('copy:public_gen_to_temp'); | 
					
						
							| 
									
										
										
										
											2015-03-03 17:18:24 +08:00
										 |  |  |     grunt.task.run('copy:backend_bin'); | 
					
						
							|  |  |  |     grunt.task.run('copy:backend_files'); | 
					
						
							| 
									
										
										
										
											2013-11-15 07:07:14 +08:00
										 |  |  |   }); | 
					
						
							| 
									
										
										
										
											2014-06-09 22:59:53 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-31 15:22:49 +08:00
										 |  |  | }; |