diff --git a/.gitignore b/.gitignore index 7bc747d..feb0aaa 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,7 @@ test/lib/ .sass-cache src/css/ dist/ -dist.zip +*.zip test/integration/src/ src/lib/*.js src/js/crypto/aes-cbc.js diff --git a/Gruntfile.js b/Gruntfile.js index fefc5ec..f27c739 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,6 +1,8 @@ module.exports = function(grunt) { 'use strict'; + var version = grunt.option('release'); + // Project configuration. grunt.initConfig({ connect: { @@ -199,6 +201,18 @@ module.exports = function(grunt) { src: ['**'], dest: 'test/integration/src/' } + }, + compress: { + main: { + options: { + mode: 'zip', + archive: (version) ? version + '.zip' : 'release.zip' + }, + expand: true, + cwd: 'dist/', + src: ['**/*'], + dest: 'release/' + } } }); @@ -213,6 +227,7 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-autoprefixer'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-copy'); + grunt.loadNpmTasks('grunt-contrib-compress'); // Build tasks grunt.registerTask('dist-npm', ['copy:npm', 'copy:npmDev', 'copy:cryptoLib']); @@ -226,4 +241,48 @@ module.exports = function(grunt) { grunt.registerTask('test', ['jshint', 'connect:test', 'mocha', 'qunit']); grunt.registerTask('prod', ['connect:prod']); + // + // Release tasks for Chrome App Release Channels + // + + grunt.registerTask('manifest-dev', function() { + patchManifest({ + suffix: ' (DEV)', + client_id: '440907777130-bfpgo5fbo4f7hetrg3hn57qolrtubs0u.apps.googleusercontent.com' + }); + }); + grunt.registerTask('manifest-test', function() { + patchManifest({ + suffix: ' (Alpha)' + }); + }); + grunt.registerTask('manifest-stable', function() { + patchManifest({}); + }); + + function patchManifest(options) { + var fs = require('fs'), + path = './dist/manifest.json', + manifest = require(path); + + if (!version) { + throw new Error('You must specify the version: "--release=1.0"'); + } + + manifest.version = version; + if (options.suffix) { + manifest.name += options.suffix; + } + if (options.client_id) { + manifest.oauth2.client_id = options.client_id; + } + delete manifest.key; + + fs.writeFileSync(path, JSON.stringify(manifest, null, 2)); + } + + grunt.registerTask('release-dev', ['dist', 'manifest-dev', 'compress']); + grunt.registerTask('release-test', ['dist', 'manifest-test', 'compress']); + grunt.registerTask('release-stable', ['dist', 'manifest-stable', 'compress']); + }; \ No newline at end of file diff --git a/package.json b/package.json index 08d8359..b745dab 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "grunt-contrib-sass": "0.5.0", "grunt-autoprefixer": "0.3.0", "grunt-contrib-watch": "0.5.3", - "grunt-contrib-copy": "0.4.1" + "grunt-contrib-copy": "0.4.1", + "grunt-contrib-compress": "0.5.2" } } \ No newline at end of file diff --git a/src/manifest.json b/src/manifest.json index af1e3eb..ac4f6e4 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,7 +1,7 @@ { - "name": "Whiteout Mail (DEV)", + "name": "Whiteout Mail", "description": "Simple & elegant email client with integrated end-to-end encryption. Keeping your emails safe has never been so easy.", - "version": "0.1.9.1", + "version": "9999.9999.9999.9999", "manifest_version": 2, "offline_enabled": true, "icons": {