Skip to content

Instantly share code, notes, and snippets.

@adamlundrigan
Created November 18, 2011 19:55
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 adamlundrigan/1377575 to your computer and use it in GitHub Desktop.
Save adamlundrigan/1377575 to your computer and use it in GitHub Desktop.
Regenerate classmaps of all non-git-submodule modules in a ZF2 project
Place in `bin` folder within your ZF2 project, at the same level as your `modules` folder. From your project folder, run:
```
bash bin/regen_classmaps
```
You could also place your `bin` folder in your shell PATH variable, and then just type `regen_classmaps`
#!/bin/bash
PROJECT=`dirname $0`; PROJECT=`cd $PROJECT ; cd .. ;pwd`;
find $PROJECT/modules -name "autoload_classmap.php" | while read FILE
do
MODULE=`dirname $FILE`;
MODULEDIR=`echo $MODULE | sed "s{$PROJECT/{{"`;
if [ "`git submodule | awk '{print $2}' | egrep "^$MODULEDIR\$"`" = "" ]
then
echo $MODULEDIR;
/bin/env php $PROJECT/library/ZendFramework/bin/classmap_generator.php -l $MODULE -w 2>&1 | while read LINE; do echo " > $LINE"; done;
fi
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment