Açıklama Yok

bump_version.js 2.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. module.exports = function (grunt) {
  2. grunt.registerTask('bump_version', function (version) {
  3. if (!version || version.split('.').length !== 3) {
  4. grunt.fail.fatal('malformed version. Use\n\n grunt bump_version:1.2.3');
  5. }
  6. grunt.config('string-replace.bootstrap-datetimepicker-js', {
  7. files: {'src/js/bootstrap-datetimepicker.js': 'src/js/bootstrap-datetimepicker.js'},
  8. options: {
  9. replacements: [
  10. {
  11. pattern: /\/*! version : .*/,
  12. replacement: '! version : ' + version
  13. }
  14. ]
  15. }
  16. });
  17. grunt.config('string-replace.bootstrap-datetimepicker-css', {
  18. files: { 'src/less/_bootstrap-datetimepicker.less': 'src/less/_bootstrap-datetimepicker.less' },
  19. options: {
  20. replacements: [
  21. {
  22. pattern: / * version : .*/,
  23. replacement: ' version : ' + version
  24. }
  25. ]
  26. }
  27. });
  28. grunt.config('string-replace.package-json', {
  29. files: {'package.json': 'package.json'},
  30. options: {
  31. replacements: [
  32. {
  33. pattern: /"version": .*/,
  34. replacement: '"version": "' + version + '"'
  35. }
  36. ]
  37. }
  38. });
  39. grunt.config('string-replace.bower-json', {
  40. files: {'bower.json': 'bower.json'},
  41. options: {
  42. replacements: [
  43. {
  44. pattern: /"version": .*/,
  45. replacement: '"version": "' + version + '",'
  46. }
  47. ]
  48. }
  49. });
  50. grunt.config('string-replace.component-json', {
  51. files: {'component.json': 'component.json'},
  52. options: {
  53. replacements: [
  54. {
  55. pattern: /"version": .*/,
  56. replacement: '"version": "' + version + '",'
  57. }
  58. ]
  59. }
  60. });
  61. grunt.config('string-replace.composer-json', {
  62. files: {'composer.json': 'composer.json'},
  63. options: {
  64. replacements: [
  65. {
  66. pattern: /"version": .*/,
  67. replacement: '"version": "' + version + '",'
  68. }
  69. ]
  70. }
  71. });
  72. grunt.task.run([
  73. 'string-replace:bootstrap-datetimepicker-js',
  74. 'string-replace:bootstrap-datetimepicker-css',
  75. 'string-replace:package-json',
  76. 'string-replace:bower-json',
  77. 'string-replace:component-json',
  78. 'string-replace:composer-json'
  79. ]);
  80. });
  81. };