1
0
mirror of https://github.com/moparisthebest/mail synced 2024-12-22 15:28:49 -05:00

create release zip files via grunt job

This commit is contained in:
Tankred Hase 2013-11-12 20:02:46 +01:00
parent 6ea815221c
commit 082a12ed19
4 changed files with 64 additions and 4 deletions

2
.gitignore vendored
View File

@ -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

View File

@ -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']);
};

View File

@ -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"
}
}

View File

@ -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": {