Merge pull request #270 from nrenner/standalone-zip

Standalone release zip
This commit is contained in:
Norbert Renner 2019-12-31 18:42:54 +01:00 committed by GitHub
commit 568cd887d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 115 additions and 39 deletions

2
.gitignore vendored
View file

@ -5,6 +5,6 @@ nbproject/
/config.js /config.js
/keys.js /keys.js
/dist /dist
brouter-web.*.zip brouter-web*.zip
yarn-error.log yarn-error.log
package-lock.json package-lock.json

View file

@ -15,6 +15,21 @@
if (hostname.endsWith('brouter.de')) { if (hostname.endsWith('brouter.de')) {
// online service (brouter.de) configuration // online service (brouter.de) configuration
BR.conf.host = origin;
BR.conf.profilesUrl = origin + '/brouter/profiles2/';
} else {
// desktop configuration
BR.conf.host = 'http://localhost:17777';
// Pre-loading selected profile disabled locally. Needs brouter-web to run on a
// local web server with the profiles in a subdirectory or allowing file access
// in the Browser (security!), see
// https://github.com/mrdoob/three.js/wiki/How-to-run-things-locally
BR.conf.profilesUrl = 'http://localhost:8000/profiles2/';
//BR.conf.profilesUrl = 'file://YOUR_PATH_TO/profiles2/';
}
BR.conf.profiles = [ BR.conf.profiles = [
'trekking', 'trekking',
'fastbike', 'fastbike',
@ -36,34 +51,6 @@
'hiking-beta' 'hiking-beta'
]; ];
BR.conf.host = origin;
BR.conf.profilesUrl = origin + '/brouter/profiles2/';
} else {
// desktop configuration
BR.conf.profiles = [
'trekking',
'fastbike',
'car-eco',
'car-fast',
'shortest',
'moped',
'vm-forum-liegerad-schnell',
'vm-forum-velomobil-schnell',
'fastbike-lowtraffic',
'fastbike-asia-pacific'
];
BR.conf.host = 'http://0.0.0.0:17777';
// Pre-loading selected profile disabled locally. Needs brouter-web to run on a
// local web server with the profiles in a subdirectory or allowing file access
// in the Browser (security!), see
// https://github.com/mrdoob/three.js/wiki/How-to-run-things-locally
//BR.conf.profilesUrl = 'http://localhost:8000/profiles2/';
//BR.conf.profilesUrl = 'file://YOUR_PATH_TO/profiles2/';
}
// Removes default base layers when 'true'. Useful for only having custom layers (see below). // Removes default base layers when 'true'. Useful for only having custom layers (see below).
BR.conf.clearBaseLayers = false; BR.conf.clearBaseLayers = false;

View file

@ -26,6 +26,7 @@ var scanner = require('i18next-scanner');
var jsonConcat = require('gulp-json-concat'); var jsonConcat = require('gulp-json-concat');
var rename = require('gulp-rename'); var rename = require('gulp-rename');
var browserSync = require('browser-sync'); var browserSync = require('browser-sync');
var merge = require('merge-stream');
const server = browserSync.create(); const server = browserSync.create();
@ -73,6 +74,7 @@ var paths = {
'layers/config/geometry.js' 'layers/config/geometry.js'
], ],
layersConfigDestName: 'layersConf.js', layersConfigDestName: 'layersConf.js',
zip: ['dist/**', 'index.html', 'config.template.js', 'keys.template.js'],
dest: 'dist', dest: 'dist',
destName: 'brouter-web' destName: 'brouter-web'
}; };
@ -336,16 +338,77 @@ gulp.task(
cb(); cb();
}) })
); );
gulp.task('release:zip', function() { gulp.task('release:zip', function() {
gutil.log(gutil.colors.green('Build brouter-web.' + nextVersion + '.zip')); gutil.log(gutil.colors.green('Build brouter-web.' + nextVersion + '.zip'));
return gulp return gulp
.src(['dist/**', 'index.html', 'config.template.js', 'keys.template.js'], { .src(paths.zip, {
base: '.' base: '.'
}) })
.pipe(zip('brouter-web.' + nextVersion + '.zip')) .pipe(zip('brouter-web.' + nextVersion + '.zip'))
.pipe(gulp.dest('.')); .pipe(gulp.dest('.'));
}); });
gulp.task('release:zip_standalone', function() {
var version = pkg.version;
var destName = 'brouter-web-standalone.' + version + '.zip';
gutil.log(gutil.colors.green('Build ' + destName));
var brouterWeb = gulp
.src(paths.zip, {
base: '.'
})
.pipe(
rename(function(path) {
path.dirname = 'brouter-web/' + path.dirname;
})
);
var root = gulp.src(['resources/standalone/run.sh', 'resources/standalone/segments4']);
var serverRoot = gulp
.src(
[
'misc/readmes/profile_developers_guide.txt',
'brouter-server/target/brouter-server-*-jar-with-dependencies.jar'
],
{
cwd: path.join(process.cwd(), '../brouter')
}
)
.pipe(
rename(function(path) {
if (path.basename.startsWith('brouter-server-')) {
path.basename = 'brouter';
}
})
);
var serverProfiles = gulp.src(
[
'profiles2/**',
'!profiles2/all.brf',
'!profiles2/car-eco-suspect_scan.brf',
'!profiles2/car-traffic_analysis.brf',
'!profiles2/softaccess.brf'
],
{
cwd: path.join(process.cwd(), '../brouter/misc/'),
base: '../brouter/misc/'
}
);
var serverScripts = gulp.src(['standalone/**'], {
cwd: path.join(process.cwd(), '../brouter/misc/scripts/'),
base: '../brouter/misc/scripts/'
});
return merge(brouterWeb, root, serverRoot, serverProfiles, serverScripts)
.pipe(zip(destName))
.pipe(gulp.dest('.'));
});
gulp.task('release:publish', function() { gulp.task('release:publish', function() {
return gulp.src('./brouter-web.' + nextVersion + '.zip').pipe( return gulp.src('./brouter-web.' + nextVersion + '.zip').pipe(
release({ release({

View file

@ -11,7 +11,8 @@
"test": "gulp", "test": "gulp",
"lint": "eslint .", "lint": "eslint .",
"prettier": "prettier --write '**/*'", "prettier": "prettier --write '**/*'",
"serve": "gulp serve watch" "serve": "gulp serve watch",
"standalone": "mvn clean install -f ../brouter -pl '!brouter-routing-app' -Dmaven.javadoc.skip=true && ../brouter/misc/scripts/generate_profile_variants.sh && gulp release:zip_standalone"
}, },
"husky": { "husky": {
"hooks": { "hooks": {
@ -105,6 +106,7 @@
"gulp-zip": "^4.0.0", "gulp-zip": "^4.0.0",
"husky": "^2.3.0", "husky": "^2.3.0",
"i18next-scanner": "^2.9.1", "i18next-scanner": "^2.9.1",
"merge-stream": "^2.0.0",
"node-fetch": "^2.3.0", "node-fetch": "^2.3.0",
"npmfiles": "^0.1.1", "npmfiles": "^0.1.1",
"prettier": "^1.17.1", "prettier": "^1.17.1",

View file

@ -0,0 +1,15 @@
#!/bin/sh
cd "$(dirname "$0")"
# start script for standalone zip
# start BRouter server on localhost
x-terminal-emulator -T "BRouter server" -e "./standalone/local.sh"
# start HTTP server for current directory (for brouter-web and profiles)
#x-terminal-emulator -T "BRouter-Web HTTP server" -e "python -m SimpleHTTPServer 8000"
x-terminal-emulator -T "BRouter-Web HTTP server" -e "python3 -m http.server 8000 --bind localhost"
# open BRouter-Web in default browser
xdg-open http://localhost:8000/brouter-web/

View file

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View file

@ -5278,6 +5278,11 @@ merge-stream@^1.0.0:
dependencies: dependencies:
readable-stream "^2.0.1" readable-stream "^2.0.1"
merge-stream@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60"
integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==
micromatch@^3.0.4, micromatch@^3.1.10, micromatch@^3.1.4: micromatch@^3.0.4, micromatch@^3.1.10, micromatch@^3.1.4:
version "3.1.10" version "3.1.10"
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23"