source: Dev/trunk/src/Gruntfile.js @ 458

Last change on this file since 458 was 458, checked in by hendrikvanantwerpen, 12 years ago

Build distribution zip with Grunt.

File size: 3.4 KB
Line 
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 */
8var fs = require('fs');
9var path = require('path');
10
11module.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: [buildDir]
20        },
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                ]
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                ]
35            }
36        },
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        },
46        dojo: {
47            options: {
48                dojo: 'client/dojo/dojo.js',
49            },
50            build: {
51                options: {
52                    profile: 'client/client.profile.js'
53                }
54            }
55        },
56        htmlhint: {
57            options: {
58                htmlhintrc: ".htmlhintrc"
59            },
60            compile: {
61                files: {
62                    src: ['client/*.html', 'client/qed-client/**.html']
63                }
64            }
65        },
66        jshint: {
67            options: {
68                jshintrc: ".jshintrc"
69            },
70            compile: {
71                files: {
72                    src: ['client/qed-client/**/*.js', 'server/**.js', '!**/node_modules/**']
73                }
74            }
75        },
76        less: {
77            options: {
78                strictImports: false,
79                dumpLineNumbers: "all"
80            },
81            compile: {
82                files: {
83                    'client/qed-client/css/qed.css': 'client/qed-client/css/qed.less'
84                }
85            }
86        },
87        zip: {
88            dist: {
89                cwd: buildDir,
90                src: [buildDir+'**'],
91                dest: distDir+'qed-'+(new Date().toISOString())+'-x86.zip'
92            }
93        }
94    });
95
96    grunt.loadNpmTasks('grunt-contrib-clean');
97    grunt.loadNpmTasks('grunt-contrib-copy');
98    grunt.loadNpmTasks('grunt-contrib-jshint');
99    grunt.loadNpmTasks('grunt-contrib-less');
100    grunt.loadNpmTasks('grunt-curl');
101    grunt.loadNpmTasks('grunt-dojo');
102    grunt.loadNpmTasks('grunt-htmlhint');
103    grunt.loadNpmTasks('grunt-zip');
104
105    grunt.registerTask('compile', ['less:compile', 'jshint:compile', 'htmlhint:compile']);
106    grunt.registerTask('build', ['clean:build', 'compile', 'dojo:build', 'copy:build']);
107    grunt.registerTask('dist', ['build', 'copy:dist', 'curl-dir:dist', 'zip:dist']);
108    grunt.registerTask('default', ['compile']);
109
110};
Note: See TracBrowser for help on using the repository browser.