Refactor install scripts (KISS)

This commit is contained in:
Henrik Lissner 2013-03-21 22:26:04 -04:00
parent 9373174c6a
commit a57e94a912
7 changed files with 90 additions and 112 deletions

View file

@ -5,20 +5,19 @@ RS=$(tput sgr0)
src=$(cd "$(dirname "$0")"; pwd)
if [ ! -d $src/install ]; then
echo -e "$GREEN==> Cloning dotfiles repo"
echo -e "$GREEN==> Cloning dotfiles repo$RS"
git clone https://github.com/hlissner/dotfiles.git ~/.dotfiles | sed "s/^/ /"
src="~/.dotfiles"
fi
{
$src/install/osx
$src/install/zsh
$src/install/brew
$src/install/git
$src/install/rvm
$src/install/tmux
} | sed "s/^/ /"
$src/install/osx
$src/install/zsh
$src/install/brew
$src/install/git
$src/install/rvm
$src/install/tmux
echo "Done!"
echo
echo "${GREEN}Done!$RS"
echo "And if you want to install vim, run:"
echo " sh <(curl https://raw.github.com/hlissner/mlvim/master/install.sh -L)"

View file

@ -1,7 +1,7 @@
#!/bin/zsh
if ! command-exists brew ; then
echoh "==> Homebrew: Installing"
if ! command-exists brew; then
echo "==> Homebrew: Installing"
# http://mxcl.github.com/homebrew/
ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go) | indent
@ -10,9 +10,13 @@ elif [ "$1" = "--force" ]; then
FORCE=1
fi
echo "==> Homebrew: Updating"
# Make sure were using the latest Homebrew
brew update
if [ $FORCE ]; then
echoh "==> Homebrew: Installing essential brews"
{
echo "==> Homebrew: Installing essential brews"
# Install GNU core utilities (those that come with OS X are outdated)
brew install coreutils
# echo "Dont forget to add $(brew --prefix coreutils)/libexec/gnubin to \$PATH."
@ -30,23 +34,17 @@ if [ $FORCE ]; then
brew tap josegonzalez/homebrew-php
# Install everything else
brew install ack git rename tree python ruby node nginx memcached ctags macvim
brew install ack git rename tree python node nginx memcached ctags macvim
brew install php54 --with-fpm --with-imap --with-mysql --with-pgsql --without-apache
brew install php54-imagick php54-mcrypt php54-xdebug readline
} | indent
else
echoh "==> Homebrew: Updating"
{
# Make sure were using the latest Homebrew
brew update
echo "==> Homebrew: Upgrading"
# Upgrade any already-installed formulae
brew upgrade
} | indent
fi
echoh "==> Homebrew: Cleaning up"
echo "==> Homebrew: Cleaning up"
# Remove outdated versions from the cellar
brew cleanup | indent
brew cleanup
echoh "==> Homebrew: DONE!"
echo "==> Homebrew: DONE!"

View file

