2013-11-20 00:05:48 +08:00
|
|
|
function _rails_command () {
|
2014-01-11 05:52:18 +08:00
|
|
|
if [ -e "bin/rails" ]; then
|
|
|
|
bin/rails $@
|
2013-11-20 00:05:48 +08:00
|
|
|
elif [ -e "script/rails" ]; then
|
|
|
|
ruby script/rails $@
|
2014-01-11 05:52:18 +08:00
|
|
|
elif [ -e "script/server" ]; then
|
|
|
|
ruby script/$@
|
2013-11-20 00:05:48 +08:00
|
|
|
else
|
2014-07-16 03:37:53 +08:00
|
|
|
command rails $@
|
2013-11-20 00:05:48 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function _rake_command () {
|
|
|
|
if [ -e "bin/rake" ]; then
|
|
|
|
bin/rake $@
|
|
|
|
else
|
2014-07-16 03:37:53 +08:00
|
|
|
command rake $@
|
2013-11-20 00:05:48 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
alias rails='_rails_command'
|
|
|
|
compdef _rails_command=rails
|
|
|
|
|
|
|
|
alias rake='_rake_command'
|
|
|
|
compdef _rake_command=rake
|
|
|
|
|
|
|
|
alias devlog='tail -f log/development.log'
|
|
|
|
alias prodlog='tail -f log/production.log'
|
|
|
|
alias testlog='tail -f log/test.log'
|
|
|
|
|
|
|
|
alias -g RED='RAILS_ENV=development'
|
|
|
|
alias -g REP='RAILS_ENV=production'
|
|
|
|
alias -g RET='RAILS_ENV=test'
|
|
|
|
|
|
|
|
# Rails aliases
|
|
|
|
alias rc='rails console'
|
|
|
|
alias rd='rails destroy'
|
|
|
|
alias rdb='rails dbconsole'
|
|
|
|
alias rg='rails generate'
|
|
|
|
alias rgm='rails generate migration'
|
|
|
|
alias rp='rails plugin'
|
|
|
|
alias ru='rails runner'
|
|
|
|
alias rs='rails server'
|
|
|
|
alias rsd='rails server --debugger'
|
2015-10-12 15:32:22 +08:00
|
|
|
alias rsp='rails server --port'
|
2013-11-20 00:05:48 +08:00
|
|
|
|
|
|
|
# Rake aliases
|
|
|
|
alias rdm='rake db:migrate'
|
2015-01-09 21:40:03 +08:00
|
|
|
alias rdms='rake db:migrate:status'
|
2013-11-20 00:05:48 +08:00
|
|
|
alias rdr='rake db:rollback'
|
|
|
|
alias rdc='rake db:create'
|
|
|
|
alias rds='rake db:seed'
|
|
|
|
alias rdd='rake db:drop'
|
2015-06-10 03:41:34 +08:00
|
|
|
alias rdrs='rake db:reset'
|
2013-11-20 00:05:48 +08:00
|
|
|
alias rdtc='rake db:test:clone'
|
|
|
|
alias rdtp='rake db:test:prepare'
|
2013-12-06 18:20:38 +08:00
|
|
|
alias rdmtc='rake db:migrate db:test:clone'
|
2013-11-20 00:05:48 +08:00
|
|
|
alias rlc='rake log:clear'
|
|
|
|
alias rn='rake notes'
|
|
|
|
alias rr='rake routes'
|
2015-08-17 08:53:58 +08:00
|
|
|
alias rrg='rake routes | grep'
|
2015-07-07 20:44:35 +08:00
|
|
|
alias rt='rake test'
|
2015-09-29 01:59:06 +08:00
|
|
|
alias rmd='rake middleware'
|
2013-11-20 00:05:48 +08:00
|
|
|
|
|
|
|
# legacy stuff
|
2014-09-19 18:30:24 +08:00
|
|
|
alias sstat='thin --stats "/thin/stats" start'
|
2010-06-04 03:03:26 +08:00
|
|
|
alias sg='ruby script/generate'
|
|
|
|
alias sd='ruby script/destroy'
|
|
|
|
alias sp='ruby script/plugin'
|
2011-10-12 12:16:23 +08:00
|
|
|
alias sr='ruby script/runner'
|
2010-06-04 03:03:26 +08:00
|
|
|
alias ssp='ruby script/spec'
|
|
|
|
alias sc='ruby script/console'
|
|
|
|
alias sd='ruby script/server --debugger'
|
2010-06-04 03:32:55 +08:00
|
|
|
|
2010-06-04 03:55:07 +08:00
|
|
|
function remote_console() {
|
|
|
|
/usr/bin/env ssh $1 "( cd $2 && ruby script/console production )"
|
|
|
|
}
|