Created
May 27, 2015 17:36
-
-
Save alexdforeman/1e6d50cbfd5383006d0c to your computer and use it in GitHub Desktop.
dot graph sanitiser
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
### Inputs. | |
FILE=$1 | |
PROJECT=$2 | |
echo "*** Sanitizing ${FILE}" | |
echo "*** Top level project is ${PROJECT}" | |
SANITIZED_FILE=${PROJECT}.sanitized.dot | |
### Remove all the stuff at the start if its not top level.sponge | |
sed -i.bak -n "s/\(${PROJECT}\).*\(->.*\)/\1\2/p" ${FILE} | |
sed -i -n "s/\(^.*->.*\)_.*$/\1/p" ${FILE} | |
### Remove white space, Sort and make unique and place in new sanitized file. | |
sed 's/^ *//' ${FILE} | sort | uniq > ${SANITIZED_FILE} | |
### Now we need to append the graph structure at the start and end of the file. | |
sed -i '1s/^/digraph simple_hierarchy {\n graph [rankdir = "LR"];\n/' ${SANITIZED_FILE} | |
echo "}" >> ${SANITIZED_FILE} | |
# Generate SVG. | |
dot ${SANITIZED_FILE} -Tsvg -o ${PROJECT}.svg | |
echo "*** End" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
'lein depgraph' gives a good view at a package level however the graph is extrememly complicated.
If you just want to the top level views this script will get you much closer to that to give a little bit of sanity.