-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathinstall.sh
38 lines (32 loc) · 886 Bytes
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#! /bin/bash
set -e
echo "Installing timesheet-githook..."
pushd `git rev-parse --git-dir`/hooks > /dev/null
if [ -f post-commit ] || [ -L post-commit ]; then
echo "A post-commit file already exists."
read -p "Overwrite? [y/N] " -n 1 -r < /dev/tty
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
exit 1
fi
rm -f post-commit
fi
if [ -d timesheet-githook ]; then
pushd timesheet-githook > /dev/null
git pull origin
popd > /dev/null
else
git clone https://github.com/msolomonTMG/timesheet-githook.git
fi
ln -s timesheet-githook/post-commit post-commit
chmod +x post-commit timesheet-githook/sum_time.rb
pushd timesheet-githook > /dev/null
bundle=$(which bundle)
if [ ! -z "$bundle" ] && [ ! -x "$bundle" ]; then
echo "Installing Ruby Bundler..."
sudo gem install bundler
fi
bundle install
popd > /dev/null
popd > /dev/null
echo "Done!"