From 3c73016a0d5a9d93a68fde7fe8c09d101bcf9dca Mon Sep 17 00:00:00 2001 From: Robert Rawlins Date: Thu, 7 Nov 2013 13:38:38 +0000 Subject: [PATCH] Added an S3 deployment plugin which pushesh to the code asset store. --- .gitignore | 3 ++- Gruntfile.js | 30 +++++++++++++++++++++++++++++- package.json | 3 ++- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index bdeb1e1..dab8003 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .DS_Store /tmp /node_modules -npm-debug.log \ No newline at end of file +npm-debug.log +aws.json \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js index 2144997..7a2b3c2 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -4,6 +4,7 @@ module.exports = function(grunt) { grunt.initConfig({ // Default package configuration. pkg: grunt.file.readJSON('package.json'), + aws: grunt.file.readJSON('aws.json'), // Javascript validation. jshint: { @@ -31,7 +32,32 @@ module.exports = function(grunt) { options: { npmtag: false // Don't deploy to NPM as we don't want to release like that. } - } + }, + + // Deployment. + s3: { + options: { + key: '<%= aws.key %>', + secret: '<%= aws.secret %>', + bucket: 'code.sorryapp.com', + region: 'eu-west-1', + access: 'public-read', + }, + dev: { + upload: [ + { + src: 'dist/<%= pkg.name %>.min.js', + dest: '<%= pkg.name %>/<%= pkg.version %>/<%= pkg.name %>.min.js', + options: { gzip: true } + }, + { + src: 'dist/<%= pkg.name %>.min.css', + dest: '<%= pkg.name %>/<%= pkg.version %>/<%= pkg.name %>.min.css', + options: { gzip: true } + } + ] + } + } }); // Load the plugin that provides the "uglify" task. @@ -42,6 +68,8 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-contrib-jshint'); // Release tasks to manage version number bump, tag etc. grunt.loadNpmTasks('grunt-release'); + // AWS/S3 deployment tools. + grunt.loadNpmTasks('grunt-s3'); // Default task(s). grunt.registerTask('default', ['jshint', 'uglify', 'cssmin']); diff --git a/package.json b/package.json index 932282b..f7bcd55 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "grunt-contrib-uglify": "~0.2.5", "grunt-contrib-jshint": "~0.7.1", "grunt-release": "~0.6.0", - "grunt-contrib-cssmin": "~0.7.0" + "grunt-contrib-cssmin": "~0.7.0", + "grunt-s3": "~0.2.0-alpha.3" } }