1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-12-25 13:51:57 +00:00
ohmyzsh/plugins/rails/rails.plugin.zsh

87 lines
2.1 KiB
Bash
Raw Normal View History

2013-11-19 16:05:48 +00:00
function _rails_command () {
if [ -e "bin/stubs/rails" ]; then
bin/stubs/rails $@
elif [ -e "bin/rails" ]; then
bin/rails $@
2013-11-19 16:05:48 +00:00
elif [ -e "script/rails" ]; then
ruby script/rails $@
elif [ -e "script/server" ]; then
ruby script/$@
2013-11-19 16:05:48 +00:00
else
command rails $@
2013-11-19 16:05:48 +00:00
fi
}
function _rake_command () {
if [ -e "bin/stubs/rake" ]; then
bin/stubs/rake $@
elif [ -e "bin/rake" ]; then
2013-11-19 16:05:48 +00:00
bin/rake $@
elif type bundle &> /dev/null && ([ -e "Gemfile" ] || [ -e "gems.rb" ]); then
2015-12-25 10:54:12 +00:00
bundle exec rake $@
2013-11-19 16:05:48 +00:00
else
command rake $@
2013-11-19 16:05:48 +00: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 rcs='rails console --sandbox'
2013-11-19 16:05:48 +00:00
alias rd='rails destroy'
alias rdb='rails dbconsole'
alias rgen='rails generate'
2013-11-19 16:05:48 +00:00
alias rgm='rails generate migration'
alias rp='rails plugin'
alias ru='rails runner'
alias rs='rails server'
alias rsd='rails server --debugger'
alias rsp='rails server --port'
2013-11-19 16:05:48 +00:00
# Rake aliases
alias rdm='rake db:migrate'
2015-01-09 13:40:03 +00:00
alias rdms='rake db:migrate:status'
2013-11-19 16:05:48 +00:00
alias rdr='rake db:rollback'
alias rdc='rake db:create'
alias rds='rake db:seed'
alias rdd='rake db:drop'
alias rdrs='rake db:reset'
2013-11-19 16:05:48 +00:00
alias rdtc='rake db:test:clone'
alias rdtp='rake db:test:prepare'
2013-12-06 10:20:38 +00:00
alias rdmtc='rake db:migrate db:test:clone'
alias rdsl='rake db:schema:load'
2013-11-19 16:05:48 +00:00
alias rlc='rake log:clear'
alias rn='rake notes'
alias rr='rake routes'
2015-08-17 00:53:58 +00:00
alias rrg='rake routes | grep'
2015-07-07 12:44:35 +00:00
alias rt='rake test'
2015-09-28 17:59:06 +00:00
alias rmd='rake middleware'
2015-10-15 19:14:54 +00:00
alias rsts='rake stats'
2013-11-19 16:05:48 +00:00
# legacy stuff
alias sstat='thin --stats "/thin/stats" start'
alias sg='ruby script/generate'
alias sd='ruby script/destroy'
alias sp='ruby script/plugin'
2011-10-12 04:16:23 +00:00
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 )"
}