Friday, November 25, 2011

Re: Dotfile and Github

Thank you Rich for your script! ^_^

Actually,I am a newbie in vim and shell script.I'm so sorry to say that I don't really understand this scripts.But I will keep it for later carefully reading.

On Thu, Nov 24, 2011 at 7:30 PM, Rich Healey <healey.rich@gmail.com> wrote:
In case anyone needs it, this is the script I use for merging my dotfiles (I ripped out a few bits and pieces)

#!/bin/sh

# This is a script to send my homedir changes to my git repo.
# Making changes there would be bad.

SENSITIVEGLOB="password"

to=$1
if [ -z $to ]; then
    echo "Specify where your git repo is"
    exit
fi

if [ ! -r $to ]; then
    echo "You have not specified a valid path, you dick head"
    exit 1
fi

# check for upstream changes
(   cd $to;
    if git status | grep "Your branch is behind" > /dev/null; then
        echo "Changes to merge!"
        exit 1
    else
        exit 0
    fi
) || exit
files=" .vimrc \
        .gvimrc \
        .colordiffrc \
        .colorsvnrc \
        .zshrc \
        .tmux.conf \
        .screenrc \
        .profile \
        .toprc \
        .nethackrc \
        .muttrc \
        .mutt/colors.conf \
        .mutt/accounts/example.conf \
        .htoprc \
        .gitconfig \
        .config/openbox/rc.xml \
        .config/openbox/autostart.sh \
        .Xdefaults \
        .gmrunrc \
        .pentadactylrc \
        .xinitrc \
        .config/uzbl/config \
        .config/vimprobable/vimprobablerc \
        .irssi/secure.theme \
        .irssi/intruder.theme \
        bin/battery \
        bin/mutt \
        bin/tinfo \
        bin/fortune_excuse \
        bin/pull_ext \
        bin/push_ext \
        bin/python \
        bin/vision \
        bin/mysql_remote \
        bin/smcctl \
        bin/music_watch \
        bin/__vol \
        bin/no_screensaver \
        .vim/plugin/debugger.py \
        .vim/plugin/debugger.vim \
        .vim/ftplugin/debchangelog/00_debchangelog.vim \
        .vim/ftplugin/debchangelog/90_local.vim \
        .vim/ftplugin/unixdocs/unixdocs_local.vim \
        .vim/ftplugin/mail/mail_local.vim \
        .vim/ftplugin/gitcommit/git_local.vim \
        .vim/ftplugin/html/html_local.vim \
        .vim/ftplugin/php/php_local.vim \
        .vim/ftplugin/python/python_local.vim \
        .vim/ftplugin/ruby/ruby_local.vim \
        .vim/ftdetect/wiki.vim \
        .vim/ftdetect/mail.vim \
        .vim/ftdetect/unixdocs.vim \
        .vim/ftdetect/debchangelog.vim \
        .vim/syntax/brainfuck.vim
        .vim/syntax/json.vim
        .vim/syntax/tmux.vim
        .vim/syntax/wiki.vim
        .tmuxinator/countkeys.yml \
        .cvsrc\
        code/ext/vim/.pull_data\
        code/ext/vim/merge"


# TODO Hax for directories

for i in $files; do
    dir=`dirname $i | sed -e "s/^\.//"`
    file=`basename $i | sed -e "s/^\.//"`
    if [ "$dir" != "" ]; then
        mkdir -p $to/$dir
    fi
    case $file in
         *)
            cp $i $to/$dir/$file
            ;;
    esac
    grep -E $SENSITIVEGLOB $i &&
        echo "Are you sure about that? Evidently there's sensitive data in |$i| bawss.."
done

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php



--

李杰辉

My blog: http://l-jiehui.blogspot.com/


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: