diff --git a/bin/composer b/bin/composer deleted file mode 100755 index 65f850f..0000000 Binary files a/bin/composer and /dev/null differ diff --git a/includes/bash_aliases.bash b/includes/bash_aliases.bash index d8a6689..090f688 100644 --- a/includes/bash_aliases.bash +++ b/includes/bash_aliases.bash @@ -41,7 +41,7 @@ alias myip="ifconfig | grep 'inet ' | grep -v 127.0.0.1 | awk '{print \$2}'" alias update="source "$HOME/dotfiles/setup/update.sh"" # Update dotfiles -alias dotfiles="pushd "$HOME/dotfiles" > /dev/null 2>&1; git pull && ./sync.py && . "$HOME/.bashrc"; popd > /dev/null 2>&1; nyan" +alias dotfiles="$HOME/dotfiles/update.sh" # Clean up LaunchServices to remove duplicates in the “Open With” menu #alias lscleanup="/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user && killall Finder" diff --git a/update.sh b/update.sh new file mode 100755 index 0000000..8c0c275 --- /dev/null +++ b/update.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +pushd "$HOME/dotfiles" > /dev/null || exit 1; + +CURRENT_HASH=`md5sum update.sh | awk '{ print $1 }'` + +echo -n "Pulling changes... " +git pull + +NEW_HASH=`md5sum update.sh | awk '{ print $1 }'` +if [ "$CURRENT_HASH" != "$NEW_HASH" ] +then + echo "The update script has changed." + ./update + exit +fi + +echo "Syncing..." +./sync.py + +source "$HOME/.bashrc" + +if [ ! -f bin/composer ] +then + echo "Installing composer..." + wget https://getcomposer.org/composer.phar -O bin/composer + chmod +x bin/composer +fi + +echo -n "Updating composer and dependencies... " +bin/composer --quiet self-update +bin/composer --quiet global require \ + fabpot/php-cs-fixer \ + phpmd/phpmd \ + phpunit/phpunit \ + squizlabs/php_codesniffer + +echo "Done." + +if [ ! -L resources/git-template/hooks ] +then + ln -s $HOME/dotfiles/resources/git-hooks resources/git-template/hooks +fi + +popd > /dev/null \ No newline at end of file