-
Notifications
You must be signed in to change notification settings - Fork 208
/
Gruntfile.js
87 lines (79 loc) · 2.58 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
'use strict';
var fs = require('fs');
module.exports = function(grunt) {
// Project configuration.
var gruntConf = {
watch: {
options: {
nospawn: true
},
src: {
files: ['src/**/*.coffee'],
tasks: ['coffee:src']
},
static: {
files: ['src/**/*.png', 'src/**/*.less', 'src/**/*.html', 'src/**/*.css', 'src/**/*.js', 'src/**/*.eot', 'src/**/*.otf', 'src/**/*.svg', 'src/**/*.ttf', 'src/**/*.woff', '**/*.ico'],
tasks: ['copy']
}
},
coffee: {
src: {
expand: true,
cwd: 'src',
src: ['**/*.coffee'],
dest: 'bin',
ext: '.js',
options: {
bare: true
}
}
},
copy: {
main: {
files: [{
expand: true,
src: ['**', '!**/*.coffee'],
dest: 'bin',
cwd: 'src'
}, ]
}
},
subgrunt: {},
jasmine_node: {
options: {
forceExit: true,
match: '.',
matchall: false,
extensions: 'js',
specNameMatcher: 'spec'
},
all: ['./tests/spec/']
}
};
var tasks = [];
// var default_plg = fs.readdirSync(__dirname + '/default_plugins');
// for (var i in default_plg) {
// var plugin = default_plg[i];
// if (fs.existsSync(__dirname + '/default_plugins/' + plugin + '/gruntConfig.js')) {
// var task = require('./default_plugins/' + plugin + '/gruntConfig').call(this, gruntConf);
// if (task)
// tasks.push(task);
// }
// if (fs.existsSync(__dirname + '/default_plugins/' + plugin + '/Gruntfile.js')) {
// gruntConf.subgrunt[plugin] = {
// options: {},
// projects: {}
// };
// gruntConf.subgrunt[plugin].projects['./default_plugins/' + plugin] = 'default';
// }
// }
grunt.initConfig(gruntConf);
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-coffee');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-subgrunt');
// Default task.
grunt.registerTask('default', ['coffee', 'copy']);
grunt.registerTask('test', ['jasmine_node:all']);
};