#!/bin/sh
# Usage: sync-home [user@]host ...
# Copy crucial dotfiles and scripts to one or more remote machines.
#
# Copyright (c) 2008 Ryan Tomayko <http://tomayko.com/about>
set -e

test -z "$1" || echo "$@" | grep -q -- '--help' && {
    echo "Usage: $0 [user@]host ..."
    exit 1
}

cd ~
for host in "$@"; do
    echo "sync: $host"
    rsync -avz --include-from=- --exclude='*' ./ "${host}:" <<FILES
+ /.inputrc
+ /.bashrc
+ /.dircolors
+ /.bash_completion
+ /.bash_completion.d
+ /.bash_completion.d/**

+ /.screenrc
+ /.gitshrc
+ /.gitconfig

+ /.vimrc
+ /.vim
- /.vim/sessions
- /.vim/plugin/netrwPlugin.vim
- /.vim/plugin/ruby_debugger.vim
- /.vim/swap
- /.vim/.netrwhist
- /.vim/tmp
+ /.vim/backup
- /.vim/backup/**
+ /.vim/**

+ /bin
+ /bin/ack
+ /bin/addr
+ /bin/github-grab
+ /bin/git-ignore
+ /bin/git-sh
+ /bin/gzball
+ /bin/headers
+ /bin/lgrep
+ /bin/sync-home
FILES
done