backbone-model-file-upload/Gruntfile.js

85 lines
2.1 KiB
JavaScript
Raw Normal View History

2014-12-17 15:33:48 +08:00
module.exports = function(grunt) {
grunt.initConfig({
run_node: {
start: {
files: { src: [ 'test/mock-file-server.js'] }
2014-12-17 15:33:48 +08:00
}
},
stop_node: { stop: {} },
run: {
installBower: {
cmd: 'node',
args: [
'./node_modules/bower/bin/bower',
'install'
]
},
killAllNodeWindows: {
cmd: 'taskkill',
args: [
'/f',
'/im',
'node.exe'
]
},
killAllNodeMac: {
cmd: 'killall',
args: [
'node'
]
}
},
jasmine: {
amd: {
src: 'backbone-model-file-upload.js',
host: 'http://localhost:8888/',
options: {
specs: ['test/*spec.js'],
helpers: 'bower_components/Blob/Blob.js',
//keepRunner: true,
template: require('grunt-template-jasmine-requirejs'),
templateOptions: {
requireConfig: {
paths: {
"jquery": "bower_components/jquery/dist/jquery.min",
"underscore": "bower_components/underscore/underscore-min",
"backbone": "bower_components/backbone/backbone"
}
}
},
2014-12-17 15:33:48 +08:00
}
},
browserGlobal: {
src: 'backbone-model-file-upload.js',
host: 'http://localhost:8888/',
options: {
specs: ['test/*spec.js'],
//keepRunner: true,
vendor: [
"bower_components/Blob/Blob.js",
"bower_components/jquery/dist/jquery.min.js",
"bower_components/underscore/underscore-min.js",
"bower_components/backbone/backbone.js"
]
}
2014-12-17 15:33:48 +08:00
}
}
2014-12-17 15:33:48 +08:00
});
grunt.loadNpmTasks('grunt-contrib-jasmine');
grunt.loadNpmTasks('grunt-run');
grunt.loadNpmTasks('grunt-run-node');
grunt.registerTask('test', ['build','run_node','jasmine','stop_node']);
grunt.registerTask('build', ['run:installBower']);
2014-12-17 15:33:48 +08:00
grunt.registerTask('resetNodeWin', ['run:killAllNodeWindows']);
grunt.registerTask('resetNodeMac', ['run:killAllNodeMac']);
};