1
0
mirror of https://github.com/moparisthebest/mail synced 2024-12-22 07:18:49 -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.10"
- "0.8" - "0.8"
before_script: before_script:
- gem install sass
- npm install -g grunt-cli - npm install -g grunt-cli
notifications: notifications:
email: email:

View File

@ -102,12 +102,50 @@ module.exports = function(grunt) {
files: ['src/sass/**/*.scss'], files: ['src/sass/**/*.scss'],
tasks: ['dist-css'] tasks: ['dist-css']
}, },
code: { js: {
files: ['src/**/*.js', 'src/**/*.html', 'src/**/*.json', 'src/img/*', 'src/font/*'], files: ['src/js/**/*.js'],
tasks: ['dist-copy'] 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: { 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: { font: {
expand: true, expand: true,
flatten: true, flatten: true,
@ -120,24 +158,12 @@ module.exports = function(grunt) {
src: ['src/img/*'], src: ['src/img/*'],
dest: 'dist/img/' dest: 'dist/img/'
}, },
js: {
expand: true,
flatten: true,
src: ['src/js/*'],
dest: 'dist/js/'
},
tpl: { tpl: {
expand: true, expand: true,
flatten: true, flatten: true,
src: ['src/tpl/*'], src: ['src/tpl/*'],
dest: 'dist/tpl/' dest: 'dist/tpl/'
}, },
lib: {
expand: true,
flatten: true,
src: ['src/lib/*'],
dest: 'dist/lib/'
},
app: { app: {
expand: true, expand: true,
flatten: true, flatten: true,
@ -160,14 +186,15 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-copy');
// Build tasks // Build tasks
grunt.registerTask('dist-npm', ['copy:npm', 'copy:npmDev', 'copy:cryptoLib']);
grunt.registerTask('dist-css', ['sass', 'autoprefixer', 'csso']); grunt.registerTask('dist-css', ['sass', 'autoprefixer', 'csso']);
grunt.registerTask('dist-copy', ['copy']); 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']); grunt.registerTask('default', ['dist']);
// Test/Dev tasks // Test/Dev tasks
grunt.registerTask('dev', ['connect:dev']); 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']); grunt.registerTask('prod', ['connect:prod']);
}; };

View File

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

View File

@ -1,15 +1,11 @@
#!/bin/sh #!/bin/sh
echo "--> copying dependencies to src\n" echo "--> building dependencies to src\n"
# go to root # go to root
cd `dirname $0` cd `dirname $0`
cd .. 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 # build imap/smtp modules and copy
cd ./node_modules/imap-client/ cd ./node_modules/imap-client/
node build.js && cp ./src-gen/*.js ../../src/lib/ 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/ node build.js && cp ./src-gen/*.js ../../src/lib/
cd ../../ cd ../../
# copy test dependencies echo "\n--> finished building dependencies.\n"
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"