Skip to content

Instantly share code, notes, and snippets.

@itchyny
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itchyny/248ec28c432deb35f4d6 to your computer and use it in GitHub Desktop.
Save itchyny/248ec28c432deb35f4d6 to your computer and use it in GitHub Desktop.
#!/bin/zsh
dotfile=mikutter.dot
outfile=mikutter.png
mikutterdir=../mikutter/core
echo "digraph mikutter {" > "$dotfile"
for file in $mikutterdir/*.rb; do
name=$(basename "$file" | sed 's/\.rb//')
for dependon in $(grep "^miquire :core" "$file" | sed 's/miquire.*:[a-z]*, //' | tr ',' '\n' | tr -d " '\""); do
echo " \"$name\" -> \"$dependon\"" >> "$dotfile"
done
done
echo "}" >> "$dotfile"
dot -Tpng "$dotfile" -o "$outfile"
open "$outfile"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment