Skip to content

Instantly share code, notes, and snippets.

@tigluiz
Forked from victorhg/.bash_profile
Last active December 11, 2015 06:08
Show Gist options
  • Save tigluiz/4557119 to your computer and use it in GitHub Desktop.
Save tigluiz/4557119 to your computer and use it in GitHub Desktop.
export EDITOR=vim
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
export DYLD_LIBRARY_PATH="/usr/local/mysql/lib/"
alias be="bundle exec"
alias ma="bundle exec rake db:migrate && bundle exec rake db:migrate RAILS_ENV=test"
alias mar="bundle exec rake db:rollback && bundle exec rake db:rollback RAILS_ENV=test"
alias assets="bundle exec rake assets:precompile"
alias assetss="bundle exec rake assets:precompile RAILS_ENV=staging"
alias ls="ls -G"
alias grep="grep --colour=auto"
alias pg-start='pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start'
alias pg-stop='pg_ctl -D /usr/local/var/postgres stop -s -m fast'
git_status() {
untracked=$(git status | grep 'Untracked files' 2> /dev/null)
if [ -n "$untracked" ]; then
echo "☠"
else
to_commit=$(git status | grep 'nothing to commit (working directory clean)' 2> /dev/null)
if [ -z "$to_commit" ]; then
echo "☠"
fi
fi
}
parse_git_branch ()
{
result=$(git branch 2> /dev/null | grep -e '\* ' | sed 's/^..\(.*\)/[\1]/')
if [ -n "$result" ]; then
echo $result $(git_status)
fi
}
# If id command returns zero, you’ve root access.
if [ $(id -u) -eq 0 ];then
# you are root, set red colour prompt
PS1="\\[$(tput setaf 1)\\]\\u@\\h:\\w #\\[$(tput sgr0)\\]"
else # normal
PS1='\[\033[1;37m\]\u \[\e[1;37m\]\W\[\e[m\] \[\e[0;36m\]$(parse_git_branch)\[\e[m\] \[\e[0;36m\]$\[\e[m\]'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment