From a068358153a5a5f9904f535472af10feead86e1c Mon Sep 17 00:00:00 2001 From: Adam Shaw Date: Sat, 31 May 2014 01:49:15 -0700 Subject: [PATCH] release script and grunt-bump --- Gruntfile.js | 26 +++++++++++++++++++------- build/release.sh | 20 ++++++++++++++++++++ 2 files changed, 39 insertions(+), 7 deletions(-) create mode 100755 build/release.sh diff --git a/Gruntfile.js b/Gruntfile.js index 7d5255a..319518b 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -13,11 +13,8 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-jscs-checker'); grunt.loadNpmTasks('grunt-karma'); + grunt.loadNpmTasks('grunt-bump'); grunt.loadNpmTasks('lumbar'); - - // Parse config files - var packageConfig = grunt.file.readJSON('package.json'); - var pluginConfig = grunt.file.readJSON('fullcalendar.jquery.json'); // This will eventually get passed to grunt.initConfig() // Initialize multitasks... @@ -31,8 +28,8 @@ module.exports = function(grunt) { } }; - // Combine certain configs for the "meta" template variable (<%= meta.whatever %>) - config.meta = _.extend({}, packageConfig, pluginConfig); + // for the "meta" template variable (<%= meta.whatever %>) + config.meta = grunt.file.readJSON('fullcalendar.jquery.json'); // The "grunt" command with no arguments grunt.registerTask('default', 'archive'); @@ -276,6 +273,20 @@ module.exports = function(grunt) { + /* Release Utilities + ----------------------------------------------------------------------------------------------------*/ + + config.bump = { // changes the version number in the configs + options: { + files: '*.json', + commit: false, + createTag: false, + push: false + } + }; + + + /* CDNJS (http://cdnjs.com/) ----------------------------------------------------------------------------------------------------*/ @@ -310,11 +321,12 @@ module.exports = function(grunt) { }; grunt.registerTask('cdnjsConfig', function() { + var jqueryConfig = grunt.file.readJSON('fullcalendar.jquery.json'); var cdnjsConfig = grunt.file.readJSON('build/cdnjs.json'); grunt.file.write( 'dist/cdnjs/package.json', JSON.stringify( - _.extend({}, pluginConfig, cdnjsConfig), // combine 2 configs + _.extend({}, jqueryConfig, cdnjsConfig), // combine 2 configs null, // replace 2 // indent ) diff --git a/build/release.sh b/build/release.sh new file mode 100755 index 0000000..ec4ab03 --- /dev/null +++ b/build/release.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +cd "`dirname $0`/../" + +read -p "Enter the new version number with no 'v' (for example '1.0.1'): " version + +if [[ ! "$version" ]] +then + exit; +fi + +grunt bump --setversion=$version && \ +grunt dist && \ +git add *.json && \ +git add -f dist/*.js dist/*.css dist/lang/*.js && \ +git commit -e -m "Release v$version" && \ +git tag -a v$version -m "Release v$version" && \ +echo && \ +echo 'DONE. It is now up to you to run `'"git push origin v$version"'`' && \ +echo \ No newline at end of file