forked from brauliobo/gitconfig
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·50 lines (42 loc) · 1.3 KB
/
deploy.sh
File metadata and controls
executable file
·50 lines (42 loc) · 1.3 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
# from http://stackoverflow.com/questions/9271381/how-can-i-parse-long-form-arguments-in-shell
_setArgs() {
while [ "$1" != "" ]; do
case $1 in "-o" | "--overwrite")
opt_overwrite=$1
;;
esac
case $1 in "-v" | "--verbose")
opt_verbose=$1
;;
esac
shift
done
}
_setArgs $*
test $opt_verbose && set -x
echo == Link configurations files not overwriting existing regular files
for f in `ls -A configs`; do
[[ -L $HOME/$f || $opt_overwrite ]] && rm $HOME/$f
ln -s $PWD/configs/$f $HOME/$f
done
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
GITROOT="$( cd -P "$( dirname "$SOURCE" )" && git root )"
echo == Source $GITROOT/default/config
source $GITROOT/default/config
echo == Update submodules
git smuir --quiet
echo == Add autoload configs code
if ! grep bashmine.sh $HOME/.bashrc > /dev/null; then
echo '. $HOME/.bashmine.sh' >> ~/.bashrc
echo '. $HOME/.bashmine.sh' >> ~/.bash_profile
fi
echo == Grab gems credentials
if [[ -n "$RUBYGEMS_USER" && ! -f ~/.gem/credentials ]]; then
mkdir -p ~/.gem
curl -u $RUBYGEMS_USER https://rubygems.org/api/v1/api_key.yaml > ~/.gem/credentials
fi
echo == Install hooks
for h in `ls $GITROOT/hooks`; do
ln -sf $GITROOT/hooks/$h $GITROOT/.git/hooks
done