1
0
mirror of https://github.com/moparisthebest/mail synced 2024-12-21 23:08:50 -05:00

seperate build and watch grunt tasks for each file type

This commit is contained in:
Tankred Hase 2013-09-17 14:40:35 +02:00
parent 8a766546f8
commit d011bc67e7
4 changed files with 49 additions and 31 deletions

View File

@ -4,6 +4,7 @@ node_js:
- "0.10"
- "0.8"
before_script:
- gem install sass
- npm install -g grunt-cli
notifications:
email:

View File

@ -102,12 +102,50 @@ module.exports = function(grunt) {
files: ['src/sass/**/*.scss'],
tasks: ['dist-css']
},
code: {
files: ['src/**/*.js', 'src/**/*.html', 'src/**/*.json', 'src/img/*', 'src/font/*'],
tasks: ['dist-copy']
js: {
files: ['src/js/**/*.js'],
tasks: ['copy:js']
},
lib: {
files: ['src/lib/**/*.js'],
tasks: ['copy:lib']
},
app: {
files: ['src/*.js', 'src/**/*.html', 'src/**/*.json', 'src/img/**/*', 'src/font/**/*'],
tasks: ['copy:app', 'copy:tpl', 'copy:img', 'copy:font']
}
},
copy: {
npm: {
expand: true,
flatten: true,
src: ['node_modules/crypto-lib/node_modules/node-forge/js/*.js'],
dest: 'src/lib/'
},
npmDev: {
expand: true,
flatten: true,
src: ['node_modules/mocha/mocha.css', 'node_modules/mocha/mocha.js', 'node_modules/chai/chai.js', 'node_modules/sinon/pkg/sinon.js'],
dest: 'test/new-unit/lib/'
},
cryptoLib: {
expand: true,
flatten: true,
src: ['node_modules/crypto-lib/src/*.js'],
dest: 'src/js/crypto/'
},
lib: {
expand: true,
flatten: true,
src: ['src/lib/*'],
dest: 'dist/lib/'
},
js: {
expand: true,
flatten: true,
src: ['src/js/*'],
dest: 'dist/js/'
},
font: {
expand: true,
flatten: true,
@ -120,24 +158,12 @@ module.exports = function(grunt) {
src: ['src/img/*'],
dest: 'dist/img/'
},
js: {
expand: true,
flatten: true,
src: ['src/js/*'],
dest: 'dist/js/'
},
tpl: {
expand: true,
flatten: true,
src: ['src/tpl/*'],
dest: 'dist/tpl/'
},
lib: {
expand: true,
flatten: true,
src: ['src/lib/*'],
dest: 'dist/lib/'
},
app: {
expand: true,
flatten: true,
@ -160,14 +186,15 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-copy');
// Build tasks
grunt.registerTask('dist-npm', ['copy:npm', 'copy:npmDev', 'copy:cryptoLib']);
grunt.registerTask('dist-css', ['sass', 'autoprefixer', 'csso']);
grunt.registerTask('dist-copy', ['copy']);
grunt.registerTask('dist', ['clean', 'dist-css', 'dist-copy']);
grunt.registerTask('dist', ['clean', 'dist-npm', 'dist-css', 'dist-copy']);
grunt.registerTask('default', ['dist']);
// Test/Dev tasks
grunt.registerTask('dev', ['connect:dev']);
grunt.registerTask('test', ['jshint', 'connect:test', 'mocha', 'qunit', 'dist']);
grunt.registerTask('test', ['jshint', 'connect:test', 'mocha', 'qunit']);
grunt.registerTask('prod', ['connect:prod']);
};

View File

@ -5,8 +5,8 @@
"node": ">=0.8"
},
"scripts": {
"postinstall": "./res/copy-deps.sh",
"test": "grunt test",
"postinstall": "./res/copy-deps.sh && grunt dist-npm",
"test": "grunt test && grunt dist",
"start": "grunt dev"
},
"dependencies": {

View File

@ -1,15 +1,11 @@
#!/bin/sh
echo "--> copying dependencies to src\n"
echo "--> building dependencies to src\n"
# go to root
cd `dirname $0`
cd ..
# copy crypto lib
cp ./node_modules/crypto-lib/src/*.js ./src/js/crypto/
cp ./node_modules/crypto-lib/node_modules/node-forge/js/*.js ./src/lib/
# build imap/smtp modules and copy
cd ./node_modules/imap-client/
node build.js && cp ./src-gen/*.js ../../src/lib/
@ -19,10 +15,4 @@ cd ./node_modules/smtp-client/
node build.js && cp ./src-gen/*.js ../../src/lib/
cd ../../
# copy test dependencies
mkdir ./test/new-unit/lib/
cp ./node_modules/mocha/mocha.css ./node_modules/mocha/mocha.js ./test/new-unit/lib/
cp ./node_modules/chai/chai.js ./test/new-unit/lib/
cp ./node_modules/sinon/pkg/sinon.js ./test/new-unit/lib/
echo "\n--> finished copying dependencies.\n"
echo "\n--> finished building dependencies.\n"