User login

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:

cd /
$REPOS = /path/to/repository
find  $REPOS
-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

Resolution

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.