2013-11-19 17:05:48 +01:00
|
|
|
function _rails_command () {
|
2017-11-04 18:33:57 +01:00
|
|
|
if [ -e "bin/stubs/rails" ]; then
|
|
|
|
bin/stubs/rails $@
|
|
|
|
elif [ -e "bin/rails" ]; then
|
2014-01-10 22:52:18 +01:00
|
|
|
bin/rails $@
|
2013-11-19 17:05:48 +01:00
|
|
|
elif [ -e "script/rails" ]; then
|
|
|
|
ruby script/rails $@
|
2014-01-10 22:52:18 +01:00
|
|
|
elif [ -e "script/server" ]; then
|
|
|
|
ruby script/$@
|
2013-11-19 17:05:48 +01:00
|
|
|
else
|
2014-07-15 21:37:53 +02:00
|
|
|
command rails $@
|
2013-11-19 17:05:48 +01:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function _rake_command () {
|
2017-11-04 18:33:57 +01:00
|
|
|
if [ -e "bin/stubs/rake" ]; then
|
|
|
|
bin/stubs/rake $@
|
|
|
|
elif [ -e "bin/rake" ]; then
|
2013-11-19 17:05:48 +01:00
|
|
|
bin/rake $@
|
2019-10-18 21:56:30 +02:00
|
|
|
elif type bundle &> /dev/null && ([ -e "Gemfile" ] || [ -e "gems.rb" ]); then
|
2015-12-25 11:54:12 +01:00
|
|
|
bundle exec rake $@
|
2013-11-19 17:05:48 +01:00
|
|
|
else
|
2014-07-15 21:37:53 +02:00
|
|
|
command rake $@
|
2013-11-19 17:05:48 +01: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'
|
2016-09-20 04:51:50 +02:00
|
|
|
alias rcs='rails console --sandbox'
|
2013-11-19 17:05:48 +01:00
|
|
|
alias rd='rails destroy'
|
|
|
|
alias rdb='rails dbconsole'
|
2019-05-17 14:36:20 +02:00
|
|
|
alias rgen='rails generate'
|
2013-11-19 17:05:48 +01:00
|
|
|
alias rgm='rails generate migration'
|
|
|
|
alias rp='rails plugin'
|
2021-02-21 07:24:21 +01:00
|
|
|
alias rr='rails routes'
|
|
|
|
alias rrg='rails routes | grep'
|
2013-11-19 17:05:48 +01:00
|
|
|
alias ru='rails runner'
|
|
|
|
alias rs='rails server'
|
|
|
|
alias rsd='rails server --debugger'
|
2015-10-12 09:32:22 +02:00
|
|
|
alias rsp='rails server --port'
|
2021-06-12 05:07:21 +02:00
|
|
|
alias rsb='rails server --bind'
|
2013-11-19 17:05:48 +01:00
|
|
|
|
|
|
|
# Rake aliases
|
|
|
|
alias rdm='rake db:migrate'
|
2015-01-09 14:40:03 +01:00
|
|
|
alias rdms='rake db:migrate:status'
|
2013-11-19 17:05:48 +01:00
|
|
|
alias rdr='rake db:rollback'
|
|
|
|
alias rdc='rake db:create'
|
|
|
|
alias rds='rake db:seed'
|
|
|
|
alias rdd='rake db:drop'
|
2015-06-09 21:41:34 +02:00
|
|
|
alias rdrs='rake db:reset'
|
2013-11-19 17:05:48 +01:00
|
|
|
alias rdtc='rake db:test:clone'
|
|
|
|
alias rdtp='rake db:test:prepare'
|
2013-12-06 11:20:38 +01:00
|
|
|
alias rdmtc='rake db:migrate db:test:clone'
|
2016-08-15 03:01:13 +02:00
|
|
|
alias rdsl='rake db:schema:load'
|
2013-11-19 17:05:48 +01:00
|
|
|
alias rlc='rake log:clear'
|
|
|
|
alias rn='rake notes'
|
2015-07-07 14:44:35 +02:00
|
|
|
alias rt='rake test'
|
2015-09-28 19:59:06 +02:00
|
|
|
alias rmd='rake middleware'
|
2015-10-15 21:14:54 +02:00
|
|
|
alias rsts='rake stats'
|
2013-11-19 17:05:48 +01:00
|
|
|
|
|
|
|
# legacy stuff
|
2014-09-19 12:30:24 +02:00
|
|
|
alias sstat='thin --stats "/thin/stats" start'
|
2010-06-03 21:03:26 +02:00
|
|
|
alias sg='ruby script/generate'
|
|
|
|
alias sd='ruby script/destroy'
|
|
|
|
alias sp='ruby script/plugin'
|
2011-10-12 06:16:23 +02:00
|
|
|
alias sr='ruby script/runner'
|
2010-06-03 21:03:26 +02:00
|
|
|
alias ssp='ruby script/spec'
|
|
|
|
alias sc='ruby script/console'
|
|
|
|
alias sd='ruby script/server --debugger'
|
2010-06-03 21:32:55 +02:00
|
|
|
|
2010-06-03 21:55:07 +02:00
|
|
|
function remote_console() {
|
|
|
|
/usr/bin/env ssh $1 "( cd $2 && ruby script/console production )"
|
|
|
|
}
|