-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
37 lines (29 loc) · 1.25 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
var fs = require("fs");
var del = require("del");
var fsx = require("fs-extra");
var path = require("path");
var gulp = require("gulp");
var shell = require("gulp-shell");
const DIRNAME_ARTICLES = "articles";
const PATH_REVIEW_BIN = "/usr/local/bin/";
const PATH_REVIEW_INIT = path.resolve(PATH_REVIEW_BIN, "review-init");
const PATH_REVIEW_PDFMAKER = path.resolve(PATH_REVIEW_BIN, "review-pdfmaker");
gulp.task("init", shell.task(["review-init" + " " + DIRNAME_ARTICLES], {cwd: __dirname}));
gulp.task("_cleanTmp", () => {
del.sync([path.resolve(__dirname, "tmp")]);
});
gulp.task("_copyTmp", ["_cleanTmp"], () => {
var tmpDir = path.resolve(__dirname, "tmp");
var reDir = path.resolve(__dirname, DIRNAME_ARTICLES);
var filter = /.*?\.re$/;
fs.mkdirSync(tmpDir);
fsx.copySync(reDir, tmpDir, filter);
});
gulp.task("lint", ["_copyTmp"], shell.task(["textlint" + " " + path.resolve(__dirname, "tmp")], {ignoreErrors: true}));
gulp.task("_cleanPdf", () => {
del.sync([
path.resolve(__dirname, DIRNAME_ARTICLES, "book.pdf"),
path.resolve(__dirname, DIRNAME_ARTICLES, "book-pdf")
]);
});
gulp.task("pdf", ["_cleanPdf"], shell.task([PATH_REVIEW_PDFMAKER + " " + "config.yml"], {cwd: path.resolve(__dirname, DIRNAME_ARTICLES)}));