-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.js
95 lines (88 loc) · 1.91 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
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
const exec = require('child_process').exec;
const fs = require('fs');
const gulp = require('gulp');
const markdownPdf = require('gulp-markdown-pdf');
const rename = require('gulp-rename');
const toc = require('gulp-markdown-toc');
const APP_VERSION = require('./package.json').version;
// doc
gulp.task('doc', ['_readme', '_readme-ja', '_version']);
// readme
gulp.task('_readme', ['_readme:pdf']);
gulp.task('_readme:pdf', () => {
return gulp
.src('README.md')
.pipe(
toc({
linkify: function(content) {
return content;
},
})
)
.pipe(
markdownPdf({
cssPath: 'readme.css',
})
)
.pipe(
rename({
basename: 'README',
extname: '.pdf',
})
)
.pipe(gulp.dest('build'));
});
gulp.task('_readme-ja', ['_readme-ja:pdf']);
gulp.task('_readme-ja:pdf', () => {
return gulp
.src('README-ja.md')
.pipe(
toc({
linkify: function(content) {
return content;
},
})
)
.pipe(
markdownPdf({
cssPath: 'readme.css',
})
)
.pipe(
rename({
basename: 'README-ja',
extname: '.pdf',
})
)
.pipe(gulp.dest('build'));
});
// version
gulp.task('_version', (cb) => {
fs.writeFile('build/version.txt', APP_VERSION, (err) => {
cb(err);
});
});
// zip
gulp.task('zip', (cb) => {
exec(
'ditto -c -k --sequesterRsrc --keepParent build build.zip',
(err, stdout, stderr) => {
cb(err);
}
);
});
// codesign
gulp.task('codesign', (cb) => {
const DEVELOPER_ID_APPLICATION_KEY = "Developer ID Application: Taku Omi (52QJ97GWTE)";
const APP_PATH = "*.dmg";
exec(
'/usr/bin/codesign' +
` -s "${DEVELOPER_ID_APPLICATION_KEY}" \
--deep \
--keychain "/Users/${process.env.USER}/Library/Keychains/login.keychain" \
${APP_PATH}`,
(err, stdout, stderr) => {
cb(err);
}
);
});