-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathgrunt.js
130 lines (111 loc) · 3.32 KB
/
grunt.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/* This file is part of Context Traits.
Copyright © 2012—2015 UCLouvain.
*/
module.exports = function (grunt) {
'use strict';
var parts = [
'prologue',
'prototypes',
'activation',
'adaptation',
'composition',
'namespaces',
'contexts',
'epilogue' ];
var _ = grunt.utils._;
grunt.initConfig({
pkg: '<json:package.json>',
meta: {
banner: '/* ' + [
'<%= pkg.title %> v<%= pkg.version %>',
'<%= pkg.homepage %>',
'Copyright © 2012—<%= grunt.template.today("yyyy") %> <%= pkg.copyright %>',
'Licensed under <%= _.toSentence(_(pkg.licenses).pluck("type")) %>'
].join('\n ') + ' */'
},
concat: {
lib: {
src: [ '<banner>', 'build/<%= pkg.name %>.js' ],
dest: 'dist/<%= pkg.name %>.js'
},
test: {
src: [ '<banner>', 'build/<%= pkg.name %>-tests.js' ],
dest: 'test/<%= pkg.name %>-tests.js'
},
nodeTest: {
src: [ '<banner>', 'build/test.js' ],
dest: 'test/test.js'
}
},
min: {
lib: {
src: ['<banner:meta.banner>', '<config:concat.lib.dest>'],
dest: 'dist/<%= pkg.name %>.min.js'
}
},
coffee: {
lib: {
src: _.map(parts, function (p) { return 'src/' + p + '.coffee'; }),
dest: 'build/<%= pkg.name %>.js'
},
contexts: {
src: 'src/contexts/',
dest: 'dist/contexts/'
},
test: {
src: _.map(parts, function (p) { return 'test/src/' + p + '.coffee'; }),
dest: 'build/<%= pkg.name %>-tests.js'
}
},
qunit: {
files: ['test/index.html']
},
lint: {
files: ['grunt.js']
},
watch: {
files: [
'<config:coffee.lib.src>',
'<config:coffee.test.src>',
'<config:qunit.files>'
],
tasks: 'targets'
},
jshint: {
options: {
boss: true,
browser: true,
curly: true,
eqeqeq: true,
eqnull: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: true
},
globals: {
exports: true,
module: false
}
},
docco: {
src: [ 'src/*.coffee' ]
},
clean: {
folder: [ "build/" ]
}
});
grunt.loadTasks('.tasks/');
grunt.loadNpmTasks('grunt-clean');
grunt.loadNpmTasks('grunt-docco');
// Generation
grunt.registerTask('libs', 'coffee:lib concat:lib min:lib coffee:contexts');
grunt.registerTask('docs', 'docco');
grunt.registerTask('tests', 'coffee:test concat:test');
grunt.registerTask('targets', 'libs tests docs');
// Commands
grunt.registerTask('test', 'libs tests qunit');
grunt.registerTask('default', 'targets lint qunit');
};