summaryrefslogtreecommitdiff
path: root/script/erd
blob: 5ba938c5c6e7e247fbc213239def8c01e0adb97e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#! /bin/sh

echo ""
echo "###  Generating Dot file ..."
bundle exec \
  rake erd filetype=dot \
    attributes=content,foreign_keys \
    indirect=true \
    orientation=horizontal \
    notation=simple

if which dot; then
  echo ""
  echo "###  Generating PDF file (via dot) ..."
  dot -Tpdf:quartz:quartz -o ERD.pdf ERD.dot
else
  if which graphviz; then
    echo ""
    echo "###  Generating PDF file (via graphviz) ..."
    bundle exec \
      rake erd filetype=pdf \
        attributes=content,foreign_keys \
        indirect=true \
        orientation=horizontal \
        notation=simple
  else
    echo "No dot no PDF."
  fi
fi

if which dot; then
  echo ""
  echo "###  Generating PNG file (via dot) ..."
  dot -Tpng:quartz:quartz -o ERD.png ERD.dot
else
  echo "No dot no PNG."
fi