source: Dev/trunk/Gruntfile.js @ 467

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

Added authentication (fixed user now).

File size: 4.6 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        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        },
44        copy: {
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            },
61            compile: {
62                files: [{
63                    expand: true,
64                    cwd: srcDir,
65                    src: ['**', '!**/*.coffee', '!**/*.less', '!node_modules/**', '!client/dojo/**', '!client/dijit/**', '!client/dojox/**', '!client/util/**' ],
66                    dest: developmentDir
67                }]
68            },
69            deploy: {
70                files: [{
71                    expand: true,
72                    cwd: developmentDir,
73                    src: ['**', '!client/*/**' ],
74                    dest: productionDir
75                }]
76            }
77        },
78        dojo: {
79            deploy: {
80                options: {
81                    dojo: developmentDir+'client/dojo/dojo.js',
82                    profile: developmentDir+'client/client.profile.js',
83                    releaseDir: '../../../'+productionDir
84                }
85            }
86        },
87        htmlhint: {
88            options: {
89                htmlhintrc: srcDir+".htmlhintrc"
90            },
91            compile: {
92                files: [{
93                    expand: true,
94                    cwd: srcDir,
95                    src: ['client/*.html', 'client/qed-client/**/*.html']
96                }]
97            }
98        },
99        jshint: {
100            options: {
101                jshintrc: srcDir+".jshintrc"
102            },
103            compile: {
104                files: [{
105                    expand: true,
106                    cwd: srcDir,
107                    src: ['client/qed-client/**/*.js', 'server/**.js']
108                }]
109            }
110        },
111        less: {
112            options: {
113                strictImports: false,
114                dumpLineNumbers: "all"
115            },
116            compile: {
117                files: [{
118                    expand: true,
119                    cwd: srcDir,
120                    src: ['client/qed-client/css/qed.less'],
121                    dest: developmentDir,
122                    ext: '.css'
123                }]
124            }
125        }
126    });
127
128    grunt.loadNpmTasks('grunt-coffeelint');
129    grunt.loadNpmTasks('grunt-contrib-clean');
130    grunt.loadNpmTasks('grunt-contrib-coffee');
131    grunt.loadNpmTasks('grunt-contrib-copy');
132    grunt.loadNpmTasks('grunt-contrib-jshint');
133    grunt.loadNpmTasks('grunt-contrib-less');
134    grunt.loadNpmTasks('grunt-dojo');
135    grunt.loadNpmTasks('grunt-htmlhint');
136
137    // development tasks
138    grunt.registerTask('install-deps', ['copy:server-deps', 'copy:client-deps']);
139    grunt.registerTask('lint', ['jshint:compile', 'htmlhint:compile', 'coffeelint:compile']);
140    grunt.registerTask('compile', ['lint', 'less:compile', 'coffee:compile', 'copy:compile']);
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
147    grunt.registerTask('default', ['compile']);
148
149    // util functions
150
151};
Note: See TracBrowser for help on using the repository browser.