This repository has been archived by the owner on Jul 25, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Gruntfile.js
71 lines (65 loc) · 2 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
module.exports = function (grunt) {
var config = {
pkg: grunt.file.readJSON('package.json'),
jshint: {
all: [
'Gruntfile.js',
'bin/*.js'
]
},
nodeunit: {
all: [
'bin/test.js'
]
},
concat: {
srcMacros: {
src: ['src/*.sjs'],
dest: 'bin/src.sjs'
},
testMacros: {
src: ['test/*.js', 'bin/src.sjs'],
dest: 'bin/test.sjs'
}
},
macro: {
all: {
}
},
clean: {
all: {
src: 'bin'
}
},
sweet: {
all: {
src: 'bin/test.sjs',
dest: 'bin/test.js'
}
}
};
grunt.initConfig(config);
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-nodeunit');
grunt.registerMultiTask('macro', 'Run macro sweet.js unit tests with nodeunit.', function() {
grunt.task.run([ 'clean',
'jshint',
'concat:srcMacros',
'concat:testMacros',
'sweet',
'nodeunit'
]);
});
grunt.registerMultiTask('clean', 'Clean bin folder', function() {
var shell = require('shelljs'),
options = this.data;
shell.rm('-rf', options.src);
});
grunt.registerMultiTask('sweet', 'Run sweet.js', function() {
var shell = require('shelljs'),
options = this.data;
shell.exec('sjs -o ' + options.dest + ' ' + options.src);
});
grunt.registerTask('default', ['macro']);
};