diff --git a/Makefile b/Makefile index 58f5eddcc..9d2236d01 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ pogen: $(ts) pogen/pogen.js node_modules done; \ rm $$pos -dist: +dist: node_modules $(gulp) srcdist appdist: diff --git a/gulpfile.js b/gulpfile.js index 8c2f5b1c3..49715e4f2 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -32,11 +32,13 @@ const gulp = require("gulp"); const map = require("map-stream"); 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 gspawn = require("gulp-spawn"); -const gexec = require("gulp-exec"); const ts = require("gulp-typescript"); const debug = require("gulp-debug"); +const glob = require("glob"); const jsonTransform = require('gulp-json-transform'); const fs = require("fs"); const del = require("del"); @@ -73,6 +75,7 @@ const paths = { "README", "COPYING", "Makefile", + "configure", "gulpfile.js", "tsconfig.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 () { return del("build/ext"); }); @@ -191,9 +220,11 @@ gulp.task("package-unstable", ["compile-prod", "dist-prod", "manifest-unstable"] * Create source distribution. */ 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: "."}) - .pipe(zip(zipname)) + .pipe(rename(function (p) { p.dirname = name + "/" + p.dirname; })) + .pipe(tar(name + "-src.tar")) + .pipe(gzip()) .pipe(gulp.dest(".")); }); @@ -203,7 +234,7 @@ gulp.task("srcdist", [], function () { * French copyright application. */ 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: "."}) .pipe(zip(zipname)) .pipe(gulp.dest(".")); @@ -224,8 +255,8 @@ gulp.task("pogenjs", [], function () { /** * Extract .po files from source code */ -gulp.task("pogen", ["pogenjs"], function () { - throw Error("not implemented yet, use 'make pogen'"); +gulp.task("pogen", ["pogenjs"], function (cb) { + throw Error("not yet implemented"); }); diff --git a/package.json b/package.json index 980375f37..e36b22776 100644 --- a/package.json +++ b/package.json @@ -15,12 +15,15 @@ "devDependencies": { "better-assert": "^1.0.2", "del": "^2.2.0", + "glob": "^7.0.3", "gulp": "^3.9.1", "gulp-concat": "^2.6.0", "gulp-debug": "^2.1.2", + "gulp-gzip": "^1.2.0", "gulp-json-transform": "^0.3.0", - "gulp-spawn": "^0.3.0", + "gulp-rename": "^1.2.2", "gulp-stream": "0.0.2", + "gulp-tar": "^1.8.0", "gulp-typescript": "^2.10.0", "gulp-zip": "^3.1.0", "jed": "^1.1.0",