Last active
December 12, 2020 13:17
-
-
Save bootcoder/725b6529f471d612524e to your computer and use it in GitHub Desktop.
bash_profile - rbenv
This file contains hidden or 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
# echo is like puts for bash (bash is the program running in your terminal) | |
echo "Loading ~/.bash_profile a shell script that runs in every new terminal you open" | |
# $VARIABLE will render before the rest of the command is executed | |
echo "Logged in as $USER at $(hostname)" | |
# Rbenv autocomplete and shims | |
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi | |
# Path for RBENV | |
test -d $HOME/.rbenv/ && PATH="$HOME/.rbenv/bin:$PATH" | |
# Path changes are made non-destructive with PATH=new_path;$PATH This is like A=A+B so we preserve the old path | |
# Path order matters, putting /usr/local/bin: before $PATH | |
# ensures brew programs will be seen and used before another program | |
# of the same name is called | |
# Path for brew | |
test -d /usr/local/bin && export PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH" | |
# Path for Heroku | |
test -d /usr/local/heroku/ && export PATH="/usr/local/heroku/bin:$PATH" | |
# Load git completions | |
git_completion_script=/usr/local/etc/bash_completion.d/git-completion.bash | |
test -s $git_completion_script && source $git_completion_script | |
# A more colorful prompt | |
# \[\e[0m\] resets the color to default color | |
c_reset='\[\e[0m\]' | |
# \e[0;31m\ sets the color to red | |
c_path='\[\e[0;31m\]' | |
# \e[0;32m\ sets the color to green | |
c_git_clean='\[\e[0;32m\]' | |
# \e[0;31m\ sets the color to red | |
c_git_dirty='\[\e[0;31m\]' | |
# PS1 is the variable for the prompt you see everytime you hit enter | |
PROMPT_COMMAND='PS1="${c_path}\W${c_reset}$(git_prompt) :> "' | |
export PS1='\n\[\033[0;31m\]\W\[\033[0m\]$(git_prompt)\[\033[0m\]:> ' | |
# determines if the git branch you are on is clean or dirty | |
git_prompt () | |
{ | |
if ! git rev-parse --git-dir > /dev/null 2>&1; then | |
return 0 | |
fi | |
# Grab working branch name | |
git_branch=$(Git branch 2>/dev/null| sed -n '/^\*/s/^\* //p') | |
# Clean or dirty branch | |
if git diff --quiet 2>/dev/null >&2; then | |
git_color="${c_git_clean}" | |
else | |
git_color=${c_git_dirty} | |
fi | |
echo " [$git_color$git_branch${c_reset}]" | |
} | |
# Colors ls should use for folders, files, symlinks etc. | |
# see `man ls` and search for LSCOLORS | |
export LSCOLORS=ExGxFxdxCxDxDxaccxaeex | |
# Force ls to use colors (G) and use humanized file sizes (h) | |
alias ls='ls -Gh' | |
# Force grep to always use the color option and show line numbers | |
# Disabled due to breaking effects on ElasticSearch. (I think...) | |
# export GREP_OPTIONS='--color=always' | |
# Set sublime as the default editor | |
which -s subl && export EDITOR="subl --wait" | |
# Load NVM | |
export NVM_DIR="$HOME/.nvm" | |
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm | |
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion | |
# Load Pyenv | |
eval "$(pyenv init -)" | |
# Ensure older brews are added to path. | |
export PATH="$(brew --prefix [email protected])/bin:$PATH" | |
export PATH="/usr/local/opt/[email protected]/bin:$PATH" | |
# Alias git to hub | |
eval "$(hub alias -s)" | |
# Destination Aliases | |
alias work="cd /Users/hunter/Dropbox/ACODE/GrioJerbs" | |
alias rando="cd ~/Dropbox/ACODE/adBC/RandoApp" | |
alias notes="cd ~/Dropbox/ACODE/adBC/notes" | |
alias rivals="cd /Users/hunter/Dropbox/ACODE/GrioJerbs/rivalry" | |
# Useful aliases | |
alias e=subl | |
alias a=atom | |
alias be="bundle exec" | |
alias cl=clear | |
alias brwe=brew | |
alias hubit="hub browse" | |
# Git related aliases | |
alias g=git | |
alias gti="git" | |
alias gits="git s" | |
alias gst="git status" | |
alias gap="git add -p" | |
alias gav="git commit -v" | |
alias gco="git checkout" | |
alias gb="git branch" | |
alias gp="git pull" | |
alias gs="git stash" | |
alias gcp="git cherry-pick" | |
alias gpo="git push origin" | |
alias gph="git push heroku" | |
# Ruby aliases | |
alias shitgun="shotgun" | |
alias shogun="shotgun" | |
alias shotfun="shotgun" | |
alias bs="be shotgun" | |
alias rials="rails" | |
alias rc="rails c" | |
alias rj="rails jasmine" | |
alias rjc="rails jasmine:ci" | |
alias cca="codeclimate analyze" | |
# Grio specific aliases | |
alias bet="CI=true REAL_BRAINTREE=true be rake" | |
alias betci="CI=true REAL_BRAINTREE=true be rspec" | |
alias rebet="./bin/rerun_failures" | |
alias rss="yarn install && rails db:migrate && rails s" | |
alias rsf="yarn install && && rails db:migrate && bundle exec foreman start -f Procfile.dev" | |
alias rcp="heroku run rails console -a rivals-production" | |
alias rcs="heroku run rails console -a rivals-staging" | |
alias rca="heroku run rails console -a rivals-acceptance" | |
alias hlp="heroku logs -t -a rivals-production" | |
alias hls="heroku logs -t -a rivals-staging" | |
alias hla="heroku logs -t -a rivals-acceptance" | |
function add_pr_remotes() { | |
mv .git/config .git/config-orig | |
awk '/remote "origin"/ { | |
print $0 | |
getline; | |
print $0 | |
getline; | |
print $0 | |
print "\tfetch = +refs/pull/*/head:refs/remotes/origin/pr/*" | |
}1' .git/config-orig > .git/config | |
git fetch origin | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Always good to have this reference <3