Skip to content

Instantly share code, notes, and snippets.

@textarcana
Last active May 5, 2020 19:22
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 textarcana/f92de4914f6e7ad2fc78cc2a551e2819 to your computer and use it in GitHub Desktop.
Save textarcana/f92de4914f6e7ad2fc78cc2a551e2819 to your computer and use it in GitHub Desktop.
Bash Dependency Mapper
paths="bin/run lib/ingestion/github"
ack '\b(libexec|source)\b' $paths \
| tr -d "'" \
| tr -d '"' \
| grep -v '#\s*NOTE' \
| perl -a -F: -wlne '$F[2] =~ s{(source\s)}{};
$F[2] =~ s{.*\S+(libexec\S+).*}{$1}g;
print qq{"$F[0]" -> "$F[2]"}' \
| perl -lwpe 'BEGIN{print "digraph G {"};
s{lib/ingestion/github/graphql/}{}g;
END{print "}"};' \
> /tmp/callgraph.gv \
&& dot -Tpng /tmp/callgraph.gv -o /tmp/callgraph.png
# if it worked the image is saved to
# /tmp/callgraph.png
Copyright 2010-2019 Noah Sussman New Media, LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment