Created
June 12, 2010 12:50
-
-
Save freegenie/435708 to your computer and use it in GitHub Desktop.
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
# Git hook to switch config files made for a Rails app | |
# Looks for config file named like the branch. | |
# | |
# i.e.: database.mybranch.yml | |
# | |
# If the file is found, copies that to the actual config | |
# overwriting the previous one. | |
# | |
# The third parameter is 1 when we are switching branches | |
# | |
if [ $3 -eq 1 ]; then | |
cb=$(git branch | grep \* | cut -d " " -f 2) | |
ll=$(echo $(ls -1 $GIT_DIR/../deploy/config/*.$cb.yml)) | |
if [ "$ll" != "" ] ; then | |
echo "Branch config files found, copying" | |
fi | |
for real_name in $ll ; do | |
renamed=$(echo $real_name | sed -e s/$cb\.//) | |
cp -v $real_name $renamed | |
done | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment