From b9a717e4e4f756a6e2534ec29f063f32d818f1d0 Mon Sep 17 00:00:00 2001 From: Matt DelSordo Date: Wed, 22 Aug 2018 13:41:45 -0400 Subject: [PATCH] Automate page building and add to gh-pages travis build --- .gitignore | 4 + demo/L.UTFGrid-min.js | 1 - demo/client-filter.html | 155 ----------------------------- demo/layer-filter.html | 145 --------------------------- demo/raster.html | 136 ------------------------- demo/style.css | 27 ----- demo/utf-grid.html | 125 ----------------------- demo/vector.html | 207 --------------------------------------- docker-compose.yml | 1 + index.html | 81 --------------- scripts/build-demo-pages | 7 ++ scripts/deploy-demo.sh | 8 ++ src/pug/Dockerfile | 2 +- 13 files changed, 21 insertions(+), 878 deletions(-) delete mode 100644 demo/L.UTFGrid-min.js delete mode 100644 demo/client-filter.html delete mode 100644 demo/layer-filter.html delete mode 100644 demo/raster.html delete mode 100644 demo/style.css delete mode 100644 demo/utf-grid.html delete mode 100644 demo/vector.html delete mode 100644 index.html create mode 100755 scripts/build-demo-pages diff --git a/.gitignore b/.gitignore index 5f240c4f..19e604d9 100644 --- a/.gitignore +++ b/.gitignore @@ -66,3 +66,7 @@ typings/ # configs, if generated transpiled-configs/ + +#demo html pages, if generated +demo/* +index.html diff --git a/demo/L.UTFGrid-min.js b/demo/L.UTFGrid-min.js deleted file mode 100644 index 487b114d..00000000 --- a/demo/L.UTFGrid-min.js +++ /dev/null @@ -1 +0,0 @@ -function corslite(t,e,i){function o(t){return t>=200&&t<300||304===t}function n(){void 0===a.status||o(a.status)?e.call(a,null,a):e.call(a,a,null)}var l=!1;if(void 0===window.XMLHttpRequest)return e(Error("Browser not supported"));if(void 0===i){var s=t.match(/^\s*https?:\/\/[^\/]*/);i=s&&s[0]!==location.protocol+"//"+location.hostname+(location.port?":"+location.port:"")}var a=new window.XMLHttpRequest;if(i&&!("withCredentials"in a)){a=new window.XDomainRequest;var r=e;e=function(){if(l)r.apply(this,arguments);else{var t=this,e=arguments;setTimeout(function(){r.apply(t,e)},0)}}}return"onload"in a?a.onload=n:a.onreadystatechange=function(){4===a.readyState&&n()},a.onerror=function(t){e.call(this,t||!0,null),e=function(){}},a.onprogress=function(){},a.ontimeout=function(t){e.call(this,t,null),e=function(){}},a.onabort=function(t){e.call(this,t,null),e=function(){}},a.open("GET",t,!0),a.send(null),l=!0,a}"undefined"!=typeof module&&(module.exports=corslite),L.UTFGrid=L.TileLayer.extend({options:{resolution:4,pointerCursor:!0,mouseInterval:66},_mouseOn:null,_mouseOnTile:null,_tileCharCode:null,_cache:null,_idIndex:null,_throttleMove:null,_updateCursor:function(){},onAdd:function(t){this._cache={},this._idIndex={},L.TileLayer.prototype.onAdd.call(this,t),this._throttleMove=L.Util.throttle(this._move,this.options.mouseInterval,this),this.options.pointerCursor&&(this._updateCursor=function(t){this._container.style.cursor=t}),t.on("boxzoomstart",this._disconnectMapEventHandlers,this),t.on("boxzoomend",this._throttleConnectEventHandlers,this),this._connectMapEventHandlers()},onRemove:function(){var t=this._map;t.off("boxzoomstart",this._disconnectMapEventHandlers,this),t.off("boxzoomend",this._throttleConnectEventHandlers,this),this._disconnectMapEventHandlers(),this._updateCursor(""),L.TileLayer.prototype.onRemove.call(this,t)},createTile:function(t){return this._loadTile(t),document.createElement("div")},setUrl:function(t,e){return this._cache={},L.TileLayer.prototype.setUrl.call(this,t,e)},_connectMapEventHandlers:function(){this._map.on("click",this._onClick,this),this._map.on("mousemove",this._throttleMove,this)},_disconnectMapEventHandlers:function(){this._map.off("click",this._onClick,this),this._map.off("mousemove",this._throttleMove,this)},_throttleConnectEventHandlers:function(){setTimeout(this._connectMapEventHandlers.bind(this),100)},_update:function(t,e){L.TileLayer.prototype._update.call(this,t,e)},_loadTile:function(t){var e=this.getTileUrl(t),i=this._tileCoordsToKey(t),o=this;this._cache[i]||corslite(e,function(t,e){if(t)return void o.fire("error",{error:t});var n=JSON.parse(e.responseText);o._cache[i]=n,L.Util.bind(o._handleTileLoad,o)(i,n)},!0)},_handleTileLoad:function(t,e){},_onClick:function(t){this.fire("click",this._objectForEvent(t))},_move:function(t){if(null!=t.latlng){var e=this._objectForEvent(t);e._tileCharCode!==this._tileCharCode?(this._mouseOn&&(this.fire("mouseout",{latlng:t.latlng,data:this._mouseOn,_tile:this._mouseOnTile,_tileCharCode:this._tileCharCode}),this._updateCursor("")),e.data&&(this.fire("mouseover",e),this._updateCursor("pointer")),this._mouseOn=e.data,this._mouseOnTile=e._tile,this._tileCharCode=e._tileCharCode):e.data&&this.fire("mousemove",e)}},_objectForEvent:function(t){if(t.latlng){var e=this._map,i=e.project(t.latlng),o=this.options.tileSize,n=this.options.resolution,l=Math.floor(i.x/o),s=Math.floor(i.y/o),a=Math.floor((i.x-l*o)/n),r=Math.floor((i.y-s*o)/n),h=e.options.crs.scale(e.getZoom())/o;l=(l+h)%h,s=(s+h)%h;var d=this._tileCoordsToKey({z:e.getZoom(),x:l,y:s}),u=this._cache[d];if(!u)return{latlng:t.latlng,data:null,_tile:null,_tileCharCode:null};var c=u.grid[r].charCodeAt(a),_=this._utfDecode(c),f=u.keys[_],p=u.data[f];return u.data.hasOwnProperty(f)||(p=null),{latlng:t.latlng,data:p,id:p?p.id:null,_tile:d,_tileCharCode:d+":"+c}}},_dataForCharCode:function(t,e){var i=this._cache[t],o=this._utfDecode(e),n=i.keys[o],l=i.data[n];return i.data.hasOwnProperty(n)||(l=null),l},_utfDecode:function(t){return t>=93&&t--,t>=35&&t--,t-32},_utfEncode:function(t){var e=t+32;return e>=34&&e++,e>=92&&e++,e}}),L.utfGrid=function(t,e){return new L.UTFGrid(t,e)},L.UTFGridCanvas=L.UTFGrid.extend({options:{idField:"ID",buildIndex:!0,fillColor:"black",shadowBlur:0,shadowColor:null,debug:!1},_adjacentTiles:null,onAdd:function(t){this._adjacentTiles=[],L.UTFGrid.prototype.onAdd.call(this,t)},createTile:function(t){this._loadTile(t);var e=document.createElement("canvas");return e.width=e.height=this.options.tileSize,this.options.debug&&this._drawDefaultTile(e.getContext("2d"),this._tileCoordsToKey(t)),e},_connectMapEventHandlers:function(){L.UTFGrid.prototype._connectMapEventHandlers.call(this),this.on("mouseover",this._handleMouseOver,this),this.on("mouseout",this._handleMouseOut,this)},_disconnectMapEventHandlers:function(){L.UTFGrid.prototype._disconnectMapEventHandlers.call(this),this.off("mouseover",this._handleMouseOver,this),this.off("mouseout",this._handleMouseOut,this)},_handleMouseOver:function(t){if(null!=t._tile&&null!=t._tileCharCode){this._clearAdjacentTiles();var e=t._tile;if(this._drawTile(e,parseInt(t._tileCharCode.split(":")[3])),t.data&&this._idIndex){var i=t.data[this.options.idField],o=e.split(":")[2];if(!(i&&this._idIndex[i]&&this._idIndex[i][o]))return;var n=this._idIndex[i][o];for(var l in n)l!==e&&(this._drawTile(l,n[l]),this._adjacentTiles.push(l))}}},_handleMouseOut:function(t){this._resetTile(t._tile),this._clearAdjacentTiles()},_clearAdjacentTiles:function(){if(this._adjacentTiles){for(var t=0;t - - - - Tilegarden - - - - - - - - - - - - -
- -
-

