source: Dev/trunk/Gruntfile.js @ 464

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

Working deployment to Heroku.

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