2013-05-21 09:38:18 -04:00
|
|
|
module.exports = function(grunt) {
|
2013-08-09 11:23:38 -04:00
|
|
|
'use strict';
|
2013-05-21 09:38:18 -04:00
|
|
|
|
2014-10-07 14:32:23 -04:00
|
|
|
require('time-grunt')(grunt);
|
|
|
|
|
2013-11-13 05:50:41 -05:00
|
|
|
var version = grunt.option('release'),
|
|
|
|
zipName = (version) ? version : 'DEV';
|
2013-11-12 14:02:46 -05:00
|
|
|
|
2014-10-14 06:32:00 -04:00
|
|
|
var browserifyOpt = {
|
|
|
|
exclude: ['openpgp', 'node-forge', 'net', 'tls', 'crypto'], // node apis not required at build time
|
|
|
|
ignore: ['buffer'], // node apis to be stubbed for runtime
|
|
|
|
browserifyOptions: {
|
|
|
|
debug: true
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-08-09 11:23:38 -04:00
|
|
|
// Project configuration.
|
|
|
|
grunt.initConfig({
|
2014-10-02 16:05:44 -04:00
|
|
|
|
2014-09-23 09:41:37 -04:00
|
|
|
// General
|
2013-05-22 04:16:26 -04:00
|
|
|
|
2014-10-27 11:03:54 -04:00
|
|
|
shell: {
|
|
|
|
options: {
|
|
|
|
stderr: false
|
|
|
|
},
|
|
|
|
target: {
|
|
|
|
command: 'dir=$(pwd) && cd node_modules/mailreader/ && npm install --production && cd $dir'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2014-09-23 09:41:37 -04:00
|
|
|
clean: {
|
2014-10-27 11:03:54 -04:00
|
|
|
dist: ['dist', 'compile', 'test/lib', 'test/integration/src'],
|
|
|
|
release: ['dist/**/*.browserified.js', 'dist/**/*.js.map']
|
2013-08-09 11:23:38 -04:00
|
|
|
},
|
2013-05-22 04:16:26 -04:00
|
|
|
|
2014-09-23 09:41:37 -04:00
|
|
|
copy: {
|
|
|
|
npmDev: {
|
|
|
|
expand: true,
|
|
|
|
flatten: true,
|
|
|
|
cwd: './',
|
|
|
|
src: [
|
|
|
|
'node_modules/mocha/mocha.css',
|
|
|
|
'node_modules/mocha/mocha.js',
|
|
|
|
'node_modules/chai/chai.js',
|
|
|
|
'node_modules/sinon/pkg/sinon.js',
|
|
|
|
'node_modules/browsercrow/src/*.js',
|
|
|
|
'node_modules/browsersmtp/src/*.js',
|
2014-10-27 11:03:54 -04:00
|
|
|
'src/lib/openpgp/openpgp.min.js',
|
|
|
|
'src/lib/openpgp/openpgp.worker.min.js',
|
2014-09-23 09:41:37 -04:00
|
|
|
'src/lib/forge/forge.min.js',
|
|
|
|
'dist/js/pbkdf2-worker.min.js'
|
|
|
|
],
|
|
|
|
dest: 'test/lib/'
|
|
|
|
},
|
|
|
|
lib: {
|
|
|
|
expand: true,
|
|
|
|
flatten: true,
|
|
|
|
cwd: 'src/lib/',
|
2014-10-27 11:03:54 -04:00
|
|
|
src: ['openpgp/openpgp.min.js', 'openpgp/openpgp.worker.min.js', 'forge/forge.min.js'],
|
2014-09-23 09:41:37 -04:00
|
|
|
dest: 'dist/js/'
|
|
|
|
},
|
|
|
|
font: {
|
|
|
|
expand: true,
|
|
|
|
cwd: 'src/font/',
|
|
|
|
src: ['*'],
|
|
|
|
dest: 'dist/font/'
|
|
|
|
},
|
|
|
|
img: {
|
|
|
|
expand: true,
|
|
|
|
cwd: 'src/img/',
|
|
|
|
src: ['*'],
|
|
|
|
dest: 'dist/img/'
|
|
|
|
},
|
|
|
|
tpl: {
|
|
|
|
expand: true,
|
|
|
|
cwd: 'src/tpl/',
|
|
|
|
src: ['*'],
|
|
|
|
dest: 'dist/tpl/'
|
|
|
|
},
|
|
|
|
app: {
|
|
|
|
expand: true,
|
|
|
|
cwd: 'src/',
|
|
|
|
src: ['*.js', '*.json', 'manifest.*'],
|
|
|
|
dest: 'dist/'
|
2013-08-19 15:13:32 -04:00
|
|
|
}
|
2013-09-16 13:46:04 -04:00
|
|
|
},
|
|
|
|
|
2014-09-23 09:41:37 -04:00
|
|
|
// Stylesheets
|
2014-10-02 16:05:44 -04:00
|
|
|
|
2013-09-16 13:46:04 -04:00
|
|
|
sass: {
|
|
|
|
dist: {
|
|
|
|
files: {
|
2014-07-10 14:07:03 -04:00
|
|
|
'src/css/read-sandbox.css': 'src/sass/read-sandbox.scss',
|
2013-10-22 12:26:30 -04:00
|
|
|
'src/css/all.css': 'src/sass/all.scss'
|
2013-09-16 13:46:04 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
autoprefixer: {
|
|
|
|
options: {
|
|
|
|
browsers: ['last 2 versions']
|
|
|
|
},
|
|
|
|
dist: {
|
|
|
|
files: {
|
2014-07-10 14:07:03 -04:00
|
|
|
'src/css/read-sandbox.css': 'src/css/read-sandbox.css',
|
2013-10-22 12:26:30 -04:00
|
|
|
'src/css/all.css': 'src/css/all.css'
|
2013-09-16 13:46:04 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
csso: {
|
|
|
|
options: {
|
2014-09-23 09:41:37 -04:00
|
|
|
banner: '/*! Copyright © 2013, Whiteout Networks GmbH. All rights reserved.*/\n'
|
2013-09-16 13:46:04 -04:00
|
|
|
},
|
|
|
|
dist: {
|
|
|
|
files: {
|
2014-07-10 14:07:03 -04:00
|
|
|
'dist/css/read-sandbox.min.css': 'src/css/read-sandbox.css',
|
2013-10-22 12:26:30 -04:00
|
|
|
'dist/css/all.min.css': 'src/css/all.css'
|
2013-09-16 13:46:04 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2014-10-02 16:05:44 -04:00
|
|
|
|
2014-09-23 09:41:37 -04:00
|
|
|
// JavaScript
|
|
|
|
|
|
|
|
jshint: {
|
|
|
|
all: ['Gruntfile.js', 'src/*.js', 'src/js/**/*.js', 'test/unit/*-test.js', 'test/integration/*-test.js'],
|
|
|
|
options: {
|
|
|
|
jshintrc: '.jshintrc'
|
2013-09-16 13:46:04 -04:00
|
|
|
}
|
|
|
|
},
|
2014-10-02 16:05:44 -04:00
|
|
|
|
|
|
|
browserify: {
|
2014-10-08 12:36:00 -04:00
|
|
|
app: {
|
2014-10-02 16:05:44 -04:00
|
|
|
files: {
|
2014-10-08 13:56:25 -04:00
|
|
|
'dist/js/app.browserified.js': ['src/js/app.js']
|
2014-10-02 16:05:44 -04:00
|
|
|
},
|
2014-10-14 06:32:00 -04:00
|
|
|
options: browserifyOpt
|
2014-10-08 12:36:00 -04:00
|
|
|
},
|
|
|
|
pbkdf2Worker: {
|
|
|
|
files: {
|
2014-10-08 13:56:25 -04:00
|
|
|
'dist/js/pbkdf2-worker.browserified.js': ['src/js/crypto/pbkdf2-worker.js']
|
2014-10-14 06:32:00 -04:00
|
|
|
},
|
|
|
|
options: browserifyOpt
|
2014-10-07 14:32:23 -04:00
|
|
|
},
|
2014-10-13 12:00:01 -04:00
|
|
|
mailreaderWorker: {
|
|
|
|
files: {
|
|
|
|
'dist/js/mailreader-parser-worker.browserified.js': ['node_modules/mailreader/src/mailreader-parser-worker-browserify.js']
|
|
|
|
},
|
2014-10-14 06:32:00 -04:00
|
|
|
options: browserifyOpt
|
2014-10-13 12:00:01 -04:00
|
|
|
},
|
2014-10-15 13:58:26 -04:00
|
|
|
tlsWorker: {
|
|
|
|
files: {
|
|
|
|
'dist/js/tcp-socket-tls-worker.browserified.js': ['node_modules/tcp-socket/src/tcp-socket-tls-worker.js']
|
|
|
|
},
|
|
|
|
options: browserifyOpt
|
|
|
|
},
|
2014-10-07 14:32:23 -04:00
|
|
|
unitTest: {
|
|
|
|
files: {
|
2014-10-09 09:23:41 -04:00
|
|
|
'test/unit/index.browserified.js': [
|
2014-10-09 08:28:47 -04:00
|
|
|
'test/unit/oauth-test.js',
|
|
|
|
'test/unit/auth-test.js',
|
|
|
|
'test/unit/email-dao-test.js',
|
|
|
|
'test/unit/app-controller-test.js',
|
|
|
|
'test/unit/pgp-test.js',
|
|
|
|
'test/unit/crypto-test.js',
|
|
|
|
'test/unit/backbutton-handler-test.js',
|
|
|
|
'test/unit/rest-dao-test.js',
|
|
|
|
'test/unit/admin-dao-test.js',
|
|
|
|
'test/unit/publickey-dao-test.js',
|
|
|
|
'test/unit/privatekey-dao-test.js',
|
|
|
|
'test/unit/lawnchair-dao-test.js',
|
|
|
|
'test/unit/keychain-dao-test.js',
|
|
|
|
'test/unit/devicestorage-dao-test.js',
|
|
|
|
'test/unit/dialog-ctrl-test.js',
|
|
|
|
'test/unit/add-account-ctrl-test.js',
|
|
|
|
'test/unit/account-ctrl-test.js',
|
|
|
|
'test/unit/set-passphrase-ctrl-test.js',
|
|
|
|
'test/unit/contacts-ctrl-test.js',
|
|
|
|
'test/unit/login-existing-ctrl-test.js',
|
|
|
|
'test/unit/login-initial-ctrl-test.js',
|
|
|
|
'test/unit/login-new-device-ctrl-test.js',
|
|
|
|
'test/unit/login-privatekey-download-ctrl-test.js',
|
|
|
|
'test/unit/login-set-credentials-ctrl-test.js',
|
|
|
|
'test/unit/privatekey-upload-ctrl-test.js',
|
|
|
|
'test/unit/login-ctrl-test.js',
|
|
|
|
'test/unit/read-ctrl-test.js',
|
|
|
|
'test/unit/navigation-ctrl-test.js',
|
|
|
|
'test/unit/mail-list-ctrl-test.js',
|
|
|
|
'test/unit/write-ctrl-test.js',
|
|
|
|
'test/unit/outbox-bo-test.js',
|
|
|
|
'test/unit/invitation-dao-test.js',
|
|
|
|
'test/unit/update-handler-test.js',
|
2014-10-09 09:23:41 -04:00
|
|
|
'test/unit/connection-doctor-test.js',
|
2014-10-09 10:51:39 -04:00
|
|
|
'test/main.js'
|
2014-10-09 08:28:47 -04:00
|
|
|
]
|
2014-10-07 14:32:23 -04:00
|
|
|
},
|
2014-10-14 06:32:00 -04:00
|
|
|
options: browserifyOpt
|
2014-10-02 16:05:44 -04:00
|
|
|
},
|
2014-10-09 10:51:39 -04:00
|
|
|
integrationTest: {
|
|
|
|
files: {
|
|
|
|
'test/integration/index.browserified.js': [
|
|
|
|
'test/integration/email-dao-test.js',
|
|
|
|
'test/main.js'
|
|
|
|
]
|
|
|
|
},
|
2014-10-14 07:21:59 -04:00
|
|
|
options: browserifyOpt
|
2014-10-09 10:51:39 -04:00
|
|
|
}
|
2014-10-02 16:05:44 -04:00
|
|
|
},
|
|
|
|
|
2014-10-09 12:39:08 -04:00
|
|
|
exorcise: {
|
2014-10-14 06:32:00 -04:00
|
|
|
app: {
|
2014-10-09 12:39:08 -04:00
|
|
|
files: {
|
|
|
|
'dist/js/app.browserified.js.map': ['dist/js/app.browserified.js'],
|
|
|
|
}
|
2014-10-14 06:32:00 -04:00
|
|
|
},
|
|
|
|
unitTest: {
|
|
|
|
files: {
|
|
|
|
'test/unit/index.browserified.js.map': ['test/unit/index.browserified.js'],
|
|
|
|
}
|
|
|
|
},
|
|
|
|
integrationTest: {
|
|
|
|
files: {
|
|
|
|
'test/integration/index.browserified.js.map': ['test/integration/index.browserified.js'],
|
|
|
|
}
|
2014-10-09 12:39:08 -04:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2014-10-02 16:05:44 -04:00
|
|
|
uglify: {
|
2014-10-08 12:36:00 -04:00
|
|
|
app: {
|
2014-10-02 16:05:44 -04:00
|
|
|
files: {
|
|
|
|
'dist/js/app.min.js': [
|
|
|
|
'src/lib/underscore/underscore-min.js',
|
|
|
|
'node_modules/jquery/dist/jquery.min.js',
|
|
|
|
'src/lib/angular/angular.min.js',
|
|
|
|
'src/lib/angular/angular-route.min.js',
|
|
|
|
'src/lib/angular/angular-animate.min.js',
|
|
|
|
'src/lib/ngtagsinput/ng-tags-input.min.js',
|
|
|
|
'node_modules/ng-infinite-scroll/build/ng-infinite-scroll.min.js',
|
2014-10-08 12:36:00 -04:00
|
|
|
'src/lib/fastclick/fastclick.js',
|
2014-10-02 16:05:44 -04:00
|
|
|
'src/lib/lawnchair/lawnchair-git.js',
|
|
|
|
'src/lib/lawnchair/lawnchair-adapter-webkit-sqlite-git.js',
|
|
|
|
'src/lib/lawnchair/lawnchair-adapter-indexed-db-git.js',
|
2014-10-08 13:56:25 -04:00
|
|
|
'dist/js/app.browserified.js'
|
2014-10-02 16:05:44 -04:00
|
|
|
]
|
2014-10-08 13:56:25 -04:00
|
|
|
},
|
|
|
|
options: {
|
|
|
|
mangle: false,
|
|
|
|
sourceMap: true,
|
2014-10-09 12:39:08 -04:00
|
|
|
sourceMapIn: 'dist/js/app.browserified.js.map',
|
|
|
|
sourceMapIncludeSources: true,
|
2014-10-08 13:56:25 -04:00
|
|
|
sourceMapName: 'dist/js/app.min.js.map'
|
2014-10-02 16:05:44 -04:00
|
|
|
}
|
2013-09-16 13:46:04 -04:00
|
|
|
},
|
2014-10-08 13:56:25 -04:00
|
|
|
readSandbox: {
|
|
|
|
files: {
|
|
|
|
'dist/js/read-sandbox.min.js': [
|
|
|
|
'node_modules/dompurify/purify.js',
|
|
|
|
'src/js/controller/read-sandbox.js'
|
|
|
|
]
|
|
|
|
},
|
|
|
|
options: {
|
|
|
|
sourceMap: true,
|
|
|
|
sourceMapName: 'dist/js/read-sandbox.min.js.map'
|
|
|
|
}
|
|
|
|
},
|
2014-10-08 12:36:00 -04:00
|
|
|
pbkdf2Worker: {
|
|
|
|
files: {
|
2014-10-08 13:56:25 -04:00
|
|
|
'dist/js/pbkdf2-worker.min.js': ['dist/js/pbkdf2-worker.browserified.js']
|
2014-10-08 12:36:00 -04:00
|
|
|
}
|
|
|
|
},
|
2014-10-13 12:00:01 -04:00
|
|
|
mailreaderWorker: {
|
|
|
|
files: {
|
|
|
|
'dist/js/mailreader-parser-worker.min.js': ['dist/js/mailreader-parser-worker.browserified.js']
|
|
|
|
},
|
|
|
|
options: {
|
|
|
|
sourceMap: true,
|
|
|
|
sourceMapName: 'dist/js/mailreader-parser-worker.min.js.map'
|
|
|
|
}
|
|
|
|
},
|
2014-10-15 13:58:26 -04:00
|
|
|
tlsWorker: {
|
|
|
|
files: {
|
|
|
|
'dist/js/tcp-socket-tls-worker.min.js': ['dist/js/tcp-socket-tls-worker.browserified.js']
|
|
|
|
},
|
|
|
|
options: {
|
|
|
|
sourceMap: true,
|
|
|
|
sourceMapName: 'dist/js/tcp-socket-tls-worker.min.js.map'
|
|
|
|
}
|
|
|
|
},
|
2014-10-07 14:32:23 -04:00
|
|
|
unitTest: {
|
|
|
|
files: {
|
|
|
|
'test/unit/index.js': [
|
|
|
|
'src/lib/underscore/underscore-min.js',
|
|
|
|
'node_modules/jquery/dist/jquery.min.js',
|
|
|
|
'src/lib/angular/angular.min.js',
|
|
|
|
'src/lib/angular/angular-route.min.js',
|
|
|
|
'src/lib/angular/angular-animate.min.js',
|
2014-10-09 09:56:35 -04:00
|
|
|
'node_modules/angularjs/src/ngMock/angular-mocks.js',
|
2014-10-07 14:32:23 -04:00
|
|
|
'src/lib/lawnchair/lawnchair-git.js',
|
|
|
|
'src/lib/lawnchair/lawnchair-adapter-webkit-sqlite-git.js',
|
|
|
|
'src/lib/lawnchair/lawnchair-adapter-indexed-db-git.js',
|
2014-10-09 09:23:41 -04:00
|
|
|
'test/unit/index.browserified.js'
|
2014-10-07 14:32:23 -04:00
|
|
|
]
|
2014-10-08 12:36:00 -04:00
|
|
|
},
|
|
|
|
options: {
|
2014-10-09 09:23:41 -04:00
|
|
|
mangle: false,
|
|
|
|
sourceMap: true,
|
2014-10-14 06:32:00 -04:00
|
|
|
sourceMapIn: 'test/unit/index.browserified.js.map',
|
|
|
|
sourceMapIncludeSources: true,
|
2014-10-09 09:23:41 -04:00
|
|
|
sourceMapName: 'test/unit/index.js.map'
|
2014-10-07 14:32:23 -04:00
|
|
|
}
|
|
|
|
},
|
2014-10-09 10:51:39 -04:00
|
|
|
integrationTest: {
|
|
|
|
files: {
|
|
|
|
'test/integration/index.js': [
|
|
|
|
'src/lib/underscore/underscore-min.js',
|
|
|
|
'src/lib/lawnchair/lawnchair-git.js',
|
|
|
|
'src/lib/lawnchair/lawnchair-adapter-webkit-sqlite-git.js',
|
|
|
|
'src/lib/lawnchair/lawnchair-adapter-indexed-db-git.js',
|
|
|
|
'test/integration/index.browserified.js'
|
|
|
|
]
|
|
|
|
},
|
|
|
|
options: {
|
|
|
|
mangle: false,
|
|
|
|
sourceMap: true,
|
2014-10-14 06:32:00 -04:00
|
|
|
sourceMapIn: 'test/integration/index.browserified.js.map',
|
|
|
|
sourceMapIncludeSources: true,
|
2014-10-09 10:51:39 -04:00
|
|
|
sourceMapName: 'test/integration/index.js.map'
|
|
|
|
}
|
|
|
|
},
|
2014-10-02 16:05:44 -04:00
|
|
|
options: {
|
|
|
|
banner: '/*! Copyright © <%= grunt.template.today("yyyy") %>, Whiteout Networks GmbH.*/\n'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2014-09-23 09:41:37 -04:00
|
|
|
mocha_phantomjs: {
|
|
|
|
all: {
|
|
|
|
options: {
|
|
|
|
urls: [
|
|
|
|
'http://localhost:<%= connect.test.options.port %>/test/unit/index.html',
|
|
|
|
'http://localhost:<%= connect.test.options.port %>/test/integration/index.html'
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
// Assets
|
|
|
|
|
|
|
|
svgmin: {
|
|
|
|
options: {
|
|
|
|
plugins: [{
|
|
|
|
removeViewBox: false
|
|
|
|
}, {
|
|
|
|
removeUselessStrokeAndFill: false
|
|
|
|
}]
|
2013-09-17 08:40:35 -04:00
|
|
|
},
|
2014-09-23 09:41:37 -04:00
|
|
|
icons: {
|
|
|
|
files: [{
|
|
|
|
expand: true,
|
|
|
|
src: ['img/icons/*.svg'],
|
|
|
|
cwd: 'src/',
|
|
|
|
dest: 'compile/'
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
svgstore: {
|
|
|
|
options: {
|
|
|
|
prefix: 'icon-',
|
|
|
|
svg: {
|
|
|
|
viewBox: '0 0 100 100',
|
|
|
|
xmlns: 'http://www.w3.org/2000/svg'
|
|
|
|
},
|
|
|
|
cleanup: ['fill', 'stroke']
|
2014-10-08 12:36:00 -04:00
|
|
|
},
|
2014-09-23 09:41:37 -04:00
|
|
|
icons: {
|
|
|
|
files: {
|
|
|
|
'src/img/icons/all.svg': ['compile/img/icons/*.svg'],
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'string-replace': {
|
|
|
|
index: {
|
|
|
|
files: {
|
|
|
|
'dist/index.html': 'src/index.html'
|
|
|
|
},
|
|
|
|
options: {
|
|
|
|
replacements: [{
|
|
|
|
pattern: /<!-- @import (.*?) -->/ig,
|
|
|
|
replacement: function(match, p1) {
|
|
|
|
return grunt.file.read('src/' + p1);
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
// Development
|
|
|
|
|
|
|
|
connect: {
|
|
|
|
dev: {
|
|
|
|
options: {
|
|
|
|
port: 8580,
|
|
|
|
base: '.',
|
|
|
|
keepalive: true
|
|
|
|
}
|
2013-09-16 13:46:04 -04:00
|
|
|
},
|
2014-09-23 09:41:37 -04:00
|
|
|
test: {
|
|
|
|
options: {
|
|
|
|
port: 8581,
|
|
|
|
base: '.'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
// Utilities
|
|
|
|
|
|
|
|
watch: {
|
|
|
|
css: {
|
|
|
|
files: ['src/sass/**/*.scss'],
|
2014-11-04 10:37:07 -05:00
|
|
|
tasks: ['dist-css', 'manifest']
|
2013-09-17 08:40:35 -04:00
|
|
|
},
|
2014-09-23 09:41:37 -04:00
|
|
|
js: {
|
|
|
|
files: ['src/js/**/*.js'],
|
2014-11-04 10:37:07 -05:00
|
|
|
tasks: ['dist-js', 'manifest']
|
2014-09-23 09:41:37 -04:00
|
|
|
},
|
|
|
|
icons: {
|
|
|
|
files: ['src/index.html', 'src/img/icons/*.svg', '!src/img/icons/all.svg'],
|
2014-11-04 10:37:07 -05:00
|
|
|
tasks: ['svgmin', 'svgstore', 'string-replace', 'manifest']
|
2014-09-23 09:41:37 -04:00
|
|
|
},
|
|
|
|
lib: {
|
|
|
|
files: ['src/lib/**/*.js'],
|
2014-11-04 10:37:07 -05:00
|
|
|
tasks: ['copy:lib', 'manifest']
|
2013-09-16 13:46:04 -04:00
|
|
|
},
|
|
|
|
app: {
|
2014-09-23 09:41:37 -04:00
|
|
|
files: ['src/*.js', 'src/**/*.html', 'src/**/*.json', 'src/manifest.*', 'src/img/**/*', 'src/font/**/*'],
|
2014-11-04 10:37:07 -05:00
|
|
|
tasks: ['copy:app', 'copy:tpl', 'copy:img', 'copy:font', 'manifest-dev', 'manifest']
|
2013-09-16 13:46:04 -04:00
|
|
|
}
|
2013-11-12 14:02:46 -05:00
|
|
|
},
|
2014-03-02 17:50:16 -05:00
|
|
|
|
2014-09-23 09:41:37 -04:00
|
|
|
// Deployment
|
|
|
|
|
2013-11-12 14:02:46 -05:00
|
|
|
compress: {
|
2014-03-03 07:00:26 -05:00
|
|
|
main: {
|
2013-11-12 14:02:46 -05:00
|
|
|
options: {
|
|
|
|
mode: 'zip',
|
2014-03-03 07:00:26 -05:00
|
|
|
archive: 'release/whiteout-mail_' + zipName + '.zip'
|
2013-11-12 14:02:46 -05:00
|
|
|
},
|
|
|
|
expand: true,
|
|
|
|
cwd: 'dist/',
|
|
|
|
src: ['**/*'],
|
|
|
|
dest: 'release/'
|
|
|
|
}
|
2014-03-02 17:50:16 -05:00
|
|
|
},
|
|
|
|
|
2014-08-13 10:16:28 -04:00
|
|
|
manifest: {
|
|
|
|
generate: {
|
|
|
|
options: {
|
|
|
|
basePath: 'dist/',
|
|
|
|
timestamp: true,
|
|
|
|
hash: true,
|
|
|
|
cache: ['socket.io/socket.io.js'],
|
2014-10-08 13:56:25 -04:00
|
|
|
exclude: [
|
|
|
|
'appcache.manifest',
|
|
|
|
'manifest.webapp',
|
|
|
|
'js/app.min.js.map',
|
|
|
|
'js/app.browserified.js',
|
2014-10-09 12:39:08 -04:00
|
|
|
'js/app.browserified.js.map',
|
2014-10-08 13:56:25 -04:00
|
|
|
'js/crypto/pbkdf2-worker.browserified.js',
|
|
|
|
'js/pbkdf2-worker.browserified.js',
|
2014-10-16 07:32:18 -04:00
|
|
|
'js/read-sandbox.min.js.map',
|
|
|
|
'js/mailreader-parser-worker.browserified.js',
|
|
|
|
'js/mailreader-parser-worker.min.js.map',
|
|
|
|
'js/tcp-socket-tls-worker.browserified.js',
|
|
|
|
'js/tcp-socket-tls-worker.min.js.map'
|
2014-10-08 13:56:25 -04:00
|
|
|
],
|
2014-08-13 10:16:28 -04:00
|
|
|
master: ['index.html']
|
|
|
|
},
|
|
|
|
src: ['**/*.*'],
|
|
|
|
dest: 'dist/appcache.manifest'
|
|
|
|
}
|
2014-10-02 16:05:44 -04:00
|
|
|
}
|
2014-08-13 10:16:28 -04:00
|
|
|
|
2013-08-09 11:23:38 -04:00
|
|
|
});
|
2013-05-21 09:38:18 -04:00
|
|
|
|
2013-08-09 11:23:38 -04:00
|
|
|
// Load the plugin(s)
|
2014-10-02 16:05:44 -04:00
|
|
|
grunt.loadNpmTasks('grunt-browserify');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
2013-08-09 11:23:38 -04:00
|
|
|
grunt.loadNpmTasks('grunt-contrib-connect');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-jshint');
|
2013-09-16 13:46:04 -04:00
|
|
|
grunt.loadNpmTasks('grunt-contrib-clean');
|
|
|
|
grunt.loadNpmTasks('grunt-csso');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-sass');
|
|
|
|
grunt.loadNpmTasks('grunt-autoprefixer');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-watch');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-copy');
|
2013-11-12 14:02:46 -05:00
|
|
|
grunt.loadNpmTasks('grunt-contrib-compress');
|
2014-08-13 10:16:28 -04:00
|
|
|
grunt.loadNpmTasks('grunt-manifest');
|
2014-10-09 11:31:01 -04:00
|
|
|
grunt.loadNpmTasks('grunt-mocha-phantomjs');
|
2014-10-09 12:39:08 -04:00
|
|
|
grunt.loadNpmTasks('grunt-exorcise');
|
2014-09-23 09:41:37 -04:00
|
|
|
grunt.loadNpmTasks('grunt-string-replace');
|
|
|
|
grunt.loadNpmTasks('grunt-svgmin');
|
|
|
|
grunt.loadNpmTasks('grunt-svgstore');
|
2014-10-27 11:03:54 -04:00
|
|
|
grunt.loadNpmTasks('grunt-shell');
|
2013-05-21 09:38:18 -04:00
|
|
|
|
2013-09-17 07:04:41 -04:00
|
|
|
// Build tasks
|
2013-09-16 13:46:04 -04:00
|
|
|
grunt.registerTask('dist-css', ['sass', 'autoprefixer', 'csso']);
|
2014-10-09 12:39:08 -04:00
|
|
|
grunt.registerTask('dist-js', ['browserify', 'exorcise', 'uglify']);
|
2013-09-17 07:04:41 -04:00
|
|
|
grunt.registerTask('dist-copy', ['copy']);
|
2014-09-23 09:41:37 -04:00
|
|
|
grunt.registerTask('dist-assets', ['svgmin', 'svgstore', 'string-replace']);
|
2014-10-27 11:03:54 -04:00
|
|
|
grunt.registerTask('dist', ['clean:dist', 'shell', 'dist-css', 'dist-js', 'dist-assets', 'dist-copy', 'manifest']);
|
2013-09-16 13:46:04 -04:00
|
|
|
|
2013-09-17 07:04:41 -04:00
|
|
|
// Test/Dev tasks
|
|
|
|
grunt.registerTask('dev', ['connect:dev']);
|
2014-10-09 11:31:01 -04:00
|
|
|
grunt.registerTask('test', ['jshint', 'connect:test', 'mocha_phantomjs']);
|
2013-09-17 07:04:41 -04:00
|
|
|
grunt.registerTask('prod', ['connect:prod']);
|
|
|
|
|
2013-11-12 14:02:46 -05:00
|
|
|
//
|
|
|
|
// Release tasks for Chrome App Release Channels
|
|
|
|
//
|
|
|
|
|
|
|
|
grunt.registerTask('manifest-dev', function() {
|
|
|
|
patchManifest({
|
|
|
|
suffix: ' (DEV)',
|
2014-10-24 06:38:30 -04:00
|
|
|
version: '9999.9999.9999'
|
2013-11-12 14:02:46 -05:00
|
|
|
});
|
|
|
|
});
|
|
|
|
grunt.registerTask('manifest-test', function() {
|
2013-11-13 05:50:41 -05:00
|
|
|
if (!version) {
|
2014-10-31 11:03:16 -04:00
|
|
|
throw new Error('You must specify the version: "--release=1.0.0"');
|
2013-11-13 05:50:41 -05:00
|
|
|
}
|
|
|
|
|
2013-11-12 14:02:46 -05:00
|
|
|
patchManifest({
|
2013-11-13 05:50:41 -05:00
|
|
|
suffix: ' (TEST)',
|
|
|
|
client_id: '440907777130-bfpgo5fbo4f7hetrg3hn57qolrtubs0u.apps.googleusercontent.com',
|
2013-11-13 07:15:44 -05:00
|
|
|
version: version,
|
|
|
|
deleteKey: true
|
2013-11-12 14:02:46 -05:00
|
|
|
});
|
|
|
|
});
|
2014-10-31 11:03:16 -04:00
|
|
|
grunt.registerTask('manifest-prod', function() {
|
2013-11-13 05:50:41 -05:00
|
|
|
if (!version) {
|
2014-10-31 11:03:16 -04:00
|
|
|
throw new Error('You must specify the version: "--release=1.0.0"');
|
2013-11-13 05:50:41 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
patchManifest({
|
2013-11-13 07:15:44 -05:00
|
|
|
version: version,
|
2013-12-02 04:33:45 -05:00
|
|
|
deleteKey: true,
|
2014-06-26 11:21:28 -04:00
|
|
|
keyServer: 'https://keys.whiteout.io/',
|
|
|
|
keychainServer: 'https://keychain.whiteout.io/'
|
2013-11-13 05:50:41 -05:00
|
|
|
});
|
2013-11-12 14:02:46 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
function patchManifest(options) {
|
|
|
|
var fs = require('fs'),
|
|
|
|
path = './dist/manifest.json',
|
|
|
|
manifest = require(path);
|
|
|
|
|
2013-11-13 05:50:41 -05:00
|
|
|
if (options.version) {
|
|
|
|
manifest.version = options.version;
|
2013-11-12 14:02:46 -05:00
|
|
|
}
|
|
|
|
if (options.suffix) {
|
|
|
|
manifest.name += options.suffix;
|
|
|
|
}
|
|
|
|
if (options.client_id) {
|
|
|
|
manifest.oauth2.client_id = options.client_id;
|
|
|
|
}
|
2013-12-02 04:33:45 -05:00
|
|
|
if (options.keyServer) {
|
2014-01-23 08:52:46 -05:00
|
|
|
var ksIndex = manifest.permissions.indexOf('https://keys-test.whiteout.io/');
|
2013-12-02 04:33:45 -05:00
|
|
|
manifest.permissions[ksIndex] = options.keyServer;
|
|
|
|
}
|
2014-06-26 11:21:28 -04:00
|
|
|
if (options.keychainServer) {
|
|
|
|
var kcsIndex = manifest.permissions.indexOf('https://keychain-test.whiteout.io/');
|
|
|
|
manifest.permissions[kcsIndex] = options.keychainServer;
|
|
|
|
}
|
2013-11-13 07:15:44 -05:00
|
|
|
if (options.deleteKey) {
|
|
|
|
delete manifest.key;
|
|
|
|
}
|
2013-11-12 14:02:46 -05:00
|
|
|
|
|
|
|
fs.writeFileSync(path, JSON.stringify(manifest, null, 2));
|
|
|
|
}
|
|
|
|
|
|
|
|
grunt.registerTask('release-dev', ['dist', 'manifest-dev', 'compress']);
|
2014-10-27 11:03:54 -04:00
|
|
|
grunt.registerTask('release-test', ['dist', 'manifest-test', 'clean:release', 'compress']);
|
2014-10-31 11:03:16 -04:00
|
|
|
grunt.registerTask('release-prod', ['dist', 'manifest-prod', 'clean:release', 'compress']);
|
2013-11-13 05:50:41 -05:00
|
|
|
grunt.registerTask('default', ['release-dev']);
|
2013-11-12 14:02:46 -05:00
|
|
|
|
2014-10-16 07:32:18 -04:00
|
|
|
};
|