Filter by Query

-

Allow users to modify pre-defined layers by specifying filter conditions.

-
-
- https://yourtiles.cloudfront.net/tile/{z}/{x}/{y}.png?layers=PARK,PRIV -
-
-
-
-
- PWD stormwater billing parcels. The primary purpose of PWD_PARCEL layer is to calculate parcel-based stormwater charges for PWD customers under the new parcel-based stormwater billing program. | City of Philadelphia -
-
-
-
-
- - -
-
-
-
-
-
- - - - - diff --git a/demo/layer-filter.html b/demo/layer-filter.html deleted file mode 100644 index ed31eee5..00000000 --- a/demo/layer-filter.html +++ /dev/null @@ -1,145 +0,0 @@ - - - - - Tilegarden - - - - - - - - - - - - -
- -
-

Filter by Layer

-

Define customizable map layers that can be queried by your users.

-
-
- https://yourtiles.cloudfront.net/tile/{z}/{x}/{y}.png?layers=["PARK","PRIV"] -
-
-
-
-
- This point layer contains all the wastewater and stormwater inlets in Philadelphia with latitude and longitude coordinates. | City of Philadelphia -
-
-
-
-
- - -
- -
-
-
-
- - - - - diff --git a/demo/raster.html b/demo/raster.html deleted file mode 100644 index d8a164da..00000000 --- a/demo/raster.html +++ /dev/null @@ -1,136 +0,0 @@ - - - - - Tilegarden | Raster Tiles - - - - - - - - - - - - -
- -
-

