a6671919ab
Changes precedence of the conditional clause, more recent versions come first now. Fixes problems when users update their app and still have the old rails files inside of their file tree. Closes #2405 - check the discussion there for further info.
72 lines
1.6 KiB
Bash
72 lines
1.6 KiB
Bash
function _rails_command () {
|
|
if [ -e "bin/rails" ]; then
|
|
bin/rails $@
|
|
elif [ -e "script/rails" ]; then
|
|
ruby script/rails $@
|
|
elif [ -e "script/server" ]; then
|
|
ruby script/$@
|
|
else
|
|
rails $@
|
|
fi
|
|
}
|
|
|
|
function _rake_command () {
|
|
if [ -e "bin/rake" ]; then
|
|
bin/rake $@
|
|
else
|
|
rake $@
|
|
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'
|
|
|
|
# Rake aliases
|
|
alias rdm='rake db:migrate'
|
|
alias rdr='rake db:rollback'
|
|
alias rdc='rake db:create'
|
|
alias rds='rake db:seed'
|
|
alias rdd='rake db:drop'
|
|
alias rdtc='rake db:test:clone'
|
|
alias rdtp='rake db:test:prepare'
|
|
|
|
alias rlc='rake log:clear'
|
|
alias rn='rake notes'
|
|
alias rr='rake routes'
|
|
|
|
# legacy stuff
|
|
alias ss='thin --stats "/thin/stats" start'
|
|
alias sg='ruby script/generate'
|
|
alias sd='ruby script/destroy'
|
|
alias sp='ruby script/plugin'
|
|
alias sr='ruby script/runner'
|
|
alias ssp='ruby script/spec'
|
|
alias sc='ruby script/console'
|
|
alias sd='ruby script/server --debugger'
|
|
|
|
function remote_console() {
|
|
/usr/bin/env ssh $1 "( cd $2 && ruby script/console production )"
|
|
}
|