[464] | 1 | /** Gruntfile - control build and deploy tasks |
---|
[453] | 2 | */ |
---|
[443] | 3 | |
---|
| 4 | module.exports = function(grunt) { |
---|
| 5 | |
---|
[464] | 6 | var srcDir = 'src/'; |
---|
[463] | 7 | var buildDir = 'build/'; |
---|
[464] | 8 | var developmentDir = buildDir+'development/'; |
---|
| 9 | var productionDir = buildDir+'production/'; |
---|
[453] | 10 | |
---|
[443] | 11 | grunt.initConfig({ |
---|
[458] | 12 | clean: { |
---|
[464] | 13 | development: { |
---|
| 14 | src: [developmentDir] |
---|
| 15 | }, |
---|
| 16 | production: { |
---|
| 17 | src: [productionDir] |
---|
[462] | 18 | } |
---|
[458] | 19 | }, |
---|
[463] | 20 | coffee: { |
---|
| 21 | options: { |
---|
| 22 | bare: true |
---|
[458] | 23 | }, |
---|
[463] | 24 | compile: { |
---|
| 25 | files: [{ |
---|
| 26 | expand: true, |
---|
| 27 | cwd: srcDir, |
---|
| 28 | src: ['client/qed-client/**/*.coffee', 'server/**/*.coffee'], |
---|
[464] | 29 | dest: developmentDir, |
---|
[463] | 30 | ext: '.js' |
---|
| 31 | }] |
---|
[453] | 32 | } |
---|
| 33 | }, |
---|
[466] | 34 | coffeelint: { |
---|
| 35 | compile: { |
---|
| 36 | options: require('./'+srcDir+'.coffeelint.json'), |
---|
| 37 | files: [{ |
---|
| 38 | expand: true, |
---|
| 39 | cwd: srcDir, |
---|
| 40 | src: ['client/qed-client/**/*.coffee', 'server/**.coffee'] |
---|
| 41 | }] |
---|
| 42 | } |
---|
| 43 | }, |
---|
[463] | 44 | copy: { |
---|
[464] | 45 | 'client-deps': { |
---|
| 46 | files: [{ |
---|
| 47 | expand: true, |
---|
| 48 | cwd: srcDir, |
---|
| 49 | src: ['client/dojo/**', 'client/dijit/**', 'client/dojox/**', 'client/util/**'], |
---|
| 50 | dest: developmentDir |
---|
| 51 | }] |
---|
| 52 | }, |
---|
| 53 | 'server-deps': { |
---|
| 54 | files: [{ |
---|
| 55 | expand: true, |
---|
| 56 | cwd: srcDir, |
---|
| 57 | src: ['node_modules/**'], |
---|
| 58 | dest: developmentDir |
---|
| 59 | }] |
---|
| 60 | }, |
---|
[463] | 61 | compile: { |
---|
| 62 | files: [{ |
---|
[464] | 63 | expand: true, |
---|
| 64 | cwd: srcDir, |
---|
| 65 | src: ['**', '!**/*.coffee', '!**/*.less', '!node_modules/**', '!client/dojo/**', '!client/dijit/**', '!client/dojox/**', '!client/util/**' ], |
---|
| 66 | dest: developmentDir |
---|
[463] | 67 | }] |
---|
[464] | 68 | }, |
---|
| 69 | deploy: { |
---|
| 70 | files: [{ |
---|
| 71 | expand: true, |
---|
| 72 | cwd: developmentDir, |
---|
| 73 | src: ['**', '!client/*/**' ], |
---|
| 74 | dest: productionDir |
---|
| 75 | }] |
---|
[458] | 76 | } |
---|
| 77 | }, |
---|
[453] | 78 | dojo: { |
---|
[464] | 79 | deploy: { |
---|
[453] | 80 | options: { |
---|
[464] | 81 | dojo: developmentDir+'client/dojo/dojo.js', |
---|
| 82 | profile: developmentDir+'client/client.profile.js', |
---|
| 83 | releaseDir: '../../../'+productionDir |
---|
[453] | 84 | } |
---|
| 85 | } |
---|
| 86 | }, |
---|
| 87 | htmlhint: { |
---|
| 88 | options: { |
---|
[463] | 89 | htmlhintrc: srcDir+".htmlhintrc" |
---|
[453] | 90 | }, |
---|
| 91 | compile: { |
---|
[463] | 92 | files: [{ |
---|
| 93 | expand: true, |
---|
| 94 | cwd: srcDir, |
---|
| 95 | src: ['client/*.html', 'client/qed-client/**/*.html'] |
---|
| 96 | }] |
---|
[443] | 97 | } |
---|
| 98 | }, |
---|
| 99 | jshint: { |
---|
| 100 | options: { |
---|
[463] | 101 | jshintrc: srcDir+".jshintrc" |
---|
[443] | 102 | }, |
---|
[453] | 103 | compile: { |
---|
[463] | 104 | files: [{ |
---|
| 105 | expand: true, |
---|
| 106 | cwd: srcDir, |
---|
| 107 | src: ['client/qed-client/**/*.js', 'server/**.js'] |
---|
| 108 | }] |
---|
[443] | 109 | } |
---|
| 110 | }, |
---|
[453] | 111 | less: { |
---|
[443] | 112 | options: { |
---|
[453] | 113 | strictImports: false, |
---|
| 114 | dumpLineNumbers: "all" |
---|
[443] | 115 | }, |
---|
[453] | 116 | compile: { |
---|
[463] | 117 | files: [{ |
---|
| 118 | expand: true, |
---|
| 119 | cwd: srcDir, |
---|
| 120 | src: ['client/qed-client/css/qed.less'], |
---|
[464] | 121 | dest: developmentDir, |
---|
[463] | 122 | ext: '.css' |
---|
| 123 | }] |
---|
[443] | 124 | } |
---|
| 125 | } |
---|
| 126 | }); |
---|
| 127 | |
---|
[466] | 128 | grunt.loadNpmTasks('grunt-coffeelint'); |
---|
[458] | 129 | grunt.loadNpmTasks('grunt-contrib-clean'); |
---|
[463] | 130 | grunt.loadNpmTasks('grunt-contrib-coffee'); |
---|
[453] | 131 | grunt.loadNpmTasks('grunt-contrib-copy'); |
---|
| 132 | grunt.loadNpmTasks('grunt-contrib-jshint'); |
---|
[443] | 133 | grunt.loadNpmTasks('grunt-contrib-less'); |
---|
[453] | 134 | grunt.loadNpmTasks('grunt-dojo'); |
---|
[443] | 135 | grunt.loadNpmTasks('grunt-htmlhint'); |
---|
| 136 | |
---|
[464] | 137 | // development tasks |
---|
| 138 | grunt.registerTask('install-deps', ['copy:server-deps', 'copy:client-deps']); |
---|
[466] | 139 | grunt.registerTask('lint', ['jshint:compile', 'htmlhint:compile', 'coffeelint:compile']); |
---|
| 140 | grunt.registerTask('compile', ['lint', 'less:compile', 'coffee:compile', 'copy:compile']); |
---|
[464] | 141 | grunt.registerTask('build', ['clean:development', 'install-deps', 'compile']); |
---|
| 142 | |
---|
| 143 | // production tasks |
---|
| 144 | grunt.registerTask('deploy', ['clean:production', 'copy:deploy', 'dojo:deploy']); |
---|
| 145 | |
---|
| 146 | // default task is quick compile |
---|
[453] | 147 | grunt.registerTask('default', ['compile']); |
---|
| 148 | |
---|
[466] | 149 | // util functions |
---|
| 150 | |
---|
[443] | 151 | }; |
---|