#!/bin/bash
set -euo pipefail

sudo apt -qq install -y libgraphviz-dev

sudo pip --disable-pip-version-check \
  install \
  --quiet \
  --global-option=build_ext \
  --global-option="-I/usr/local/Cellar/graphviz/2.38.0/include/"  \
  --global-option="-L/usr/local/Cellar/graphviz/2.38.0/lib/" \
  pygraphviz eralchemy psycopg2

generate(){
  eralchemy -i \
  postgresql://postgres:postgres@localhost:5432/${1} \
  -o /tmp/${1}.png
  echo "file output at /tmp/${1}.png"

}
generate hwsd_component
generate hwsd_run
generate hwsd_station
generate hwsd_test
