This repository has been archived by the owner on Mar 26, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 68
/
Gruntfile.js
110 lines (104 loc) · 2.14 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
'use strict';
module.exports = function (grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [
'Gruntfile.js',
'lib/*.js',
'bin/*.js',
'test/**/*.js'
]
},
clean: {
bower: 'bower_components',
tmp: 'tmp'
},
copy: {
unit: {
expand: true,
cwd: 'test/unit/fixtures/bower_components',
src: ['**/*'],
dest: 'tmp/bower_components'
},
acceptance: {
expand: true,
cwd: 'test/acceptance/fixtures',
src: ['*.js', '!*-expected.js'],
dest: 'tmp/'
}
},
simplemocha: {
options: {
reporter: 'dot',
timeout: '5000'
},
bin: {
src: ['test/binary/*.js']
},
unit: {
src: ['test/unit/*.js']
},
acceptance: {
src: ['test/acceptance/*.js']
}
},
bower: {
options: {
exclude: ['underscore']
},
standard: {
rjsConfig: 'tmp/config.js'
},
pathless: {
rjsConfig: 'tmp/pathless-config.js'
},
global: {
rjsConfig: 'tmp/global-config.js'
},
baseurl: {
options: {
baseUrl: './'
},
rjsConfig: 'tmp/baseurl.js'
}
}
});
grunt.registerTask('mkdir', function (dir) {
require('fs').mkdirSync(dir);
});
grunt.registerTask('bower-install', function () {
var done = this.async();
grunt.util.spawn({
cmd: 'bower',
args: ['install'],
opts: {
stdio: 'inherit'
}
}, function (error, result) {
if (error) {
grunt.fail.fatal(result.stdout);
}
grunt.log.writeln(result.stdout);
done();
});
});
grunt.registerTask('reset-tmp', ['clean:tmp', 'mkdir:tmp']);
grunt.registerTask('test', [
'clean',
'mkdir:tmp',
'bower-install',
'simplemocha:bin',
'reset-tmp',
'copy:unit',
'simplemocha:unit',
'reset-tmp',
'copy:acceptance',
'simplemocha:acceptance',
'clean'
]);
grunt.registerTask('default', ['test']);
};