[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: { |
---|
[462] | 19 | build: { |
---|
| 20 | options: { |
---|
| 21 | force: true |
---|
| 22 | }, |
---|
| 23 | src: [buildDir], |
---|
| 24 | } |
---|
[458] | 25 | }, |
---|
[453] | 26 | copy: { |
---|
| 27 | build: { |
---|
| 28 | files: [ |
---|
| 29 | {src: ['client/*.html'], dest: buildDir}, |
---|
| 30 | {src: ['server/**', '!**/node_modules/**'], dest: buildDir}, |
---|
| 31 | {src: ['qed-server.key', 'qed-server.pem'], dest: buildDir}, |
---|
| 32 | ] |
---|
[458] | 33 | }, |
---|
| 34 | dist: { |
---|
| 35 | files: [ |
---|
| 36 | {src: ['client/bin/'], dest: binDir}, |
---|
| 37 | {src: ['server/**', '!**/node_modules/**'], dest: buildDir}, |
---|
| 38 | {src: ['qed-server.key', 'qed-server.pem'], dest: buildDir}, |
---|
| 39 | ] |
---|
[453] | 40 | } |
---|
| 41 | }, |
---|
[458] | 42 | 'curl-dir': { |
---|
| 43 | dist: { |
---|
| 44 | src: [ |
---|
| 45 | 'http://apache.xl-mirror.nl/couchdb/binary/win/1.3.0/setup-couchdb-1.3.0_R15B03-1.exe', |
---|
| 46 | 'http://nodejs.org/dist/v0.10.10/node-v0.10.10-x86.msi' |
---|
| 47 | ], |
---|
| 48 | dest: binDir |
---|
| 49 | } |
---|
| 50 | }, |
---|
[453] | 51 | dojo: { |
---|
[443] | 52 | options: { |
---|
[453] | 53 | dojo: 'client/dojo/dojo.js', |
---|
[443] | 54 | }, |
---|
[453] | 55 | build: { |
---|
| 56 | options: { |
---|
| 57 | profile: 'client/client.profile.js' |
---|
| 58 | } |
---|
| 59 | } |
---|
| 60 | }, |
---|
| 61 | htmlhint: { |
---|
| 62 | options: { |
---|
| 63 | htmlhintrc: ".htmlhintrc" |
---|
| 64 | }, |
---|
| 65 | compile: { |
---|
[443] | 66 | files: { |
---|
[453] | 67 | src: ['client/*.html', 'client/qed-client/**.html'] |
---|
[443] | 68 | } |
---|
| 69 | } |
---|
| 70 | }, |
---|
| 71 | jshint: { |
---|
| 72 | options: { |
---|
| 73 | jshintrc: ".jshintrc" |
---|
| 74 | }, |
---|
[453] | 75 | compile: { |
---|
[443] | 76 | files: { |
---|
[452] | 77 | src: ['client/qed-client/**/*.js', 'server/**.js', '!**/node_modules/**'] |
---|
[443] | 78 | } |
---|
| 79 | } |
---|
| 80 | }, |
---|
[453] | 81 | less: { |
---|
[443] | 82 | options: { |
---|
[453] | 83 | strictImports: false, |
---|
| 84 | dumpLineNumbers: "all" |
---|
[443] | 85 | }, |
---|
[453] | 86 | compile: { |
---|
[443] | 87 | files: { |
---|
[453] | 88 | 'client/qed-client/css/qed.css': 'client/qed-client/css/qed.less' |
---|
[443] | 89 | } |
---|
| 90 | } |
---|
[458] | 91 | }, |
---|
| 92 | zip: { |
---|
| 93 | dist: { |
---|
| 94 | cwd: buildDir, |
---|
| 95 | src: [buildDir+'**'], |
---|
| 96 | dest: distDir+'qed-'+(new Date().toISOString())+'-x86.zip' |
---|
| 97 | } |
---|
[443] | 98 | } |
---|
| 99 | }); |
---|
| 100 | |
---|
[458] | 101 | grunt.loadNpmTasks('grunt-contrib-clean'); |
---|
[453] | 102 | grunt.loadNpmTasks('grunt-contrib-copy'); |
---|
| 103 | grunt.loadNpmTasks('grunt-contrib-jshint'); |
---|
[443] | 104 | grunt.loadNpmTasks('grunt-contrib-less'); |
---|
[458] | 105 | grunt.loadNpmTasks('grunt-curl'); |
---|
[453] | 106 | grunt.loadNpmTasks('grunt-dojo'); |
---|
[443] | 107 | grunt.loadNpmTasks('grunt-htmlhint'); |
---|
[458] | 108 | grunt.loadNpmTasks('grunt-zip'); |
---|
[443] | 109 | |
---|
[453] | 110 | grunt.registerTask('compile', ['less:compile', 'jshint:compile', 'htmlhint:compile']); |
---|
[458] | 111 | grunt.registerTask('build', ['clean:build', 'compile', 'dojo:build', 'copy:build']); |
---|
| 112 | grunt.registerTask('dist', ['build', 'copy:dist', 'curl-dir:dist', 'zip:dist']); |
---|
[453] | 113 | grunt.registerTask('default', ['compile']); |
---|
| 114 | |
---|
[443] | 115 | }; |
---|