summaryrefslogtreecommitdiff
path: root/script/erd
diff options
context:
space:
mode:
Diffstat (limited to 'script/erd')
-rwxr-xr-xscript/erd38
1 files changed, 38 insertions, 0 deletions
diff --git a/script/erd b/script/erd
new file mode 100755
index 0000000..5ba938c
--- /dev/null
+++ b/script/erd
@@ -0,0 +1,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
+