fix archive creation

This commit is contained in:
Florian Dold 2016-03-18 15:35:50 +01:00
parent ffe4eb7091
commit 987061062f
3 changed files with 43 additions and 9 deletions

View File

@ -43,7 +43,7 @@ pogen: $(ts) pogen/pogen.js node_modules
done; \ done; \
rm $$pos rm $$pos
dist: dist: node_modules
$(gulp) srcdist $(gulp) srcdist
appdist: appdist:

View File

@ -32,11 +32,13 @@
const gulp = require("gulp"); const gulp = require("gulp");
const map = require("map-stream"); const map = require("map-stream");
const zip = require("gulp-zip"); const zip = require("gulp-zip");
const gzip = require("gulp-gzip");
const rename = require("gulp-rename");
const tar = require("gulp-tar");
const concat = require("gulp-concat"); const concat = require("gulp-concat");
const gspawn = require("gulp-spawn");
const gexec = require("gulp-exec");
const ts = require("gulp-typescript"); const ts = require("gulp-typescript");
const debug = require("gulp-debug"); const debug = require("gulp-debug");
const glob = require("glob");
const jsonTransform = require('gulp-json-transform'); const jsonTransform = require('gulp-json-transform');
const fs = require("fs"); const fs = require("fs");
const del = require("del"); const del = require("del");
@ -73,6 +75,7 @@ const paths = {
"README", "README",
"COPYING", "COPYING",
"Makefile", "Makefile",
"configure",
"gulpfile.js", "gulpfile.js",
"tsconfig.json", "tsconfig.json",
"package.json", "package.json",
@ -130,6 +133,32 @@ let manifest;
})(); })();
/**
* File globbing that works just like
* gulp.src(...).
*/
function gglob(ps) {
let patPos = [];
let patNeg = [];
for (let x of ps) {
if (x.slice(0,1) === "!") {
patNeg.push(x.slice(1));
} else {
patPos.push(x);
console.log("Pattern", x);
}
}
let result = new Set();
for (let pat of patPos) {
let rs = glob.sync(pat, {ignore: patNeg});
for (let r of rs) {
result.add(r);
}
}
return Array.from(result);
}
gulp.task("clean", function () { gulp.task("clean", function () {
return del("build/ext"); return del("build/ext");
}); });
@ -191,9 +220,11 @@ gulp.task("package-unstable", ["compile-prod", "dist-prod", "manifest-unstable"]
* Create source distribution. * Create source distribution.
*/ */
gulp.task("srcdist", [], function () { gulp.task("srcdist", [], function () {
let zipname = String.prototype.concat("taler-wallet-webex", manifest.version, "-src.zip"); let name = String.prototype.concat("taler-wallet-webex-", manifest.version);
return gulp.src(paths.srcdist, {buffer: false, stripBOM: false, base: "."}) return gulp.src(paths.srcdist, {buffer: false, stripBOM: false, base: "."})
.pipe(zip(zipname)) .pipe(rename(function (p) { p.dirname = name + "/" + p.dirname; }))
.pipe(tar(name + "-src.tar"))
.pipe(gzip())
.pipe(gulp.dest(".")); .pipe(gulp.dest("."));
}); });
@ -203,7 +234,7 @@ gulp.task("srcdist", [], function () {
* French copyright application. * French copyright application.
*/ */
gulp.task("appdist", [], function () { gulp.task("appdist", [], function () {
let zipname = String.prototype.concat("taler-wallet-webex", manifest.version, "-appsrc.zip"); let zipname = String.prototype.concat("taler-wallet-webex-", manifest.version, "-appsrc.zip");
return gulp.src(paths.appdist, {buffer: false, stripBOM: false, base: "."}) return gulp.src(paths.appdist, {buffer: false, stripBOM: false, base: "."})
.pipe(zip(zipname)) .pipe(zip(zipname))
.pipe(gulp.dest(".")); .pipe(gulp.dest("."));
@ -224,8 +255,8 @@ gulp.task("pogenjs", [], function () {
/** /**
* Extract .po files from source code * Extract .po files from source code
*/ */
gulp.task("pogen", ["pogenjs"], function () { gulp.task("pogen", ["pogenjs"], function (cb) {
throw Error("not implemented yet, use 'make pogen'"); throw Error("not yet implemented");
}); });

View File

@ -15,12 +15,15 @@
"devDependencies": { "devDependencies": {
"better-assert": "^1.0.2", "better-assert": "^1.0.2",
"del": "^2.2.0", "del": "^2.2.0",
"glob": "^7.0.3",
"gulp": "^3.9.1", "gulp": "^3.9.1",
"gulp-concat": "^2.6.0", "gulp-concat": "^2.6.0",
"gulp-debug": "^2.1.2", "gulp-debug": "^2.1.2",
"gulp-gzip": "^1.2.0",
"gulp-json-transform": "^0.3.0", "gulp-json-transform": "^0.3.0",
"gulp-spawn": "^0.3.0", "gulp-rename": "^1.2.2",
"gulp-stream": "0.0.2", "gulp-stream": "0.0.2",
"gulp-tar": "^1.8.0",
"gulp-typescript": "^2.10.0", "gulp-typescript": "^2.10.0",
"gulp-zip": "^3.1.0", "gulp-zip": "^3.1.0",
"jed": "^1.1.0", "jed": "^1.1.0",