[453] | 1 | /*************************************** |
---|
| 2 | * This Gruntfile is organized with two phases, |
---|
| 3 | * compile and build. Compile will lint HTML, |
---|
| 4 | * JavaScript and compile LESS. The build phase |
---|
| 5 | * creates an optimized stand-alone build that |
---|
| 6 | * can be distributed. |
---|
| 7 | */ |
---|
[443] | 8 | var fs = require('fs'); |
---|
| 9 | var path = require('path'); |
---|
| 10 | |
---|
| 11 | module.exports = function(grunt) { |
---|
| 12 | |
---|
[453] | 13 | var buildDir = '../build/'; |
---|
[458] | 14 | var binDir = buildDir+'bin/'; |
---|
| 15 | var distDir = '../dist/'; |
---|
[453] | 16 | |
---|
[443] | 17 | grunt.initConfig({ |
---|
[458] | 18 | clean: { |
---|
| 19 | build: [buildDir] |
---|
| 20 | }, |
---|
[453] | 21 | copy: { |
---|
| 22 | build: { |
---|
| 23 | files: [ |
---|
| 24 | {src: ['client/*.html'], dest: buildDir}, |
---|
| 25 | {src: ['server/**', '!**/node_modules/**'], dest: buildDir}, |
---|
| 26 | {src: ['qed-server.key', 'qed-server.pem'], dest: buildDir}, |
---|
| 27 | ] |
---|
[458] | 28 | }, |
---|
| 29 | dist: { |
---|
| 30 | files: [ |
---|
| 31 | {src: ['client/bin/'], dest: binDir}, |
---|
| 32 | {src: ['server/**', '!**/node_modules/**'], dest: buildDir}, |
---|
| 33 | {src: ['qed-server.key', 'qed-server.pem'], dest: buildDir}, |
---|
| 34 | ] |
---|
[453] | 35 | } |
---|
| 36 | }, |
---|
[458] | 37 | 'curl-dir': { |
---|
| 38 | dist: { |
---|
| 39 | src: [ |
---|
| 40 | 'http://apache.xl-mirror.nl/couchdb/binary/win/1.3.0/setup-couchdb-1.3.0_R15B03-1.exe', |
---|
| 41 | 'http://nodejs.org/dist/v0.10.10/node-v0.10.10-x86.msi' |
---|
| 42 | ], |
---|
| 43 | dest: binDir |
---|
| 44 | } |
---|
| 45 | }, |
---|
[453] | 46 | dojo: { |
---|
[443] | 47 | options: { |
---|
[453] | 48 | dojo: 'client/dojo/dojo.js', |
---|
[443] | 49 | }, |
---|
[453] | 50 | build: { |
---|
| 51 | options: { |
---|
| 52 | profile: 'client/client.profile.js' |
---|
| 53 | } |
---|
| 54 | } |
---|
| 55 | }, |
---|
| 56 | htmlhint: { |
---|
| 57 | options: { |
---|
| 58 | htmlhintrc: ".htmlhintrc" |
---|
| 59 | }, |
---|
| 60 | compile: { |
---|
[443] | 61 | files: { |
---|
[453] | 62 | src: ['client/*.html', 'client/qed-client/**.html'] |
---|
[443] | 63 | } |
---|
| 64 | } |
---|
| 65 | }, |
---|
| 66 | jshint: { |
---|
| 67 | options: { |
---|
| 68 | jshintrc: ".jshintrc" |
---|
| 69 | }, |
---|
[453] | 70 | compile: { |
---|
[443] | 71 | files: { |
---|
[452] | 72 | src: ['client/qed-client/**/*.js', 'server/**.js', '!**/node_modules/**'] |
---|
[443] | 73 | } |
---|
| 74 | } |
---|
| 75 | }, |
---|
[453] | 76 | less: { |
---|
[443] | 77 | options: { |
---|
[453] | 78 | strictImports: false, |
---|
| 79 | dumpLineNumbers: "all" |
---|
[443] | 80 | }, |
---|
[453] | 81 | compile: { |
---|
[443] | 82 | files: { |
---|
[453] | 83 | 'client/qed-client/css/qed.css': 'client/qed-client/css/qed.less' |
---|
[443] | 84 | } |
---|
| 85 | } |
---|
[458] | 86 | }, |
---|
| 87 | zip: { |
---|
| 88 | dist: { |
---|
| 89 | cwd: buildDir, |
---|
| 90 | src: [buildDir+'**'], |
---|
| 91 | dest: distDir+'qed-'+(new Date().toISOString())+'-x86.zip' |
---|
| 92 | } |
---|
[443] | 93 | } |
---|
| 94 | }); |
---|
| 95 | |
---|
[458] | 96 | grunt.loadNpmTasks('grunt-contrib-clean'); |
---|
[453] | 97 | grunt.loadNpmTasks('grunt-contrib-copy'); |
---|
| 98 | grunt.loadNpmTasks('grunt-contrib-jshint'); |
---|
[443] | 99 | grunt.loadNpmTasks('grunt-contrib-less'); |
---|
[458] | 100 | grunt.loadNpmTasks('grunt-curl'); |
---|
[453] | 101 | grunt.loadNpmTasks('grunt-dojo'); |
---|
[443] | 102 | grunt.loadNpmTasks('grunt-htmlhint'); |
---|
[458] | 103 | grunt.loadNpmTasks('grunt-zip'); |
---|
[443] | 104 | |
---|
[453] | 105 | grunt.registerTask('compile', ['less:compile', 'jshint:compile', 'htmlhint:compile']); |
---|
[458] | 106 | grunt.registerTask('build', ['clean:build', 'compile', 'dojo:build', 'copy:build']); |
---|
| 107 | grunt.registerTask('dist', ['build', 'copy:dist', 'curl-dir:dist', 'zip:dist']); |
---|
[453] | 108 | grunt.registerTask('default', ['compile']); |
---|
| 109 | |
---|
[443] | 110 | }; |
---|