You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
laughing-hipster/.dev_profile

91 lines
2.5 KiB

#!/bin/bash
# Setup go paths and source go bin
if [ -d "/c/Windows" ]; then
export ANSIBLE_HOSTS="/c/ansible/hosts"
export WINDOWS="TRUE"
export GOPATH="/d/Projects/Programming/Go"
export GOROOT="/d/Programs/Go"
export GIT_EDITOR=~/Tools/vim/gvim.exe
PATH=${PATH}:/c/tools/ruby193/bin
else
export ANSIBLE_HOSTS="~/.ansible/hosts"
export GOPATH="$HOME/../Projects/go"
export GOROOT="/usr/local/go"
export GIT_EDITOR=vim
export WINDOWS="FALSE"
fi
if [ -d "/c/Windows" ]; then
export BOOT2DOCKER=/usr/local/Cellar/boot2docker/1.6.0/bin
else
export BOOT2DOCKER=/c/Program\ Files/Boot2Docker\ for\ WIndows/
fi
PATH=${PATH}:${BOOT2DOCKER}
# if there is a C:/Projects folder on this box then I'm obviously using my work computer
if [ -d "/c/Projects" ]; then
export WORK="TRUE"
. ~/.work_profile
fi
export GOBIN=${GOPATH}/bin
PATH=${PATH}:${GOBIN}:${GOROOT}/bin
# see environ manfile
export EDITOR=$GIT_EDITOR # Default Editor
export VISUAL=$EDITOR # Visual not really used differently from EDITOR anymore
export LESS='-iMR' # Case insensite search, verbose prompting and raw output
export PAGER=less # Used to display text / man files
# History
HISTCONTROL=ignoredups # No duplicate commands in history
HISTSIZE=50000 # For a huge history
export HISTIGNORE="[ ]*:&:bg:fg:exit:clear" # Don't save these commands in the history
shopt -s histappend # Append to the history file, not overwrite
# Bash behavior
shopt -s checkwinsize # Checks window size to get proper line wrapping
shopt -s cdspell # Corrects minor spelling errors when cd-ing
set -o vi # Set prompt to vi mode
set -o notify # Report status of terminated background jobs immediately
# Override the Git command
git() {
cmd=$1
shift
extra=""
quoted_args=""
whitespace="[[:space:]]"
for i in "$@"
do
quoted_args="$quoted_args \"$i\""
done
cmdToRun="`which git` "$cmd" $quoted_args"
cmdToRun=`echo $cmdToRun | sed -e 's/^ *//' -e 's/ *$//'`
bash -c "$cmdToRun"
if [ $? -eq 0 ]; then
# Commit stats
if [ "$cmd" == "commit" ]; then
commit_hash=`git rev-parse HEAD`
repo_url=`git config --get remote.origin.url`
commit_date=`git log -1 --format=%cd`
commit_data="\"{ \"date\": \"$commit_date\", \"url\": \"$repo_url\", \"hash\": \"$commit_hash\" }\""
git-stats --record "$commit_data"
fi
fi
}
commits() {
printmotd
if [ -f `which git-stats` ]; then
"git-stats"
fi
echo ""
}
commits