Raster Tiles

-

- Serve your geospatial data as raster tiles, specified and styled via CartoCSS. -

-
-
- https://yourtiles.cloudfront.net/tile/{z}/{x}/{y}.png -
-
-
-
-
- This point layer contains all the wastewater and stormwater inlets in Philadelphia with latitude and longitude coordinates. | City of Philadelphia -
-
-
-
-
- - -
-
-
-
-
- - - - diff --git a/demo/style.css b/demo/style.css deleted file mode 100644 index b0fb1637..00000000 --- a/demo/style.css +++ /dev/null @@ -1,27 +0,0 @@ -html, body { - height: 100%; -} - -body { - display: flex; - flex-direction: column; -} - -footer { - width: 100%; - line-height: 40px; - flex-shrink: 0; -} - -footer div { - background-color: #f8f9fa; -} - -.content { - flex: 1 0 auto; -} - -#map { - width: 100%; - height: 500px; -} diff --git a/demo/utf-grid.html b/demo/utf-grid.html deleted file mode 100644 index 500c02a8..00000000 --- a/demo/utf-grid.html +++ /dev/null @@ -1,125 +0,0 @@ - - - - - Tilegarden | UTF Grids - - - - - - - - - - - - - -
- -
-

UTF Grids

-

Serve UTF grids and interact with your data.

-
-
- https://yourtiles.cloudfront.net/tile/{z}/{x}/{y}.png?utfFields=owner,operator -
-
-
- -
Mouse over me!
- -
- This point layer contains all the wastewater and stormwater inlets in Philadelphia with latitude and longitude coordinates. | City of Philadelphia -
-
-
- -
-
- - - - - diff --git a/demo/vector.html b/demo/vector.html deleted file mode 100644 index 906a3ec8..00000000 --- a/demo/vector.html +++ /dev/null @@ -1,207 +0,0 @@ - - - - - Tilegarden | Vector Tiles - - - - - - - - - - - - - -
- -
-

Vector Tiles

-

Serve your geospatial data as Mapbox Vector Tiles for client-side styling and manipulation.

-
-
- https://yourtiles.cloudfront.net/vector/{z}/{x}/{y}.png -
-
-
-
-
- This point layer contains all the wastewater and stormwater inlets in Philadelphia with latitude and longitude coordinates. | City of Philadelphia -
-
-
-
-
- - -
-
- Style - -
-
- -
-
-
-
-
- - - - - diff --git a/docker-compose.yml b/docker-compose.yml index dea1a52b..93811b4f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -50,6 +50,7 @@ services: dockerfile: Dockerfile volumes: - ./src/pug:/home/pug + - ./src/pug/out:/home/pug/out volumes: node_modules: diff --git a/index.html b/index.html deleted file mode 100644 index c525f08d..00000000 --- a/index.html +++ /dev/null @@ -1,81 +0,0 @@ - - - - - Tilegarden - - - - - - - - - - -
- -
-
-
-

Tilegarden: Serverless Mapnik Rendering

- -

- Tilegarden is a serverless tileserver built for AWS Lambda. All the power of a conventional tileserver without needing to worry about provisioning, scaling, or uptime costs. - - Click below for demos of Tilegarden's functionality. -

-
-

Demos:

- -
-
-
- - - - - diff --git a/scripts/build-demo-pages b/scripts/build-demo-pages new file mode 100755 index 00000000..f50b1b10 --- /dev/null +++ b/scripts/build-demo-pages @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +set -e + +docker-compose run pug +cp -R src/pug/out/* . +cp -R src/pug/pages/demo/scripts/ demo/ diff --git a/scripts/deploy-demo.sh b/scripts/deploy-demo.sh index 62a0b86f..6f52b5c4 100755 --- a/scripts/deploy-demo.sh +++ b/scripts/deploy-demo.sh @@ -15,6 +15,13 @@ cd "${REPO_TEMP}" git checkout gh-pages echo "Merging with ${CURRENT_BRANCH}" git merge "${CURRENT_BRANCH}" + +# Generate new github pages +./scripts/update +./scripts/build-demo-pages +git add -A +git commit -m "Re-build html pages" + # make sure there wasn't a merge conflict # exit if there's a merge conflict, this can be handled # normally, but the actual tests haven't failed @@ -23,6 +30,7 @@ if [[ $(git ls-files -u) ]]; then exit 0 fi + # Decrypt .env openssl aes-256-cbc -K $encrypted_f456ba71c182_key -iv $encrypted_f456ba71c182_iv -in .env.enc -out .env -d diff --git a/src/pug/Dockerfile b/src/pug/Dockerfile index 626c3a6b..b1004556 100644 --- a/src/pug/Dockerfile +++ b/src/pug/Dockerfile @@ -5,4 +5,4 @@ RUN yarn global add pug-cli COPY . /home/pug WORKDIR /home/pug -ENTRYPOINT ["pug", "pages"] +ENTRYPOINT ["pug", "pages", "-o", "out/", "-P"]