public
Created

user + path + rvm + git branch

  • Download Gist
bash_profile
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
#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 ubuntu@107.20.137.45"
alias aws_db_master="ssh -i $MG_AWS_CERT ubuntu@ec2-107-22-41-198.compute-1.amazonaws.com"
alias aws_db_mirror="ssh -i $MG_AWS_CERT ubuntu@ec2-107-22-107-40.compute-1.amazonaws.com"
alias aws_db_desenv="ssh -i $MG_AWS_CERT ubuntu@ec2-107-20-70-240.compute-1.amazonaws.com"
alias aws_app_desenv="ssh -i $MG_AWS_CERT ubuntu@50.19.241.93"
alias aws_app_jenkins="ssh -i $MG_AWS_CERT ubuntu@23.21.226.208"
alias aws_app_staging="ssh -i $MG_AWS_CERT ubuntu@23.21.219.255"
 
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"

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.