release_task.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. var path = require('path');
  2. module.exports = function(grunt) {
  3. "use strict";
  4. // build then zip
  5. grunt.registerTask('release', [
  6. 'build',
  7. 'build-post-process',
  8. 'compress:release'
  9. ]);
  10. // package into archives
  11. grunt.registerTask('package', [
  12. 'clean:temp',
  13. 'build-post-process',
  14. 'compress:release'
  15. ]);
  16. grunt.registerTask('build-post-process', function() {
  17. grunt.config('copy.public_to_temp', {
  18. expand: true,
  19. cwd: '<%= srcDir %>',
  20. src: '**/*',
  21. dest: '<%= tempDir %>/public/',
  22. });
  23. grunt.config('copy.backend_bin', {
  24. cwd: 'bin/<%= platform %>-<%= arch %>',
  25. expand: true,
  26. src: ['*'],
  27. options: { mode: true},
  28. dest: '<%= tempDir %>/bin/'
  29. });
  30. grunt.config('copy.backend_files', {
  31. expand: true,
  32. src: ['conf/**', 'tools/phantomjs/*', 'scripts/*'],
  33. options: { mode: true},
  34. dest: '<%= tempDir %>'
  35. });
  36. grunt.task.run('copy:public_to_temp');
  37. grunt.task.run('copy:backend_bin');
  38. grunt.task.run('copy:backend_files');
  39. grunt.task.run('clean:packaging');
  40. grunt.file.write(path.join(grunt.config('tempDir'), 'VERSION'), grunt.config('pkg.version'));
  41. });
  42. };