This repository has been archived by the owner on Mar 29, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
gulpfile.js
62 lines (49 loc) · 1.72 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const gulp = require("gulp");
const tests = ["TSLintArgs", "TSLintCli", "TSLintCliLocalTSLint", "TSLintInclude", "TSLintOutput", "TSLintVersion", "TSLintFileListDisabled"];
const testTasks = tests.map(testName => `test:${testName}`);
tests.forEach(testName => {
const msbuild = require("gulp-msbuild");
const path = require("path");
gulp.task(`test:${testName}`, () => {
return gulp.src(`./test/${testName}/${testName}.sln`)
.pipe(msbuild({
configuration: "Debug",
properties: {
OutputPath: path.normalize("../../../test/bin")
},
stdout: true
}));
});
});
gulp.task("test", callback => {
const runSequence = require("run-sequence");
runSequence(...testTasks, callback);
});
gulp.task("nuget-download", callback => {
const fs = require("fs");
const request = require("request");
if (fs.existsSync("nuget.exe")) {
callback();
return;
}
request.get("http://nuget.org/nuget.exe")
.pipe(fs.createWriteStream("nuget.exe"))
.on("close", () => {
if (fs.statSync("nuget.exe").size <= 0) {
throw new Error([
"Could not download nuget.exe from http://nuget.org/nuget.exe.",
"Try downloading it to " + __dirname + " manually."
].join(" "));
}
callback();
});
});
gulp.task("nuget-pack", () => {
const nuget = require("gulp-nuget");
return gulp.src("TSLint.MSBuild.nuspec")
.pipe(nuget.pack({
nuget: "./nuget.exe"
}))
.pipe(gulp.dest("dist"));
});
gulp.task("default", ["test", "nuget-download", "nuget-pack"]);