Website for durhamatletico.com
First, install the dependencies:
npm install -g csv2json
pip install --user csvkit
If you're on a Mac, you'll want to add export PATH=$HOME/Library/Python/2.7/bin:$PATH
to your ~/.bashrc
. If on Linux it will be export PATH=$HOME/.local/bin:$PATH
.
Check if which csv2json
and which csvgrep
both work.
Yes, the build script is a little hacky. Sorry. You'll need to edit the _scripts/build.sh
file to alter how the schedule gets parsed for output onto the website. The tl;dr is that we're adding the match dates for the upcoming week to the first line, and then adding last week's match dates to all the remaining lines. See below for example.
Edit all the lines that start with cat
. This example is for the week of games on 8/3/2015|8/4/2015
.
cat /tmp/futsal.csv | csvgrep -c 1 -r "7/27/2015|7/28/2015" | csv2json > _data/2015/summer/week.json
becomescat /tmp/futsal.csv | csvgrep -c 1 -r "8/3/2015|8/4/2015" | csv2json > _data/2015/summer/week.json
cat /tmp/futsal.csv | csvgrep -i -c 1 -r "6/15/2015|6/16/2015|6/22/2015|6/23/2015|6/29/2015|6/30/2015|7/6/2015|7/7/2015|7/9/2015|7/13/2015|7/14/2015|7/20/2015|7/21/2015" | csv2json > _data/2015/summer/schedule.json
becomescat /tmp/futsal.csv | csvgrep -i -c 1 -r "6/15/2015|6/16/2015|6/22/2015|6/23/2015|6/29/2015|6/30/2015|7/6/2015|7/7/2015|7/9/2015|7/13/2015|7/14/2015|7/20/2015|7/21/2015|7/27/2015|7/28/2015" | csv2json > _data/2015/summer/schedule.json
cat /tmp/futsal.csv | csvgrep -c 1 -r "6/15/2015|6/16/2015|6/22/2015|6/23/2015|6/29/2015|6/30/2015|7/6/2015|7/7/2015|7/9/2015|7/13/2015|7/14/2015|7/20/2015|7/21/201" | csv2json > _data/2015/summer/past.json
becomescat /tmp/futsal.csv | csvgrep -c 1 -r "6/15/2015|6/16/2015|6/22/2015|6/23/2015|6/29/2015|6/30/2015|7/6/2015|7/7/2015|7/9/2015|7/13/2015|7/14/2015|7/20/2015|7/21/201|7/27/2015|7/28/2015" | csv2json > _data/2015/summer/past.json
cat /tmp/futsal.csv | csvgrep -c 1 -r "6/15/2015|6/16/2015|6/22/2015|6/23/2015|6/29/2015|6/30/2015|7/6/2015|7/7/2015|7/9/2015|7/13/2015|7/14/2015|7/20/2015|7/21/201" | csv2json > _data/2015/summer/matches.json
becomescat /tmp/futsal.csv | csvgrep -c 1 -r "6/15/2015|6/16/2015|6/22/2015|6/23/2015|6/29/2015|6/30/2015|7/6/2015|7/7/2015|7/9/2015|7/13/2015|7/14/2015|7/20/2015|7/21/201|7/27/2015|7/28/2015" | csv2json > _data/2015/summer/matches.json
Update the index.html
file and change the H2 to reference the upcoming dates. e.g. <h2>Matches for July 27-28</h2>
becomes <h2>Matches for August 3-4</h2>
.
Go to the futsal schedule google sheet and click File > Download as > CSV
. Save that CSV to /tmp/futsal.csv
.
In the root of the repo, run ./_scripts/build.sh
Do a git diff
for a quick sanity check. Then git add .
followed by git commit
and git push origin master
.