Browse Source

add bash profile w/ embedded installers

Kyle P Davis 10 years ago
parent
commit
5d59f567ee
1 changed files with 88 additions and 0 deletions
  1. 88 0
      .profile

+ 88 - 0
.profile

@@ -0,0 +1,88 @@
+export PATH="$HOME/bin:$PATH"
+
+# Homebrew
+export PATH="$HOME/homebrew/bin:$PATH"
+export PYTHONPATH="$(brew --prefix)/lib/python2.7/site-packages/"  # also facilitates:  easy_install -d "$PYTHONPATH" awesome_pkg
+
+# Custom shell aliases
+alias ls="ls -FG"
+alias d="ls"
+alias tree='tree -CF'
+alias grep="grep --color --exclude-dir=.svn --exclude-dir=.git --exclude-dir=node_modules"
+
+# MacVim shell aliases
+alias gvim="mvim"
+
+# Default editor
+export EDITOR="vim"
+
+# bash completion FTW
+! [ -f "$(brew --prefix)/etc/bash_completion" ]  ||  . "$(brew --prefix)/etc/bash_completion"
+
+# color diffs
+! which colordiff &>/dev/null  ||  alias diff="colordiff"
+
+# Git shell aliases
+F="/Library/Developer/CommandLineTools/usr/share/git-core/git-completion.bash";  ! [ -f "$F" ]  ||  . "$F"
+
+# Liquid Prompt
+F="$HOME/liquidprompt/liquidprompt";  ! [ "$PS1" -a -f "$F" ]  ||  . "$F"
+
+# go lang
+export GOPATH=$(brew --prefix)
+export PATH="$PATH:$(brew --prefix)/opt/go/libexec/bin"
+
+# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
+HISTSIZE=50000
+HISTFILESIZE=500000
+
+# make less allow and use colors
+export LESS="-FRX"
+
+
+###############################################################################
+# Installers
+###############################################################################
+
+_install_homebrew() {
+	[ -d "$HOME/homebrew" ]  ||  (mkdir "$HOME/homebrew" 2>/dev/null  &&  curl -L "https://github.com/Homebrew/homebrew/tarball/master" | tar xz --strip 1 -C "$HOME/homebrew"  &&  brew update)
+}
+
+_install_tools() {
+	_install_homebrew
+	[ -d "$HOME/liquidprompt" ]  ||  git clone "https://github.com/nojhan/liquidprompt.git" "$HOME/liquidprompt"
+	which tmux >/dev/null  ||  brew install tmux
+	[ -f "$HOME/.bash_profile" ]  ||  ln -sv "$HOME/.profile" "$HOME/.bash_profile"
+	[ -f "$HOME/.bashrc" ]        ||  ln -sv "$HOME/.profile" "$HOME/.bash_profile"
+}
+
+_install_dev_js() {
+	_install_homebrew
+	which node >/dev/null  ||  brew install node
+	PKG=jshint;       which "$PKG" >/dev/null  ||  npm install -g "$PKG"
+	PKG=js-beautify;  which "$PKG" >/dev/null  ||  npm install -g "$PKG"
+	PKG=json;         which "$PKG" >/dev/null  ||  npm install -g "$PKG"
+}
+
+_install_dev_sh() {
+	_install_homebrew
+	which shellcheck >/dev/null  ||  brew install shellcheck
+}
+
+_install_dev_py() {
+	_install_homebrew
+	PKG=pylint;  which "$PKG" >/dev/null  ||  (easy_install -d "$PYTHONPATH" "$PKG"  &&  ln -sv "$PYTHONPATH/$PKG" "$(brew --prefix)/bin/$PKG")
+	PKG=pep8;    which "$PKG" >/dev/null  ||  (easy_install -d "$PYTHONPATH" "$PKG"  &&  ln -sv "$PYTHONPATH/$PKG" "$(brew --prefix)/bin/$PKG")
+}
+
+_install_dev_db() {
+	_install_homebrew
+	which mongod >/dev/null  ||  brew install mongodb
+	which redis >/dev/null   ||  brew install redis
+}
+
+_install_dev_go() {
+	_install_homebrew
+	which go >/dev/null  ||  brew install go --cross-compile-common
+}
+