Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added install script for pre-commit hook and updated readme.md with i…
…nstallation instructions
- Loading branch information
1 parent
3dfdb73
commit 14e971b
Showing
4 changed files
with
77 additions
and
7 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/sh | ||
# | ||
# Installs the pre-commit git hook | ||
# which will automatically update the README.md | ||
# and stage it for the current commit right before | ||
# every actual commit | ||
# | ||
|
||
hookfile=".pre-commit.hook" | ||
target=".git/hooks/pre-commit" | ||
backupTarget=".git/hooks/pre-commit.backup" | ||
|
||
# file existing options | ||
cancel=false | ||
overwrite=false | ||
backup=false | ||
|
||
# ask what to do with existing file | ||
if [ -e "$target" ] || [ -h "$target" ]; then | ||
echo "A pre-commit hook already exists!" | ||
echo "[c]ancel, [o]verwrite or [b]ackup" | ||
while true; do | ||
read answer | ||
case $answer in | ||
"c" ) cancel=true; break;; | ||
"o" ) overwrite=true; break;; | ||
"b" ) backup=true; break;; | ||
* ) continue ;; | ||
esac | ||
done | ||
|
||
if $overwrite; then | ||
rm $target | ||
fi | ||
|
||
if $backup; then | ||
mv $target $backupTarget | ||
echo "Saved old hook as $backupTarget" | ||
fi | ||
fi | ||
|
||
# cancel or install | ||
if $cancel; then | ||
echo "Canceled" | ||
else | ||
cp $hookfile $target | ||
echo "Installed hook: $target" | ||
fi | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
# | ||
# generate documentation, before commiting | ||
# this will update the readme.md | ||
# | ||
|
||
python .generateDescription.py | ||
git add README.md | ||
|
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