2012-01-31 23:37:51 -05:00
|
|
|
#
|
|
|
|
# Defines Ruby on Rails aliases.
|
|
|
|
#
|
|
|
|
# Authors:
|
|
|
|
# Robby Russell <robby@planetargon.com>
|
|
|
|
# Jake Bell <jake.b.bell@gmail.com>
|
|
|
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
|
|
|
#
|
|
|
|
|
2012-07-23 15:00:44 -04:00
|
|
|
# Return if requirements are not found.
|
|
|
|
if (( ! $+commands[rails] )); then
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
2012-08-04 14:48:32 -04:00
|
|
|
#
|
2012-06-14 19:05:12 -04:00
|
|
|
# Aliases (Compatible with Rails 2)
|
2012-08-04 14:48:32 -04:00
|
|
|
#
|
|
|
|
|
2011-08-30 23:16:15 -04:00
|
|
|
alias rc='_rails-command console'
|
2012-06-14 19:05:12 -04:00
|
|
|
alias rdc='_rails-command dbconsole'
|
|
|
|
alias rdm='rake db:migrate'
|
|
|
|
alias rdM='rake db:migrate db:test:clone'
|
|
|
|
alias rdr='rake db:rollback'
|
2011-08-30 23:16:15 -04:00
|
|
|
alias rg='_rails-command generate'
|
2012-06-14 19:05:12 -04:00
|
|
|
alias rl='tail -f log/development.log'
|
|
|
|
alias rlc='rake log:clear'
|
2011-08-30 23:16:15 -04:00
|
|
|
alias rp='_rails-command plugin'
|
2011-12-28 11:21:18 -05:00
|
|
|
alias rr='_rails-command runner'
|
2011-08-30 23:16:15 -04:00
|
|
|
alias rs='_rails-command server'
|
|
|
|
alias rsd='_rails-command server --debugger'
|
2012-06-14 19:05:12 -04:00
|
|
|
alias rx='_rails-command destroy'
|
2010-06-03 15:32:55 -04:00
|
|
|
|
2012-08-04 14:48:32 -04:00
|
|
|
#
|
2011-08-30 23:16:15 -04:00
|
|
|
# Functions
|
2012-08-04 14:48:32 -04:00
|
|
|
#
|
|
|
|
|
2012-03-23 14:57:51 -04:00
|
|
|
function _rails-command {
|
2011-08-30 23:16:15 -04:00
|
|
|
if [[ -e "script/server" ]]; then
|
|
|
|
ruby script/"$@"
|
|
|
|
else
|
|
|
|
ruby script/rails "$@"
|
|
|
|
fi
|
2010-06-03 15:55:07 -04:00
|
|
|
}
|
2011-08-30 23:16:15 -04:00
|
|
|
|