Gruntfile-publish.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. module.exports = function(grunt) {
  2. 'use strict';
  3. var path = require('path');
  4. var pkg = require('../package');
  5. var proj_namespace = path.join(pkg.description, pkg.name, pkg.version, '/');
  6. var configObj = {
  7. clean: {
  8. svn: [".tmp_svn"]
  9. },
  10. compress: {
  11. zip: {
  12. options:{
  13. archive: 'assets.zip'
  14. },
  15. files: [{
  16. expand: true,
  17. cwd: 'assets/',
  18. src: '**'
  19. }]
  20. }
  21. },
  22. push_svn: {
  23. options: {
  24. message: '初始化项目:' + pkg.name,
  25. username: 'liujianxin',
  26. password: 'g2551',
  27. trymkdir: true
  28. },
  29. assets: {
  30. src: 'dest',
  31. dest: 'http://svn.duowan.com:9999/svn/web/program/assets/' + proj_namespace,
  32. tmp: '.tmp_svn'
  33. }
  34. }
  35. };
  36. // 提交dest到静态文件svn
  37. grunt.task.registerTask('assets', 'commit message', function(arg) {
  38. grunt.config.merge(configObj);
  39. grunt.config.merge({
  40. push_svn:{
  41. options: {
  42. message: arg,
  43. pushIgnore: ['*.html', '.DS_Store', '.idea/**', '.tmp_svn/**', '.svn/**', '.gitignore']
  44. }
  45. }
  46. })
  47. grunt.task.run(['push_svn:assets', 'clean:svn']);
  48. });
  49. };