.profile 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. export PATH="$PATH:$HOME/bin"
  2. # Homebrew
  3. export PATH="$PATH:$HOME/homebrew/bin"
  4. export PYTHONPATH="$(brew --prefix)/lib/python2.7/site-packages/" # also facilitates: easy_install -d "$PYTHONPATH" awesome_pkg
  5. # Custom shell aliases
  6. alias ls="ls -FG"
  7. alias d="ls"
  8. alias tree='tree -CF'
  9. alias grep="grep --color --exclude-dir=.svn --exclude-dir=.git --exclude-dir=node_modules"
  10. # MacVim shell aliases
  11. alias gvim="mvim"
  12. # Default editor
  13. export EDITOR="vim"
  14. # bash completion FTW
  15. ! [ -f "$(brew --prefix)/etc/bash_completion" ] || . "$(brew --prefix)/etc/bash_completion"
  16. # color diffs
  17. ! which colordiff &>/dev/null || alias diff="colordiff"
  18. # Git shell aliases
  19. F="/Library/Developer/CommandLineTools/usr/share/git-core/git-completion.bash"; ! [ -f "$F" ] || . "$F"
  20. # Liquid Prompt
  21. F="$HOME/liquidprompt/liquidprompt"; ! [ "$PS1" -a -f "$F" ] || . "$F"
  22. # go lang
  23. export GOROOT="$(brew --prefix go)"
  24. export PATH="$PATH:$GOROOT/bin"
  25. export GOPATH="$HOME/go"
  26. export PATH="$PATH:$GOPATH/bin"
  27. # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
  28. HISTSIZE=50000
  29. HISTFILESIZE=500000
  30. # make less allow and use colors
  31. export LESS="-FRX"
  32. ###############################################################################
  33. # Installers
  34. ###############################################################################
  35. _install_homebrew() {
  36. [ -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)
  37. }
  38. _install_tools() {
  39. xcode-select --install || true
  40. _install_homebrew
  41. [ -d "$HOME/liquidprompt" ] || git clone "https://github.com/nojhan/liquidprompt.git" "$HOME/liquidprompt"
  42. which tmux >/dev/null || brew install tmux
  43. which tree >/dev/null || brew install tree
  44. [ -f "$HOME/.bash_profile" ] || ln -sv "$HOME/.profile" "$HOME/.bash_profile"
  45. [ -f "$HOME/.bashrc" ] || ln -sv "$HOME/.profile" "$HOME/.bashrc"
  46. [ -f "$HOME/.gitconfig" ] || (
  47. git config --global color.ui true
  48. git config --global credential.helper "$([ "$(uname -s)" = "Darwin" ] && echo "osxkeychain" || echo "cache --timeout=3600")"
  49. )
  50. which git-alias >/dev/null || brew install git-extras
  51. [ "$(git alias)" ] || (
  52. git alias br branch
  53. git alias ci commit
  54. git alias co checkout
  55. git alias di diff
  56. git alias st status
  57. )
  58. }
  59. _install_dev_js() {
  60. _install_homebrew
  61. which node >/dev/null || brew install node
  62. PKG=jshint; which "$PKG" >/dev/null || npm install -g "$PKG"
  63. PKG=js-beautify; which "$PKG" >/dev/null || npm install -g "$PKG"
  64. PKG=json; which "$PKG" >/dev/null || npm install -g "$PKG"
  65. PKG=jscs; which "$PKG" >/dev/null || npm install -g "$PKG"
  66. }
  67. _install_dev_sh() {
  68. _install_homebrew
  69. which shellcheck >/dev/null || brew install shellcheck
  70. }
  71. _install_dev_py() {
  72. _install_homebrew
  73. mkdir -p "$PYTHONPATH"
  74. PKG=pylint; which "$PKG" >/dev/null || (easy_install -d "$PYTHONPATH" "$PKG" && ln -sv "$PYTHONPATH/$PKG" "$(brew --prefix)/bin/$PKG")
  75. PKG=pep8; which "$PKG" >/dev/null || (easy_install -d "$PYTHONPATH" "$PKG" && ln -sv "$PYTHONPATH/$PKG" "$(brew --prefix)/bin/$PKG")
  76. }
  77. _install_dev_db() {
  78. _install_homebrew
  79. which mongod >/dev/null || brew install mongodb && ln -sfv "$(brew --prefix mongodb)"/*.plist ~/Library/LaunchAgents/
  80. which redis >/dev/null || brew install redis && ln -sfv "$(brew --prefix redis)"/*.plist ~/Library/LaunchAgents/
  81. which pg_config || brew install postgresql && ln -sfv "$(brew --prefix postgrsql)"/*.plist ~/Library/LaunchAgents/
  82. }
  83. _install_dev_go() {
  84. _install_homebrew
  85. which go >/dev/null || brew install go --cross-compile-common
  86. }