├── README.md
├── install.sh
├── linux
├── checkout.sh
├── commit.sh
├── drumcommit.sh
├── install.sh
└── push.sh
├── mac
├── checkout.sh
├── commit.sh
├── drumcommit.sh
├── install.sh
└── push.sh
└── sounds
├── drumroll.wav
├── mario_coin_sound.mp3
├── pipe.wav
└── stage-clean.wav
/README.md:
--------------------------------------------------------------------------------
1 | # drumcommit
2 |
3 | drumcommit is a little tool for git cli users on linux and mac. it shows your coworkers, that you are working hard by playing different sounds on git commit, checkout and push.
4 |
5 |
6 | have fun!
7 |
8 | ## installation
9 |
10 | clone repository
11 |
12 | ```
13 | git clone https://github.com/pichsenmeister/drumcommit.git
14 | ```
15 |
16 | install drumcommit via terminal
17 |
18 | ```
19 | sh install.sh
20 | ```
21 |
22 | ### usage
23 |
24 | at the moment, you can install 3 different hooks
25 |
26 | * commit - plays the original drumcommit drumroll sound on every commit
27 | * checkout - play a sound everytime you switch branches
28 | * push - plays a sound everytime you push
29 |
30 | to install these hooks, ```cd``` to your git repository's home folder, then type
31 |
32 | ```
33 | drumcommit
34 | ```
35 |
36 | where ``` ``` can be either `commit`, `checkout` or `push`
37 |
38 |
--------------------------------------------------------------------------------
/install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | if [ -f /etc/debian_version ]; then
4 | OS=Debian
5 | else
6 | OS=$(uname -s)
7 | fi
8 |
9 | if [ $OS = "Darwin" ]; then
10 | ./mac/install.sh
11 | elif [ $OS = "Debian" -o $OS = "Ubuntu" -o $OS = "Linux" ]; then
12 | ./linux/install.sh
13 | fi
14 |
--------------------------------------------------------------------------------
/linux/checkout.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | DIR=$(pwd)
3 |
4 | if [ ! -f $DIR/.git/hooks/post-checkout ]; then
5 | echo "" >> $DIR/.git/hooks/post-checkout
6 | fi
7 |
8 | if ! grep -Fxq "aplay ~/.drumcommit/sounds/pipe.wav" $DIR/.git/hooks/post-checkout
9 | then
10 | echo "### drumcommit ###" >> $DIR/.git/hooks/post-checkout
11 | echo "aplay ~/.drumcommit/sounds/pipe.wav" >> $DIR/.git/hooks/post-checkout
12 | echo "### end drumcommit ###" >> $DIR/.git/hooks/post-checkout
13 | fi
14 |
15 | chmod 755 $DIR/.git/hooks/post-checkout
16 | echo "[drumcommit] post-checkout hook installed"
17 |
18 | exit 0
19 |
20 |
--------------------------------------------------------------------------------
/linux/commit.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | DIR=$(pwd)
3 |
4 | if [ ! -f $DIR/.git/hooks/pre-commit ]; then
5 | echo "" >> $DIR/.git/hooks/pre-commit
6 | fi
7 |
8 | if grep -Fxq "aplay ~/.drumcommit/drumroll.wav" $DIR/.git/hooks/pre-commit
9 | then
10 | grep -v "aplay ~/.drumcommit/drumroll.wav" $DIR/.git/hooks/pre-commit > $DIR/.git/hooks/pre-commit.orig
11 | mv $DIR/.git/hooks/pre-commit.orig $DIR/.git/hooks/pre-commit
12 | fi
13 |
14 | if ! grep -Fxq "aplay ~/.drumcommit/sounds/drumroll.wav" $DIR/.git/hooks/pre-commit
15 | then
16 | echo "### drumcommit ###" >> $DIR/.git/hooks/pre-commit
17 | echo "aplay ~/.drumcommit/sounds/drumroll.wav" >> $DIR/.git/hooks/pre-commit
18 | echo "### end drumcommit ###" >> $DIR/.git/hooks/pre-commit
19 | fi
20 |
21 | chmod 755 $DIR/.git/hooks/pre-commit
22 | echo "[drumcommit] pre-commit hook installed"
23 |
24 | exit 0
25 |
26 |
--------------------------------------------------------------------------------
/linux/drumcommit.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | DIR=$(pwd)
3 | if [ ! -d $DIR/.git ]
4 | then
5 | echo "[drumcommit] ERROR: not a git repo"
6 | exit 0
7 | elif [ ! $1 ]
8 | then
9 | echo "[drumcommit] ERROR: missing option. available: checkout, commit, push"
10 | echo "[drumcommit] usage: drumcommit "
11 | elif [ $1 = "push" ]
12 | then
13 | sh ~/.drumcommit/linux/push.sh
14 | elif [ $1 = "commit" ]
15 | then
16 | sh ~/.drumcommit/linux/commit.sh
17 | elif [ $1 = "checkout" ]
18 | then
19 | sh ~/.drumcommit/linux/checkout.sh
20 | elif [ $1 = "all" ]
21 | then
22 | sh ~/.drumcommit/linux/commit.sh
23 | sh ~/.drumcommit/linux/checkout.sh
24 | sh ~/.drumcommit/linux/push.sh
25 | else
26 | echo "[drumcommit] ERROR: invalid option. available: checkout, commit, push"
27 | fi
28 | exit 0
29 |
--------------------------------------------------------------------------------
/linux/install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | if [ -d ~/.drumcommit ]; then
3 | rm -r ~/.drumcommit
4 | fi
5 |
6 | if [ ! -d ~/.drumcommit ]; then
7 | mkdir ~/.drumcommit
8 | fi
9 |
10 | if [ ! -d ~/.drumcommit/sounds ]; then
11 | cp -R ./sounds ~/.drumcommit/sounds
12 | fi
13 |
14 | if [ ! -d ~/.drumcommit/linux ]; then
15 | cp -R ./linux ~/.drumcommit/linux
16 | fi
17 |
18 | if ! grep -Fxq "alias drumcommit='~/.drumcommit/linux/drumcommit.sh'" ~/.bashrc
19 | then
20 | echo "" >> ~/.bashrc
21 | echo "### drumcommit ###" >> ~/.bashrc
22 | echo "alias drumcommit='~/.drumcommit/linux/drumcommit.sh'" >> ~/.bashrc
23 | bash
24 | fi
25 |
26 | chmod +x ~/.drumcommit/linux/*.sh
27 |
28 | echo "[drumcommit] SUCCESS"
29 |
30 | exit 0
31 |
--------------------------------------------------------------------------------
/linux/push.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | DIR=$(pwd)
3 |
4 | if [ ! -f $DIR/.git/hooks/pre-push ]; then
5 | echo "" >> $DIR/.git/hooks/pre-push
6 | fi
7 |
8 | if ! grep -Fxq "aplay ~/.drumcommit/sounds/stage-clean.wav" $DIR/.git/hooks/pre-push
9 | then
10 | echo "### drumcommit ###" >> $DIR/.git/hooks/pre-push
11 | echo "aplay ~/.drumcommit/sounds/stage-clean.wav" >> $DIR/.git/hooks/pre-push
12 | echo "### end drumcommit ###" >> $DIR/.git/hooks/pre-push
13 | fi
14 |
15 | chmod 755 $DIR/.git/hooks/pre-push
16 | echo "[drumcommit] pre-push hook installed"
17 |
18 | exit 0
19 |
20 |
--------------------------------------------------------------------------------
/mac/checkout.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | DIR=$(pwd)
3 |
4 | if [ ! -f $DIR/.git/hooks/post-checkout ]; then
5 | echo "" >> $DIR/.git/hooks/post-checkout
6 | fi
7 |
8 | if ! grep -Fxq "afplay ~/.drumcommit/sounds/pipe.wav" $DIR/.git/hooks/post-checkout
9 | then
10 | echo "### drumcommit ###" >> $DIR/.git/hooks/post-checkout
11 | echo "afplay ~/.drumcommit/sounds/pipe.wav" >> $DIR/.git/hooks/post-checkout
12 | echo "### end drumcommit ###" >> $DIR/.git/hooks/post-checkout
13 | fi
14 |
15 | chmod 755 $DIR/.git/hooks/post-checkout
16 | echo "[drumcommit] post-checkout hook installed"
17 |
18 | exit 0
19 |
20 |
--------------------------------------------------------------------------------
/mac/commit.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | DIR=$(pwd)
3 |
4 | if [ ! -f $DIR/.git/hooks/pre-commit ]; then
5 | echo "" >> $DIR/.git/hooks/pre-commit
6 | fi
7 |
8 | if grep -Fxq "afplay ~/.drumcommit/drumroll.wav" $DIR/.git/hooks/pre-commit
9 | then
10 | grep -v "afplay ~/.drumcommit/drumroll.wav" $DIR/.git/hooks/pre-commit > $DIR/.git/hooks/pre-commit.orig
11 | mv $DIR/.git/hooks/pre-commit.orig $DIR/.git/hooks/pre-commit
12 | fi
13 |
14 | if ! grep -Fxq "afplay ~/.drumcommit/sounds/drumroll.wav" $DIR/.git/hooks/pre-commit
15 | then
16 | echo "### drumcommit ###" >> $DIR/.git/hooks/pre-commit
17 | echo "afplay ~/.drumcommit/sounds/drumroll.wav" >> $DIR/.git/hooks/pre-commit
18 | echo "### end drumcommit ###" >> $DIR/.git/hooks/pre-commit
19 | fi
20 |
21 | chmod 755 $DIR/.git/hooks/pre-commit
22 | echo "[drumcommit] pre-commit hook installed"
23 |
24 | exit 0
25 |
--------------------------------------------------------------------------------
/mac/drumcommit.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | DIR=$(pwd)
3 | if [ ! -d $DIR/.git ]
4 | then
5 | echo "[drumcommit] ERROR: not a git repo"
6 | exit 0
7 | elif [ ! $1 ]
8 | then
9 | echo "[drumcommit] ERROR: missing option. available: checkout, commit, push"
10 | echo "[drumcommit] usage: drumcommit "
11 | elif [ $1 = "push" ]
12 | then
13 | sh ~/.drumcommit/mac/push.sh
14 | elif [ $1 = "commit" ]
15 | then
16 | sh ~/.drumcommit/mac/commit.sh
17 | elif [ $1 = "checkout" ]
18 | then
19 | sh ~/.drumcommit/mac/checkout.sh
20 | elif [ $1 = "all" ]
21 | then
22 | sh ~/.drumcommit/linux/commit.sh
23 | sh ~/.drumcommit/linux/checkout.sh
24 | sh ~/.drumcommit/linux/push.sh
25 | else
26 | echo "[drumcommit] ERROR: invalid option. available: checkout, commit, push"
27 | fi
28 | exit 0
29 |
--------------------------------------------------------------------------------
/mac/install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | if [ -d ~/.drumcommit ]; then
3 | rm -r ~/.drumcommit
4 | fi
5 |
6 | if [ ! -d ~/.drumcommit ]; then
7 | mkdir ~/.drumcommit
8 | fi
9 |
10 | if [ ! -d ~/.drumcommit/sounds ]; then
11 | cp -R ./sounds ~/.drumcommit/sounds
12 | fi
13 |
14 | if [ ! -d ~/.drumcommit/mac ]; then
15 | cp -R ./mac ~/.drumcommit/mac
16 | fi
17 |
18 | if ! grep -Fxq "alias drumcommit='~/.drumcommit/mac/drumcommit.sh'" ~/.bash_profile
19 | then
20 | echo "" >> ~/.bash_profile
21 | echo "### drumcommit ###" >> ~/.bash_profile
22 | echo "alias drumcommit='~/.drumcommit/mac/drumcommit.sh'" >> ~/.bash_profile
23 | source ~/.bash_profile
24 | fi
25 |
26 | chmod +x ~/.drumcommit/mac/*.sh
27 |
28 | echo "[drumcommit] SUCCESS"
29 |
30 | exit 0
31 |
--------------------------------------------------------------------------------
/mac/push.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | DIR=$(pwd)
3 |
4 | if [ ! -f $DIR/.git/hooks/pre-push ]; then
5 | echo "" >> $DIR/.git/hooks/pre-push
6 | fi
7 |
8 | if ! grep -Fxq "afplay ~/.drumcommit/sounds/stage-clean.wav" $DIR/.git/hooks/pre-push
9 | then
10 | echo "### drumcommit ###" >> $DIR/.git/hooks/pre-push
11 | echo "afplay ~/.drumcommit/sounds/stage-clean.wav" >> $DIR/.git/hooks/pre-push
12 | echo "### end drumcommit ###" >> $DIR/.git/hooks/pre-push
13 | fi
14 |
15 | chmod 755 $DIR/.git/hooks/pre-push
16 | echo "[drumcommit] pre-push hook installed"
17 |
18 | exit 0
19 |
20 |
--------------------------------------------------------------------------------
/sounds/drumroll.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pichsenmeister/drumcommit/428990db1dd1e10a7d9dd4093e6d34fe818b7f8a/sounds/drumroll.wav
--------------------------------------------------------------------------------
/sounds/mario_coin_sound.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pichsenmeister/drumcommit/428990db1dd1e10a7d9dd4093e6d34fe818b7f8a/sounds/mario_coin_sound.mp3
--------------------------------------------------------------------------------
/sounds/pipe.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pichsenmeister/drumcommit/428990db1dd1e10a7d9dd4093e6d34fe818b7f8a/sounds/pipe.wav
--------------------------------------------------------------------------------
/sounds/stage-clean.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pichsenmeister/drumcommit/428990db1dd1e10a7d9dd4093e6d34fe818b7f8a/sounds/stage-clean.wav
--------------------------------------------------------------------------------