Created
August 30, 2011 19:14
-
-
Save mvoto/1181752 to your computer and use it in GitHub Desktop.
user + path + rvm + git branch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#RVM | |
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" | |
function ruby_version { | |
ruby -e '/(.*)\/(.*)/.match(`echo $GEM_HOME`);print ($2.nil? ? "" : $2)' | |
} | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
function proml { | |
#colors | |
local BLUE="\[\033[0;34m\]" | |
local RED="\[\033[0;31m\]" | |
local YELLOW="\[\033[0;33m\]" | |
local LIGHT_RED="\[\033[1;31m\]" | |
local GREEN="\[\033[0;32m\]" | |
local LIGHT_GREEN="\[\033[1;32m\]" | |
local WHITE="\[\033[1;37m\]" | |
local LIGHT_GRAY="\[\033[0;37m\]" | |
#rvm - ruby@gemset | |
local GEMSET_NAME=`rvm current` | |
#git | |
local BRANCH=`git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'` | |
local STATUS=`git status 2>/dev/null` | |
local GIT_PROMT='' | |
#git.states | |
local STATE=" " | |
local PROMPT_COLOR=$YELLOW | |
local NOTHING_TO_COMMIT="# Initial commit" | |
local BEHIND="# Your branch is behind" | |
local AHEAD="# Your branch is ahead" | |
local UNTRACKED="# Untracked files" | |
local DIVERGED="have diverged" | |
local CHANGED="# Changed but not updated" | |
local TO_BE_COMMITED="# Changes to be committed" | |
local LOG=`git log -1 2> /dev/null` | |
if [ "$STATUS" != "" ]; then | |
if [[ "$STATUS" =~ "$NOTHING_TO_COMMIT" ]]; then | |
PROMPT_COLOR=$LIGHT_RED | |
STATE="" | |
elif [[ "$STATUS" =~ "$DIVERGED" ]]; then | |
PROMPT_COLOR=$LIGHT_RED | |
STATE="${STATE}${RED}↕${NO_COLOR}" | |
elif [[ "$STATUS" =~ "$BEHIND" ]]; then | |
PROMPT_COLOR=$LIGHT_RED | |
STATE="${STATE}${RED}↓${NO_COLOR}" | |
elif [[ "$STATUS" =~ "$AHEAD" ]]; then | |
PROMPT_COLOR=$LIGHT_RED | |
STATE="${STATE}${RED}↑${NO_COLOR}" | |
elif [[ "$STATUS" =~ "$CHANGED" ]]; then | |
PROMPT_COLOR=$LIGHT_RED | |
STATE="" | |
elif [[ "$STATUS" =~ "$TO_BE_COMMITED" ]]; then | |
PROMPT_COLOR=$LIGHT_RED | |
STATE="" | |
else | |
PROMPT_COLOR=$YELLOW | |
STATE="" | |
fi | |
fi | |
if [[ "$BRANCH" != "" ]]; then | |
GIT_PROMT="$PROMPT_COLOR{ $(parse_git_branch)$STATE }" | |
fi | |
PS1=" $LIGHT_RED\u::$GREEN[\w] $BLUE`ruby_version` $PROMPT_COLOR\$(parse_git_branch)$STATE $GREEN\$$WHITE\n⤷ " | |
# PS1=" $LIGHT_RED\u::$GREEN[\w]" | |
# PS1="$PS1 $BLUE`ruby_version`$PROMPT_COLOR " | |
# PS1=$PS1'$(__git_ps1 "(%s)")' | |
# PS1="$PS1 $STATE $GREEN\$$WHITE\n⤷ " | |
} | |
proml | |
cd() { | |
builtin cd $* | |
if [[ -s .rvmrc ]] ; then source .rvmrc ; fi | |
proml | |
} | |
# mysql | |
export PATH=$PATH:/usr/local/mysql/bin | |
export LD_LIBRARY_PATH=/usr/local/mysql/lib ldconfig | |
# postgres | |
export PATH=${PATH}:/Library/PostgreSQL/9.0/bin | |
# export PGDATA=/usr/local/pgsql/data | |
export RUBYOPT="-ropenssl" | |
# AMAZON | |
export MG_AWS_CERT=/Users/mauriciovoto/Web/projetos/mallguide-rails/doc/mallguide.pem | |
alias aws_app_prod="ssh -i $MG_AWS_CERT [email protected]" | |
alias aws_db_master="ssh -i $MG_AWS_CERT [email protected]" | |
alias aws_db_mirror="ssh -i $MG_AWS_CERT [email protected]" | |
alias aws_db_desenv="ssh -i $MG_AWS_CERT [email protected]" | |
alias aws_app_desenv="ssh -i $MG_AWS_CERT [email protected]" | |
alias aws_app_jenkins="ssh -i $MG_AWS_CERT [email protected]" | |
alias aws_app_staging="ssh -i $MG_AWS_CERT [email protected]" | |
export JAVA_HOME=/usr | |
export EC2_HOME=/Users/mauriciovoto/Estudos/ec2-api-tools-1.5.2.3 | |
export PATH=$PATH:$EC2_HOME/bin | |
export EC2_PRIVATE_KEY=/Users/mauriciovoto/Web/projetos/mallguide-rails/doc/pk-PMMUVCAP7CM4BJ4A4KY7DCSNDP7GZ7I4.pem | |
export EC2_CERT=/Users/mauriciovoto/Web/projetos/mallguide-rails/doc/cert-PMMUVCAP7CM4BJ4A4KY7DCSNDP7GZ7I4.pem | |
# Jenkins | |
export JENKINS_HOME=/Users/Shared/Jenkins/Home | |
export WAR_HOME=/Applications/Jenkins | |
alias start_jenkins="sudo java -jar $WAR_HOME/jenkins.war" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment