Last active
December 16, 2015 16:59
-
-
Save hugomaiavieira/5467177 to your computer and use it in GitHub Desktop.
my .bashrc file
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
export PATH="$HOME/.rbenv/bin:$PATH" # Add rbenv to PATH | |
eval "$(rbenv init -)" # init rbenv to enable shims and autocompletion | |
###### | |
# | |
# Oh my gems! | |
# | |
export ORIG_GEM_PATH=${GEM_PATH:-} | |
export ORIG_GEM_HOME=${GEM_HOME:-} | |
export ORIG_PATH=${PATH} | |
ohmygems() { | |
name=${1:-} | |
if [ -z "$name" ]; then | |
echo "usage: ohmygems <name or reset>" | |
echo | |
echo " Switches gem home to a (potentially new) named repo." | |
echo " Your previous gems are still visible," | |
echo " but new gem installs will install into ~/.gems/repos/<name>." | |
echo " Use 'reset' to go back to normal." | |
echo | |
echo "Available repos:" | |
echo | |
ls ~/.gem/repos | pr -o2 -l1 | |
echo | |
return | |
elif [ $name = "reset" ]; then | |
echo Resetting repo | |
if [ -z "$ORIG_GEM_HOME" ]; then | |
unset GEM_HOME | |
unset OHMYGEMS_REPO | |
else | |
GEM_HOME=${ORIG_GEM_HOME} | |
fi | |
GEM_PATH=${ORIG_GEM_PATH} | |
PATH=$ORIG_PATH | |
else | |
echo Switching to $name | |
export OHMYGEMS_REPO="@$name" # for $PS1 use | |
export GEM_HOME=~/.gem/repos/${name} | |
export GEM_PATH=${ORIG_GEM_HOME}:${ORIG_GEM_PATH} | |
export PATH=${GEM_HOME}/bin:${ORIG_PATH} # the order matters | |
fi | |
} | |
_ohmygems() { | |
local current=${COMP_WORDS[COMP_CWORD]} | |
local options="reset `ls ~/.gem/repos`" | |
COMPREPLY=( $(compgen -W "$options" $current) ) | |
} | |
complete -F _ohmygems ohmygems | |
# | |
# Oh my gems! | |
# | |
###### | |
export COMP_WORDBREAKS=${COMP_WORDBREAKS//:} | |
_rake() { | |
if [ -f Rakefile ]; then | |
local cache_file='.rake_tasks_cache' | |
local current=${COMP_WORDS[COMP_CWORD]} | |
local recent=`ls -t $cache_file Rakefile **/*.rake 2> /dev/null | head -n 1` | |
if [[ $recent != $cache_file ]]; then | |
rake -s -P | grep '^rake' | cut -d ' ' -f 2 > $cache_file | |
fi | |
COMPREPLY=($(compgen -W "`cat $cache_file`" $current)) | |
return 0 | |
fi | |
} | |
complete -o default -F _rake rake | |
complete -o default -F _rake zr | |
export PS1="\`ruby=\$(which ruby 1> /dev/null && ruby -v 2> /dev/null | grep -oP \"[0-9]+(\.[0-9]+)+\") && echo \"(\$ruby\$OHMYGEMS_REPO) \"\`\[\033[36m\]\u \[\033[33m\]\w \[\033[34m\]\$(__git_ps1 '(%s) ')\[\033[00m\]\n$ " | |
# android sdk | |
#export PATH=$PATH:~/install/android-sdk-linux/tools:~/install/android-sdk-linux/platform-tools | |
# google chrome to mobile dev | |
alias mobile_chrome="google-chrome --allow-file-access-from-files --disable-web-security --user-data-dir=$HOME/.google-chrome/session_dev_mobile" | |
# java home | |
#export JAVA_HOME="/usr/lib/jvm/java-1.7.0-openjdk-amd64/jre/" | |
### Added by the Heroku Toolbelt | |
#export PATH="/usr/local/heroku/bin:$PATH" | |
### AWS Elastic Beanstalk Command Line Tool | |
export PATH="~/install/aws-eb/eb/linux/python2.7:$PATH" | |
alias zs="zeus rspec" | |
alias zr="zeus rake" | |
alias ll="ls -lah" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment