2019-06-29 22:16:09 +08:00
|
|
|
/* RainLoop Webmail (c) RainLoop Team | Licensed under AGPL 3 */
|
|
|
|
const gulp = require('gulp');
|
|
|
|
const rimraf = require('gulp-rimraf');
|
|
|
|
const fs = require('node-fs');
|
|
|
|
|
2019-07-05 03:09:27 +08:00
|
|
|
const { config } = require('./config');
|
2019-06-29 22:16:09 +08:00
|
|
|
|
2019-07-05 03:09:27 +08:00
|
|
|
exports.del = (dir) => gulp.src(dir, { read: false, allowEmpty: true }).pipe(rimraf());
|
2019-06-29 22:16:09 +08:00
|
|
|
|
|
|
|
exports.copy = (sFile, sNewFile, done) => {
|
|
|
|
fs.writeFileSync(sNewFile, fs.readFileSync(sFile));
|
|
|
|
done();
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.zip = (srcDir, destDir, fileName) =>
|
2019-07-05 03:09:27 +08:00
|
|
|
gulp
|
|
|
|
.src(srcDir + '**/*')
|
2019-06-29 22:16:09 +08:00
|
|
|
.pipe(require('gulp-zip')(fileName))
|
|
|
|
.pipe(gulp.dest(destDir));
|
|
|
|
|
|
|
|
exports.getHead = () => (!config.community ? config.head.rainloop : config.head.agpl);
|
|
|
|
|
|
|
|
exports.cleanStatic = () => exports.del(config.paths.static);
|