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 | */ |
---|
8 | var fs = require('fs'); |
---|
9 | var path = require('path'); |
---|
10 | |
---|
11 | module.exports = function(grunt) { |
---|
12 | |
---|
13 | var buildDir = '../build/'; |
---|
14 | var binDir = buildDir+'bin/'; |
---|
15 | var distDir = '../dist/'; |
---|
16 | |
---|
17 | grunt.initConfig({ |
---|
18 | clean: { |
---|
19 | build: { |
---|
20 | options: { |
---|
21 | force: true |
---|
22 | }, |
---|
23 | src: [buildDir], |
---|
24 | } |
---|
25 | }, |
---|
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 | ] |
---|
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 | ] |
---|
40 | } |
---|
41 | }, |
---|
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 | }, |
---|
51 | dojo: { |
---|
52 | options: { |
---|
53 | dojo: 'client/dojo/dojo.js', |
---|
54 | }, |
---|
55 | build: { |
---|
56 | options: { |
---|
57 | profile: 'client/client.profile.js' |
---|
58 | } |
---|
59 | } |
---|
60 | }, |
---|
61 | htmlhint: { |
---|
62 | options: { |
---|
63 | htmlhintrc: ".htmlhintrc" |
---|
64 | }, |
---|
65 | compile: { |
---|
66 | files: { |
---|
67 | src: ['client/*.html', 'client/qed-client/**.html'] |
---|
68 | } |
---|
69 | } |
---|
70 | }, |
---|
71 | jshint: { |
---|
72 | options: { |
---|
73 | jshintrc: ".jshintrc" |
---|
74 | }, |
---|
75 | compile: { |
---|
76 | files: { |
---|
77 | src: ['client/qed-client/**/*.js', 'server/**.js', '!**/node_modules/**'] |
---|
78 | } |
---|
79 | } |
---|
80 | }, |
---|
81 | less: { |
---|
82 | options: { |
---|
83 | strictImports: false, |
---|
84 | dumpLineNumbers: "all" |
---|
85 | }, |
---|
86 | compile: { |
---|
87 | files: { |
---|
88 | 'client/qed-client/css/qed.css': 'client/qed-client/css/qed.less' |
---|
89 | } |
---|
90 | } |
---|
91 | }, |
---|
92 | zip: { |
---|
93 | dist: { |
---|
94 | cwd: buildDir, |
---|
95 | src: [buildDir+'**'], |
---|
96 | dest: distDir+'qed-'+(new Date().toISOString())+'-x86.zip' |
---|
97 | } |
---|
98 | } |
---|
99 | }); |
---|
100 | |
---|
101 | grunt.loadNpmTasks('grunt-contrib-clean'); |
---|
102 | grunt.loadNpmTasks('grunt-contrib-copy'); |
---|
103 | grunt.loadNpmTasks('grunt-contrib-jshint'); |
---|
104 | grunt.loadNpmTasks('grunt-contrib-less'); |
---|
105 | grunt.loadNpmTasks('grunt-curl'); |
---|
106 | grunt.loadNpmTasks('grunt-dojo'); |
---|
107 | grunt.loadNpmTasks('grunt-htmlhint'); |
---|
108 | grunt.loadNpmTasks('grunt-zip'); |
---|
109 | |
---|
110 | grunt.registerTask('compile', ['less:compile', 'jshint:compile', 'htmlhint:compile']); |
---|
111 | grunt.registerTask('build', ['clean:build', 'compile', 'dojo:build', 'copy:build']); |
---|
112 | grunt.registerTask('dist', ['build', 'copy:dist', 'curl-dir:dist', 'zip:dist']); |
---|
113 | grunt.registerTask('default', ['compile']); |
---|
114 | |
---|
115 | }; |
---|