diff --git a/.gitignore b/.gitignore index f91ec08..450048e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,7 @@ *.swp *.pyc *.log -js/mobile.js -js/init_plot.js -js/version.json -css/mobile.css +/index.html +/js/version.json cache.manifest -tiles/ \ No newline at end of file +tiles/ diff --git a/DEVELOPER_README.md b/DEVELOPER_README.md index 3272308..2cf294a 100644 --- a/DEVELOPER_README.md +++ b/DEVELOPER_README.md @@ -4,6 +4,6 @@ To get a copy of the code and run a test web server: 1. [Fork the repository](https://github.com/projecthorus/sondehub-tracker/fork) by visiting [https://github.com/projecthorus/sondehub-tracker/fork](https://github.com/projecthorus/sondehub-tracker/fork). 2. Clone the repository with your git tool of choice. -3. Run `build.sh` to compile the javascript files. (This requires Java to be installed and in your path.) +3. Run `build.sh` to generate `index.html` and `js/version.json`. 4. Run `python serve.py` to run a simple web server to (This requires python 3.x) 5. Visit [http://localhost:8000](http://localhost:8000) to view the local version of the server! diff --git a/Dockerfile b/Dockerfile index fbb1bdb..53107d5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM alpine:latest -RUN apk add --no-cache python3 openjdk11 sed git +RUN apk add --no-cache python3 sed git WORKDIR /app ADD . . diff --git a/README.md b/README.md index 2a812de..42427be 100644 --- a/README.md +++ b/README.md @@ -36,8 +36,6 @@ Pull requests are welcome. ## Installation -Requirements: Java - $ git clone https://github.com/projecthorus/sondehub-tracker.git $ ./build.sh $ python serve.py diff --git a/build.sh b/build.sh index ecabd0e..096c1c0 100755 --- a/build.sh +++ b/build.sh @@ -1,50 +1,18 @@ #!/bin/bash -# compile stylesheet -echo -n "Compiling CSS... " -cd css -rm -f mobile.css -cat base.css skeleton.css layout.css habitat-font.css main.css leaflet.css leaflet.fullscreen.css skewt.css > mobile.tmp -java -jar "../tools/yuicompressor-2.4.8.jar" --type=css mobile.tmp > mobile.css -rm -f mobile.tmp -cd .. -echo "Done!" - -#compile javascript -echo -n "Compiling JavaScript... " -cd js -rm -f mobile.js init_plot.js -# precompiled libs -cat jquery* >> mobile.js +set -e VERSION="`git rev-parse --short HEAD`" - BUILD_DATE="`date -u +%Y-%m-%dT%H:%M:%SZ`" -# compile the rest -java -jar "../tools/yuicompressor-2.4.8.jar" --type=js --disable-optimizations --nomunge iscroll.js >> mobile.js -java -jar "../tools/yuicompressor-2.4.8.jar" --type=js --disable-optimizations --nomunge chasecar.lib.js | sed "s/{VER}/$VERSION/" >> mobile.js -java -jar "../tools/yuicompressor-2.4.8.jar" --type=js --disable-optimizations --nomunge tracker.js >> mobile.js -java -jar "../tools/yuicompressor-2.4.8.jar" --type=js --disable-optimizations --nomunge app.js | sed "s/{VER}/$VERSION/" | sed "s/{BUILD_DATE}/$BUILD_DATE/" >> mobile.js -java -jar "../tools/yuicompressor-2.4.8.jar" --type=js --disable-optimizations --nomunge colour-map.js >> mobile.js -java -jar "../tools/yuicompressor-2.4.8.jar" --type=js --disable-optimizations --nomunge xdata.js >> mobile.js -java -jar "../tools/yuicompressor-2.4.8.jar" --type=js --disable-optimizations --nomunge station.js >> mobile.js -java -jar "../tools/yuicompressor-2.4.8.jar" --type=js --disable-optimizations --nomunge format.js >> mobile.js - -#compile plot lib and config -java -jar "../tools/yuicompressor-2.4.8.jar" --type=js --disable-optimizations --nomunge _jquery.flot.js >> init_plot.js -java -jar "../tools/yuicompressor-2.4.8.jar" --type=js --disable-optimizations --nomunge plot_config.js >> init_plot.js - # create version check file -echo "{\"build_date\": \"$BUILD_DATE\", \"version\": \"$VERSION\", \"refresh\": 86400}" > version.json - -cd .. +echo -n "Generating js/version.json... " +echo "{\"build_date\": \"$BUILD_DATE\", \"version\": \"$VERSION\", \"refresh\": 86400}" > js/version.json echo "Done!" # cache fixes -sed -i'' "s/{VER}/$VERSION/" index.html -sed -i'' "s/{VER}/$VERSION/" service-worker.js - +echo -n "Generating index.html... " +sed -e "s/{VER}/$VERSION/" -e "s/{BUILD_DATE}/$BUILD_DATE/" index.template.html > index.html echo "Done!" echo "Build version: $VERSION Build date: $BUILD_DATE" diff --git a/index.html b/index.template.html similarity index 97% rename from index.html rename to index.template.html index f214f36..5bca398 100644 --- a/index.html +++ b/index.template.html @@ -19,10 +19,17 @@ - + + + + + + + + -
+