mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-12 01:52:31 +01:00
unified and improved Rails plugin
This commit is contained in:
parent
e30a1243dc
commit
9b37fcba5e
4 changed files with 71 additions and 78 deletions
|
|
@ -1,56 +0,0 @@
|
|||
#compdef rails
|
||||
#autoload
|
||||
|
||||
# rails 3 zsh completion, based on homebrew completion
|
||||
# Extracted from https://github.com/robbyrussell/oh-my-zsh/blob/30620d463850c17f86e7a56fbf6a8b5e793a4e07/plugins/rails3/_rails3
|
||||
# Published by Christopher Chow
|
||||
|
||||
local -a _1st_arguments
|
||||
_1st_arguments=(
|
||||
'generate:Generate new code (short-cut alias: "g")'
|
||||
'console:Start the Rails console (short-cut alias: "c")'
|
||||
'server:Start the Rails server (short-cut alias: "s")'
|
||||
'dbconsole:Start a console for the database specified in config/database.yml (short-cut alias: "db")'
|
||||
'new:Create a new Rails application. "rails new my_app" creates a new application called MyApp in "./my_app"'
|
||||
'application:Generate the Rails application code'
|
||||
'destroy:Undo code generated with "generate"'
|
||||
'benchmarker:See how fast a piece of code runs'
|
||||
'profiler:Get profile information from a piece of code'
|
||||
'plugin:Install a plugin'
|
||||
)
|
||||
|
||||
_rails_generate_arguments() {
|
||||
generate_arguments=(
|
||||
controller
|
||||
generator
|
||||
helper
|
||||
integration_test
|
||||
mailer
|
||||
migration
|
||||
model
|
||||
observer
|
||||
performance_test
|
||||
plugin
|
||||
resource
|
||||
scaffold
|
||||
scaffold_controller
|
||||
session_migration
|
||||
stylesheets
|
||||
)
|
||||
}
|
||||
|
||||
_arguments \
|
||||
'(--version)--version[show version]' \
|
||||
'(--help)--help[show help]' \
|
||||
'*:: :->subcmds' && return 0
|
||||
|
||||
if (( CURRENT == 1 )); then
|
||||
_describe -t commands "rails subcommand" _1st_arguments
|
||||
return
|
||||
fi
|
||||
|
||||
case "$words[1]" in
|
||||
generate)
|
||||
_rails_generate_arguments
|
||||
_wanted generate_arguments expl 'all generate' compadd -a generate_arguments ;;
|
||||
esac
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
# Rails 3 aliases, backwards-compatible with Rails 2.
|
||||
|
||||
function _rails_command () {
|
||||
if [ -e "script/server" ]; then
|
||||
ruby script/$@
|
||||
else
|
||||
if [ -e "bin/rails" ]; then
|
||||
bin/rails $@
|
||||
else
|
||||
rails $@
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
alias rc='_rails_command console'
|
||||
alias rd='_rails_command destroy'
|
||||
alias rdb='_rails_command dbconsole'
|
||||
alias rdbm='rake db:migrate db:test:clone'
|
||||
alias rg='_rails_command generate'
|
||||
alias rgm='_rails_command generate migration'
|
||||
alias rp='_rails_command plugin'
|
||||
alias ru='_rails_command runner'
|
||||
alias rs='_rails_command server'
|
||||
alias rsd='_rails_command server --debugger'
|
||||
alias devlog='tail -f log/development.log'
|
||||
alias testlog='tail -f log/test.log'
|
||||
alias prodlog='tail -f log/production.log'
|
||||
alias rdm='rake db:migrate'
|
||||
alias rdr='rake db:rollback'
|
||||
alias -g RET='RAILS_ENV=test'
|
||||
alias -g REP='RAILS_ENV=production'
|
||||
alias -g RED='RAILS_ENV=development'
|
||||
Loading…
Add table
Add a link
Reference in a new issue