-
Notifications
You must be signed in to change notification settings - Fork 260
Expand file tree
/
Copy pathgrunt.js
More file actions
46 lines (41 loc) · 921 Bytes
/
grunt.js
File metadata and controls
46 lines (41 loc) · 921 Bytes
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
/*jshint node:true */
module.exports = function( grunt ) {
var entryFiles = grunt.file.expandFiles( "entries/*.xml" );
grunt.initConfig({
lint: {
grunt: "grunt.js"
},
xmllint: {
all: entryFiles
}
});
grunt.registerTask( "xmllint", function() {
var task = this,
taskDone = task.async();
grunt.utils.async.forEachSeries( entryFiles, function( fileName, fileDone ) {
grunt.verbose.write( "Linting " + fileName + "..." );
grunt.utils.spawn({
cmd: "xmllint",
args: [ "--noout", fileName ]
}, function( err, result ) {
if ( err ) {
grunt.verbose.error();
grunt.log.error( err );
fileDone();
return;
}
grunt.verbose.ok();
fileDone();
});
}, function() {
if ( task.errorCount ) {
grunt.warn( "Task \"xmllint\" failed." );
taskDone();
return;
}
grunt.log.writeln( "Lint free." );
taskDone();
});
});
grunt.registerTask( "default", "lint xmllint" );
};