Setting up cscope for Drupal: the find command to list the files to index
Thanks to one of a whole slew of development environment tips from chx, Agaric is going to try to install and use cscope.
Installing cscope on a Mac with the fink package manager is as easy as typing on the command line:
fink install cscope
There is also a graphical interface for Fink called Fink Commander, I think.
Telling fink what to index is a little harder.
Chx wrote: "I keep a cscope.files in the Drupal directory listing all the .module, .inc, .php, .engine, .theme files and then cscope can quickly show me where a function is defined and where it is used."
For Agaric and probably a lot of other people we'll also need to exclude .svn directories. Our repository has drupal-core and drupal-contrib next to each other so it seems for the find command we would need to exclude the directories in our repository which we don't want to index, such as agaric-server and agaric-sites (we'll want to leave agaric-modules in though, for our modules-in-development, and likewise agaric-profiles).
In a bash or other shell script:
$REPOS = /path/to/repository
-path "$REPOS/agaric-sites*" -prune -o \
-path "$REPOS/agaric-server*" -prune -o \
-name "*.[umWeDon'tKnowHowToDoThisYet]" -print >/home/jru/cscope/cscope.files
Maybe throw a line in there like "-path "$REPOS//.svn" -prune -o" to exclude .svn directories, but I don't think that single asterisk cascades to deeper directories. However maybe dot-directories are already excluded.
Update: Greg Rundlett, Web Developer, suggests:
REPOS=`pwd`; find $REPOS -path "\.git" -prune -o -path "\.svn" -prune
-path "\.gitk" -prune -o \( -name "*\.module" -o -name "*\.inc" -o
-name "*\.php" -o -name "*\.install" -o -name "*\.engine" -o -name
"*\.test" -o -name "*\.theme" \) -print > $REPOS/cscope.files