/*************************************** * This Gruntfile is organized with two phases, * compile and build. Compile will lint HTML, * JavaScript and compile LESS. The build phase * creates an optimized stand-alone build that * can be distributed. */ var fs = require('fs'); var path = require('path'); module.exports = function(grunt) { var buildDir = '../build/'; var binDir = buildDir+'bin/'; var distDir = '../dist/'; grunt.initConfig({ clean: { build: { options: { force: true }, src: [buildDir], } }, copy: { build: { files: [ {src: ['client/*.html'], dest: buildDir}, {src: ['server/**', '!**/node_modules/**'], dest: buildDir}, {src: ['qed-server.key', 'qed-server.pem'], dest: buildDir}, ] }, dist: { files: [ {src: ['client/bin/'], dest: binDir}, {src: ['server/**', '!**/node_modules/**'], dest: buildDir}, {src: ['qed-server.key', 'qed-server.pem'], dest: buildDir}, ] } }, 'curl-dir': { dist: { src: [ 'http://apache.xl-mirror.nl/couchdb/binary/win/1.3.0/setup-couchdb-1.3.0_R15B03-1.exe', 'http://nodejs.org/dist/v0.10.10/node-v0.10.10-x86.msi' ], dest: binDir } }, dojo: { options: { dojo: 'client/dojo/dojo.js', }, build: { options: { profile: 'client/client.profile.js' } } }, htmlhint: { options: { htmlhintrc: ".htmlhintrc" }, compile: { files: { src: ['client/*.html', 'client/qed-client/**.html'] } } }, jshint: { options: { jshintrc: ".jshintrc" }, compile: { files: { src: ['client/qed-client/**/*.js', 'server/**.js', '!**/node_modules/**'] } } }, less: { options: { strictImports: false, dumpLineNumbers: "all" }, compile: { files: { 'client/qed-client/css/qed.css': 'client/qed-client/css/qed.less' } } }, zip: { dist: { cwd: buildDir, src: [buildDir+'**'], dest: distDir+'qed-'+(new Date().toISOString())+'-x86.zip' } } }); grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-less'); grunt.loadNpmTasks('grunt-curl'); grunt.loadNpmTasks('grunt-dojo'); grunt.loadNpmTasks('grunt-htmlhint'); grunt.loadNpmTasks('grunt-zip'); grunt.registerTask('compile', ['less:compile', 'jshint:compile', 'htmlhint:compile']); grunt.registerTask('build', ['clean:build', 'compile', 'dojo:build', 'copy:build']); grunt.registerTask('dist', ['build', 'copy:dist', 'curl-dir:dist', 'zip:dist']); grunt.registerTask('default', ['compile']); };