2017-03-23 18:09:35 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								var path = require('path');
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											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-10 18:42:24 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    'clean:release',
							 | 
						
					
						
							
								
									
										
										
										
											2016-02-12 16:58:00 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    'copy:node_modules',
							 | 
						
					
						
							
								
									
										
										
										
											2015-09-10 18:42:24 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    'copy:public_to_gen',
							 | 
						
					
						
							
								
									
										
										
										
											2017-04-20 17:27:12 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    'exec:tslint',
							 | 
						
					
						
							
								
									
										
										
										
											2016-12-10 17:00:58 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    'exec:tscompile',
							 | 
						
					
						
							
								
									
										
										
										
											2016-01-20 20:28:10 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    'karma:test',
							 | 
						
					
						
							
								
									
										
										
										
											2015-09-25 07:19:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    'phantomjs',
							 | 
						
					
						
							
								
									
										
										
										
											2015-09-10 17:26:40 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    'css',
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-21 17:02:39 +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-12-21 17:02:39 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    'systemjs:build',
							 | 
						
					
						
							
								
									
										
										
										
											2015-09-10 22:47:38 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    'concat:js',
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-21 23:34:18 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    'filerev',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    'remapFilerev',
							 | 
						
					
						
							
								
									
										
										
										
											2015-09-10 22:47:38 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    'usemin',
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-21 23:34:18 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    '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)){
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-03 01:22:47 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        var orig = key.replace(root, root+'/[[.AppSubUrl]]/public');
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        var revved = summary[key].replace(root, root+'/[[.AppSubUrl]]/public');
							 | 
						
					
						
							
								
									
										
										
										
											2015-03-13 18:11:31 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        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,
							 | 
						
					
						
							
								
									
										
										
										
											2017-01-30 15:08:37 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      src: ['conf/*', 'vendor/phantomjs/*', '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');
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-23 18:09:35 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    grunt.file.write(path.join(grunt.config('tempDir'), 'VERSION'), grunt.config('pkg.version'));
							 | 
						
					
						
							
								
									
										
										
										
											2013-11-15 07:07:14 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  });
							 | 
						
					
						
							
								
									
										
										
										
											2014-06-09 22:59:53 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2014-05-31 15:22:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								};
							 |