rails.plugin.zsh 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. function _rails_command () {
  2. if [ -e "script/server" ]; then
  3. ruby script/$@
  4. elif [ -e "script/rails" ]; then
  5. ruby script/rails $@
  6. elif [ -e "bin/rails" ]; then
  7. bin/rails $@
  8. else
  9. rails $@
  10. fi
  11. }
  12. function _rake_command () {
  13. if [ -e "bin/rake" ]; then
  14. bin/rake $@
  15. else
  16. rake $@
  17. fi
  18. }
  19. alias rails='_rails_command'
  20. compdef _rails_command=rails
  21. alias rake='_rake_command'
  22. compdef _rake_command=rake
  23. alias devlog='tail -f log/development.log'
  24. alias prodlog='tail -f log/production.log'
  25. alias testlog='tail -f log/test.log'
  26. alias -g RED='RAILS_ENV=development'
  27. alias -g REP='RAILS_ENV=production'
  28. alias -g RET='RAILS_ENV=test'
  29. # Rails aliases
  30. alias rc='rails console'
  31. alias rd='rails destroy'
  32. alias rdb='rails dbconsole'
  33. alias rg='rails generate'
  34. alias rgm='rails generate migration'
  35. alias rp='rails plugin'
  36. alias ru='rails runner'
  37. alias rs='rails server'
  38. alias rsd='rails server --debugger'
  39. # Rake aliases
  40. alias rdm='rake db:migrate'
  41. alias rdr='rake db:rollback'
  42. alias rdc='rake db:create'
  43. alias rds='rake db:seed'
  44. alias rdd='rake db:drop'
  45. alias rdtc='rake db:test:clone'
  46. alias rdtp='rake db:test:prepare'
  47. alias rlc='rake log:clear'
  48. alias rn='rake notes'
  49. alias rr='rake routes'
  50. # legacy stuff
  51. alias ss='thin --stats "/thin/stats" start'
  52. alias sg='ruby script/generate'
  53. alias sd='ruby script/destroy'
  54. alias sp='ruby script/plugin'
  55. alias sr='ruby script/runner'
  56. alias ssp='ruby script/spec'
  57. alias sc='ruby script/console'
  58. alias sd='ruby script/server --debugger'
  59. function remote_console() {
  60. /usr/bin/env ssh $1 "( cd $2 && ruby script/console production )"
  61. }