forked from reenl/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update
executable file
·43 lines (35 loc) · 1.01 KB
/
update
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
#!/bin/bash
pushd "$HOME/dotfiles" > /dev/null || exit 1;
CURRENT_HASH=`md5sum update | awk '{ print $1 }'`
echo -n "Pulling changes... "
git pull
git submodule init
git submodule sync
git submodule update
NEW_HASH=`md5sum update | awk '{ print $1 }'`
if [ "$CURRENT_HASH" != "$NEW_HASH" ]
then
echo "The update script has changed."
./update
exit
fi
echo "Syncing..."
./sync
source "$HOME/.bashrc"
if [ ! -f bin/composer ]
then
echo "Installing composer..."
curl -sS https://getcomposer.org/installer | php -- --install-dir=bin --filename=composer
fi
echo -n "Updating composer and dependencies... "
bin/composer --quiet self-update
bin/composer --quiet global require friendsofphp/php-cs-fixer
bin/composer --quiet global require phpunit/phpunit
bin/composer --quiet global require squizlabs/php_codesniffer
bin/composer --quiet global require phpmd/phpmd
echo "Done."
if [ ! -L resources/git-template/hooks ]
then
ln -s $HOME/dotfiles/resources/git-hooks resources/git-template/hooks
fi
popd > /dev/null