File: gen_requires.bash

package info (click to toggle)
ruby-xmpp4r 0.5.6-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 1,384 kB
  • sloc: ruby: 17,382; xml: 74; sh: 12; makefile: 4
file content (31 lines) | stat: -rwxr-xr-x 834 bytes parent folder | download | duplicates (2)
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
#!/bin/bash

# Generate a full graph of the requires in the Ruby files of this library.
#
# Output : The graph is generated as a .png file in the same dir as this script.
#
# This script requires the following tools to be installed:
#
# * mktemp
# * dot (Try 'sudo port install graphviz' on OS X)

export TMPDIR='/tmp'
export TMPFILE=$(mktemp $TMPDIR/gen_requires.XXXXXX)
export OUTFILE='gen_requires.png'
export SELFDIR=`pwd`
export LIBDIR=$SELFDIR/../lib

#######################################
# Unlikely you need to edit below here
#######################################

cd $LIBDIR

echo "strict digraph requirestree { " > $TMPFILE
grep -r "^require " * | grep -v swp | sed "s/^\(.*\).rb:require '\(.*\)'/\1 -> \2;/" | sed 's/\//_/g' >> $TMPFILE
echo "}" >> $TMPFILE

cd $SELFDIR
dot -Tpng $TMPFILE -o $OUTFILE
rm -f $TMPFILE