@ -6,22 +6,20 @@ if ! command-exists git; then
exit
fi
echoh "==> Git: Installing"
echo "==> Git: Installing"
brew install git | indent
fi
if [ ! -e /usr/local/bin/branch ]; then
echoh "==> Git: Installing git-friendly"
echo "==> Git: Installing git-friendly"
# https://github.com/jamiew/git-friendly
bash < <(curl https://raw.github.com/jamiew/git-friendly/master/install.sh)
fi
# Create links
echoh "==> Git: Setting up symlinks"
echo "==> Git: Setting up symlinks"
ln -sf ~/.dotfiles/gitignore ~/.gitignore
ln -sf ~/.dotfiles/gitconfig ~/.gitconfig
src=$(cd "$(dirname "$0")/.."; pwd)
ln -sf $src/gitignore ~/.gitignore
ln -sf $src/gitconfig ~/.gitconfig
echoh "==> Git: DONE!"
echo "==> Git: DONE!"

View file

@ -2,15 +2,14 @@
sudo -v
if ! command-exists "rvm"; then
if ! command-exists rvm; then
# If RVM's not installed, install it and the rubies
echoh "==> Rvm: Installing"
echo "==> Rvm: Installing"
# https://rvm.io
curl -L https://get.rvm.io | bash -s stable --ruby | indent
echoh "==> Rvm: Install rubies"
{
echo "==> Rvm: Install rubies"
# Install rubies and update rubygems
rvm install 1.9.3
rvm install 1.8.7-p371
@ -20,7 +19,6 @@ if ! command-exists "rvm"; then
# A few prerequisites
sudo gem install bluecloth capistrano bundler colorize
} | indent
else
# Otherwise, update it
@ -32,21 +30,17 @@ else
# Update all rubies and rubygems
for v in 1.9.3 1.8.7; do
echoh "==> Rvm: Updating ruby $v"
{
echo "==> Rvm: Updating ruby $v"
rvm use $v
gem update --system
gem update
} | indent
done
# Update system ruby
echoh "==> Rvm: Updating system ruby"
{
echo "==> Rvm: Updating system ruby"
rvm use system
sudo gem update --system
sudo gem update
} | indent
fi
echoh "==> Rvm: DONE!"
echo "==> Rvm: DONE!"

View file

@ -6,14 +6,13 @@ if ! command-exists brew; then
fi
if [ ! `command -v "tmux"` ]; then
echoh "==> Tmux: Installing tmux & reattach-to-user-namespace"
echo "==> Tmux: Installing tmux & reattach-to-user-namespace"
brew install tmux reattach-to-user-namespace libevent | indent
else
echoh "==> Tmux: already installed!"
echo "==> Tmux: already installed!"
fi
echoh "==> Tmux: Setting up symlinks"
src=$(cd "$(dirname "$0")/.."; pwd)
ln -sf $src/tmux.conf ~/.tmux.conf
echo "==> Tmux: Setting up symlinks"
ln -sf ~/.dotfiles/tmux.conf ~/.tmux.conf
echoh "==> Tmux: DONE!"
echo "==> Tmux: DONE!"

View file

@ -2,16 +2,16 @@
if ! command-exists "brew"; then
echo "Homebrew is required!"
exit
exit 1
fi
if ! command-exists "mvim"; then
echoh "==> Vim: Installing macvim"
echo "==> Vim: Installing macvim"
brew install macvim --with-cscope --override-system-vim | indent
fi
if [ ! -e ~/.vimrc ]; then
echoh "==> Vim: Installing vim rcfiles"
echo "==> Vim: Installing vim rcfiles"
if [ -d ~/.vim ]; then
rm -rf ~/.vim
@ -22,21 +22,17 @@ if [ ! -e ~/.vimrc ]; then
sh <(curl https://raw.github.com/hlissner/mlvim/master/install.sh -L) | indent
fi
echoh "==> Vim: Updating..."
{
find ~/.vim/bundle/ -type d -name .git \
| xargs -n 1 dirname \
| while read line; do cd $line && echo -n "$(basename $line): " && git pull; done
} | indent
echo "==> Vim: Updating..."
find ~/.vim/bundle/ -type d -name .git \
| xargs -n 1 dirname \
| while read line; do cd $line && echo -n "$(basename $line): " && git pull; done
YVM_DIR="~/.vim/bundle/YouCompleteMe"
if [ -d $YVM_DIR ] && [ ! -e $YVM_DIR/python/ycm_core.so ]; then
echoh "==> Vim: Trying to compile YCM"
{
echo "==> Vim: Trying to compile YCM"
brew install cmake
cd ~/.vim/bundle/YouCompleteMe
./install.sh --clang-completer
} | indent
fi
echoh "==> Vim: DONE!"
echo "==> Vim: DONE!"

View file

@ -1,27 +1,21 @@
#!/bin/bash
echoh() {
echo -e "\033[01;38;5;2m$1\033[39m"
}
if [ ! -d ~/.oh-my-zsh ]; then
# https://github.com/robbyrussell/oh-my-zsh
echoh "==> ZSH: Installing oh-my-zsh"
echo "==> ZSH: Installing oh-my-zsh"
curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh
# Set new shell
echoh "==> ZSH: Changing shell"
echo "==> ZSH: Changing shell"
chsh -s /bin/zsh
fi
# Create links
echoh "==> ZSH: Setting up symlinks"
src=$(cd "$(dirname "$0")/.."; pwd)
echo "==> ZSH: Setting up symlinks"
[ -d ~/.zsh ] && rm ~/.zsh
ln -sf $src/zsh ~/.zsh
ln -sf $src/zshrc ~/.zshrc
ln -sf $src/zshenv ~/.zshenv
ln -sf $src/bashrc ~/.bashrc
ln -sf ~/.dotfiles/zsh ~/.zsh
ln -sf ~/.dotfiles/zshrc ~/.zshrc
ln -sf ~/.dotfiles/zshenv ~/.zshenv
ln -sf ~/.dotfiles/bashrc ~/.bashrc
echoh "==> ZSH: DONE!"
echo "==> ZSH: DONE!"