From 52c6ac538b598a3bc3cef87738c35f6f146d64e8 Mon Sep 17 00:00:00 2001 From: Eric Ferraiuolo Date: Tue, 14 May 2013 15:58:25 -0400 Subject: [PATCH] Add Grunt `release` task to create a .zip archive of the build/ dir MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds the new `release` Grunt task which creates a .zip file in the `release/[version]/` dir with the following name format and structure: `[name]-[version].zip` where `name` and `version` are from package.json. . └── kimono └── 0.0.1 └── *.css --- .gitignore | 1 + Gruntfile.js | 23 +++++++++++++++++++++++ package.json | 5 +++-- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index ea90594..218342e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .DS_Store build/ node_modules/ +release/ diff --git a/Gruntfile.js b/Gruntfile.js index 250eeef..01dde02 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -23,6 +23,7 @@ grunt.initConfig({ clean: { build : ['build/'], build_res: ['build/*-r.css'], + release : ['release/<%= pkg.version %>/'], base : ['src/base/css/', 'src/base/tests/', 'src/base/LICENSE.md'] }, @@ -157,6 +158,21 @@ grunt.initConfig({ } }, + // -- Compress Config ------------------------------------------------------ + + compress: { + release: { + options: { + archive: 'release/<%= pkg.version %>/<%= pkg.name %>-<%= pkg.version %>.zip' + }, + + expand : true, + flatten: true, + src : 'build/*.css', + dest : '<%= pkg.name %>/<%= pkg.version %>/' + } + }, + // -- Contextualize Config ------------------------------------------------- contextualize: { @@ -178,6 +194,7 @@ grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-cssmin'); +grunt.loadNpmTasks('grunt-contrib-compress'); grunt.registerTask('default', [ 'clean:build', @@ -192,6 +209,12 @@ grunt.registerTask('import', [ 'import-normalize' ]); +grunt.registerTask('release', [ + 'default', + 'clean:release', + 'compress:release' +]); + // -- Import Tasks ------------------------------------------------------------- grunt.registerTask('import-normalize', [ diff --git a/package.json b/package.json index 76391d5..54c8840 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "Kimono", + "name": "kimono", "version": "0.0.1", "private": true, "devDependencies": { @@ -8,6 +8,7 @@ "grunt-contrib-cssmin": "~0.6.0", "grunt-contrib-clean": "~0.4.1", "grunt-contrib-copy": "~0.4.1", - "grunt-contrib-concat": "~0.3.0" + "grunt-contrib-concat": "~0.3.0", + "grunt-contrib-compress": "~0.5.0" } }