diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..85e3bff --- /dev/null +++ b/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +node_js: + - "5" +script: ./renderAndPush.sh +cache: + directories: + - shapefiles diff --git a/Jakefile b/Jakefile index 01a0b5d..f315030 100644 --- a/Jakefile +++ b/Jakefile @@ -90,7 +90,7 @@ file('shapefiles/sldl', { async: true }, () => { 'bash -c "' + 'cd ' + tempdir + ' && ' + 'wget -r -nH --cut-dirs=4 -nc ftp://ftp2.census.gov/geo/tiger/TIGER2014/SLDL && ' + - 'unzip ./\*.zip && ' + + 'unzip ./\\*.zip && ' + 'rm ./*.zip"', 'mv ' + tempdir + ' shapefiles/sldl' ], { printStdout: true, printStderr: true }, complete); @@ -104,7 +104,7 @@ file('shapefiles/sldl', { async: true }, () => { 'bash -c "' + 'cd ' + tempdir + ' && ' + 'wget -r -nH --cut-dirs=4 -nc ftp://ftp2.census.gov/geo/tiger/TIGER2014/SLDL && ' + - 'unzip ./\*.zip && ' + + 'unzip ./\\*.zip && ' + 'rm ./*.zip"', 'mv ' + tempdir + ' shapefiles/sldl' ], { printStdout: true, printStderr: true }, complete); @@ -118,7 +118,7 @@ file('shapefiles/sldu', { async: true }, () => { 'bash -c "' + 'cd ' + tempdir + ' && ' + 'wget -r -nH --cut-dirs=4 -nc ftp://ftp2.census.gov/geo/tiger/TIGER2014/SLDU && ' + - 'unzip ./\*.zip && ' + + 'unzip ./\\*.zip && ' + 'rm ./*.zip"', 'mv ' + tempdir + ' shapefiles/sldl' ], { printStdout: true, printStderr: true }, complete); @@ -132,7 +132,7 @@ file('shapefiles/place', { async: true }, () => { 'bash -c "' + 'cd ' + tempdir + ' && ' + 'wget -r -nH --cut-dirs=4 -nc ftp://ftp2.census.gov/geo/tiger/TIGER2014/PLACE && ' + - 'unzip ./\*.zip && ' + + 'unzip ./\\*.zip && ' + 'rm ./*.zip"', 'mv ' + tempdir + ' shapefiles/place' ], { printStdout: true, printStderr: true }, complete); @@ -146,7 +146,7 @@ file('shapefiles/county', { async: true }, () => { 'bash -c "' + 'cd ' + tempdir + ' && ' + 'wget -r -nH --cut-dirs=4 -nc ftp://ftp2.census.gov/geo/tiger/TIGER2014/COUNTY && ' + - 'unzip ./\*.zip && ' + + 'unzip ./\\*.zip && ' + 'rm ./*.zip"', 'mv ' + tempdir + ' shapefiles/county' ], { printStdout: true, printStderr: true }, complete); @@ -163,7 +163,7 @@ file('shapefiles/cousub', { async: true }, () => { 'bash -c "' + 'cd ' + tempdir + ' && ' + 'wget -r -nH --cut-dirs=4 -nc ftp://ftp2.census.gov/geo/tiger/TIGER2014/COUSUB && ' + - 'unzip ./\*.zip && ' + + 'unzip ./\\*.zip && ' + 'rm ./*.zip"', 'mv ' + tempdir + ' shapefiles/cousub' ], { printStdout: true, printStderr: true }, complete); diff --git a/renderAndPush.sh b/renderAndPush.sh new file mode 100755 index 0000000..1c482ea --- /dev/null +++ b/renderAndPush.sh @@ -0,0 +1,28 @@ +#!/bin/bash +set -euo pipefail + +if ! git diff --quiet; then + echo "You have uncommitted changes that will be blown away!" + exit 1 +fi + +if ! git diff --cached --quiet; then + echo "You have uncommitted changes that will be blown away!" + exit 1 +fi + +if [ ! -d .git ]; then + git init + git config user.name "Travis-CI Deploy Bot" + git config user.email "tomdooner@gmail.com" +fi + +# render everything +npm run render + +git branch -D gh-pages 2>/dev/null || true +git checkout -b gh-pages +mv build/ocd-division . +git add ocd-division +git commit --quiet -m "Generated build at $(date)" +git push --force "https://x-api-token:${GITHUB_AUTH_TOKEN}@github.com/tdooner/brigade-maps.git" gh-pages