Created
January 19, 2015 11:50
-
-
Save lisotton/ed30572e0d84089dfeae to your computer and use it in GitHub Desktop.
Add project name to all Drupal modules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Find modules without project | |
INFOS=`find sites/*/modules -name '*.info' | xargs -I {} grep -iL 'project' {}` | |
for INFO in $INFOS; do | |
PROJECT=`basename $INFO | sed 's/\.info//'` | |
echo "Add \"project = $PROJECT\" in: $INFO ? [Y/n]" | |
read yes_no | |
if [ "$yes_no" != "n" ]; then | |
echo -e "\nproject = $PROJECT" >> $INFO | |
fi | |
done | |
# Find modules with "project=drupal" | |
INFOS=`find sites/*/modules -name '*.info' | xargs -I {} grep -il 'project.*drupal' {}` | |
for INFO in $INFOS; do | |
PROJECT=`basename $INFO | sed 's/\.info//'` | |
echo "Replace \"project=drupal\" to \"project = $PROJECT\" in: $INFO ? [Y/n]" | |
read yes_no | |
if [ "$yes_no" != "n" ]; then | |
sed -i "s/project.*drupal.*/project = $PROJECT/" $INFO | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment