forked from PowerShell/DscResource.Tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
46 lines (41 loc) · 1.23 KB
/
gulpfile.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
var gulp = require("gulp");
var concat = require("gulp-concat");
var through2 = require("through2");
var markdownlint = require("markdownlint");
gulp.task("test-mdsyntax", function task() {
var paths = [];
var i = process.argv.indexOf("--dscresourcespath");
if (i > -1) {
paths.push(process.argv[i + 1] + '/**/*.md');
}
var j = process.argv.indexOf("--rootpath");
if (j > -1) {
paths.push(process.argv[j + 1] + '/*.md');
}
var settingsPath;
var indexOfSettingsPathArgument = process.argv.indexOf("--settingspath");
if (indexOfSettingsPathArgument > -1) {
settingsPath = process.argv[indexOfSettingsPathArgument + 1];
}
else
{
settingsPath = "./.markdownlint.json"
}
return gulp.src(paths, { "read": false })
.pipe(through2.obj(function obj(file, enc, next) {
markdownlint(
{
"files": [file.path],
"config": require(settingsPath)
},
function callback(err, result) {
var resultString = (result || "").toString();
if (resultString) {
file.contents = new Buffer(resultString);
}
next(err, file);
});
}))
.pipe(concat("markdownissues.txt", { newLine: "\r\n" }))
.pipe(gulp.dest("."));
});