small-dotfiles / .kevin.install


# Commands that should help speed installation
set -e
set -v
set -o pipefail

# vim settings
mkdir -p .vim/tmp/undo .vim/tmp/backup .vim/tmp/swap
mkdir -p ~/var/cache ~/var/log

if [ `uname` == "Darwin" ]; then
    hash brew 2>&- || {
        # Install homebrew
        echo "Installing homebrew"
        ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" || true
    }

    brew install caskroom/cask/brew-cask
    brew cask install onepassword dropbox google-chrome firefox \
        google-notifier iterm2 hipchat \
        kaleidoscope omnidisksweeper vlc textexpander textwrangler \
        adium dropbox flux limechat appcleaner karabiner seil vagrant \
        caffeine divvy witch quicksilver || true

    # Brew install things
    #brew install python ack autojump vim par markdown tree autoenv cloc \
    #    fortune ctags git markdown mercurial \
       # nginx \
    #    node par pcre s3cmd zsh \
    #    ffmpeg libevent redis mysql libmcrypt go the_silver_searcher \
    #    wget libmcrypt readline highlight youtube-dl zmq pypy pyenv \
    #    pyenv-virtualenvwrapper

    pyenv install 2.7.9
    pyenv install 3.4.2
    pyenv install pypy-2.4.0

    defaults -currentHost write -globalDomain AppleFontSmoothing -int 2
fi

mkdir -p ~/share
mkdir -p ~/code

pushd ~/.ssh
    if [ ! -f github_rsa ]; then 
        echo "name this one github_rsa"
        ssh-keygen
    fi

    if [ ! -f bitbucket_rsa ]; then 
        echo "name this one bitbucket_rsa"
        ssh-keygen
    fi

    if [ ! -f id_rsa ]; then 
        echo "just hit enter"
        ssh-keygen
    fi
popd

if [ ! -d ~/.oh-my-zsh ]; then
    git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
fi

# if [[ ! `sudo grep /usr/local/bin/zsh /etc/shells` ]]; then
 #    echo 'Hit your password at the prompt'
  #   sudo echo "/usr/local/bin/zsh" >> /etc/shells
# else
 #    echo "already installed zsh to shells, skipping."
# fi

# if [[ "$SHELL" == "/bin/bash" ]]; then
    # chsh -s /usr/local/bin/zsh
# fi

git submodule update --init

# Pathogen install
mkdir -p .vim/autoload
cp .vim/pathogen/autoload/pathogen.vim .vim/autoload

echo "Open vim and run :GoInstallBindings"

# install chrome theme "greyscale"

# to save yourself some time:
# command t can only be compiled against the system ruby.
# brew install vim macvim
if [[ $SKIP_COMMAND_T == true ]]; then
    echo "skipping command t installation"
else
    bash "scripts/command-t.bash" 
fi
bash "scripts/focus-launchd.bash" /Library/LaunchDaemons

# download consolas from here:
# http://www.microsoft.com/mac/downloads?pid=Mactopia_AddTools&fid=9796588D-238F-4694-9598-1AA8D2BECB55#viewer
# http://www.wezm.net/technical/2010/08/howto-install-consolas-font-mac/

# change safari keys - need an Application Shortcut

# add option-arrow to iterm 
# http://cl.ly/3N2t2i2C0G2I1F0B2y2w

# open Keyboard settings and increase the key repeat rate to maximum
# in Keyboard shortcuts hit "All Controls" to tab through all of them
# move Spotlight shortcut to cmd+shift+space

# download pckeyboard hack, remap Caps Lock to 55. You don't need to restart.

# iphoto - open preferences, check "Opening camera does X", x is no application
# or open if your main laptop.

mkdir -p ~/bin

pushd ~/code
    if [ `uname` == "Darwin" ]; then
        git clone git@github.com:kevinburke/gitopen.git || true
        ln -s ~/code/gitopen/gitopen ~/bin/gitopen
    fi
    git clone git@github.com:kevinburke/weirdfortune.git || true
    hash weirdfortune 2>&- || {
        pushd ~/code/weirdfortune
            # XXX
            sh install.sh
            rm -rf /usr/local/bin/weirdfortune
            go install github.com/kevinburke/weirdfortune
        popd
    }
    git clone git@github.com:altercation/solarized.git || true
    git clone git@github.com:jakubroztocil/httpie.git || true
popd

mkdir -p ~/code/go
if [[ ! -d ~/code/go/src/code.google.com/p/go ]]; then 
    echo "checking out Go source code..."
    go get github.com/golang/go
fi

if [[ ! -d ~/code/local-servers ]]; then 
    if [ `uname` == "Darwin" ]; then
        git clone https://github.com/kevinburke/local-servers.git ~/code/local-servers
        pushd ~/code/local-servers
        make install || true
    fi
fi

brew install ruby
gem install chef travis sass