134 lines
1.4 KiB
Bash
Executable File
134 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Generic script to setup the repository for local development
|
|
|
|
echo "Installing pre-commit"
|
|
pip install pre-commit
|
|
pre-commit install
|
|
|
|
echo "Installing commit-msg"
|
|
|
|
HOOK_LOCATION=".git/hooks/commit-msg"
|
|
VERB_LOCATION=".git/hooks/verbs.txt"
|
|
|
|
cat << 'EOF' > "$HOOK_LOCATION"
|
|
#!/bin/sh
|
|
#
|
|
# Git hook to check for semantic commit messages in the form mentioned here
|
|
#
|
|
# https://seesparkbox.com/foundry/semantic_commit_messages
|
|
|
|
export TYPE=$(cut -d ':' -f1 < "$1" | xargs)
|
|
export VERB=$(cut -d ':' -f2 | cut -d ' ' -f2 < "$1")
|
|
(echo "$TYPE" | egrep '^(feat|chore|docs|fix|refactor|style|test)$' > /dev/null) || (echo "Missing type feat|chore|docs|fix|refactor|style|test"; exit 1)
|
|
(grep "$VERB" .git/hooks/verbs.txt > /dev/null) || (echo "Missing a verb"; exit 1)
|
|
EOF
|
|
|
|
cat << 'EOF' > "$VERB_LOCATION"
|
|
Remove
|
|
Delete
|
|
Update
|
|
Be
|
|
Have
|
|
Do
|
|
Say
|
|
Go
|
|
Can
|
|
Get
|
|
Would
|
|
Make
|
|
Know
|
|
Will
|
|
Think
|
|
Take
|
|
See
|
|
Come
|
|
Could
|
|
Want
|
|
Look
|
|
Use
|
|
Find
|
|
Give
|
|
Tell
|
|
Work
|
|
May
|
|
Should
|
|
Call
|
|
Try
|
|
Ask
|
|
Need
|
|
Feel
|
|
Become
|
|
Leave
|
|
Put
|
|
Mean
|
|
Keep
|
|
Let
|
|
Begin
|
|
Seem
|
|
Help
|
|
Talk
|
|
Turn
|
|
Start
|
|
Might
|
|
Show
|
|
Hear
|
|
Play
|
|
Run
|
|
Move
|
|
Like
|
|
Live
|
|
Believe
|
|
Hold
|
|
Bring
|
|
Happen
|
|
Must
|
|
Write
|
|
Provide
|
|
Sit
|
|
Stand
|
|
Lose
|
|
Pay
|
|
Meet
|
|
Include
|
|
Continue
|
|
Set
|
|
Learn
|
|
Change
|
|
Lead
|
|
Understand
|
|
Watch
|
|
Follow
|
|
Stop
|
|
Create
|
|
Speak
|
|
Read
|
|
Allow
|
|
Add
|
|
Spend
|
|
Grow
|
|
Open
|
|
Walk
|
|
Win
|
|
Offer
|
|
Remember
|
|
Love
|
|
Consider
|
|
Appear
|
|
Buy
|
|
Wait
|
|
Serve
|
|
Die
|
|
Send
|
|
Expect
|
|
Build
|
|
Stay
|
|
Fall
|
|
Cut
|
|
Reach
|
|
Kill
|
|
Remain
|
|
Merge
|
|
Improve
|
|
EOF
|