Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Ohmyzsh
Commits
9b37fcba
Commit
9b37fcba
authored
Nov 19, 2013
by
Thomas Kriechbaumer
Browse files
unified and improved Rails plugin
parent
e30a1243
Changes
4
Hide whitespace changes
Inline
Side-by-side
plugins/rails
3
/_rails
3
→
plugins/rails/_rails
View file @
9b37fcba
#
compdef
rails
#
autoload
#
rails
3
zsh
completion
,
based
on
homebrew
completion
#
Extracted
from
https
://
github
.
com
/
robbyrussell
/
oh
-
my
-
zsh
/
blob
/
30620
d463850c17f86e7a56fbf6a8b5e793a4e07
/
plugins
/
rails3
/
_rails3
#
Published
by
Christopher
Chow
local
-
a
_1st_arguments
_1st_arguments
=(
'generate:Generate new code (short-cut alias: "g")'
...
...
@@ -14,14 +10,20 @@ _1st_arguments=(
'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'
'plugin new:Generates skeleton for developing a Rails plugin'
'runner:Run a piece of code in the application environment (short-cut alias: "r")'
)
_rails_generate_arguments
()
{
generate_arguments
=(
assets
controller
decorator
generator
helper
integration_test
...
...
@@ -36,9 +38,11 @@ _rails_generate_arguments() {
scaffold_controller
session_migration
stylesheets
task
)
}
_arguments
\
'(--version)--version[show version]'
\
'(--help)--help[show help]'
\
...
...
@@ -50,7 +54,10 @@ if (( CURRENT == 1 )); then
fi
case
"$words[1]"
in
generate
)
g
|
generate
)
_rails_generate_arguments
_wanted
generate_arguments
expl
'all generate'
compadd
-
a
generate_arguments
;;
d
|
destroy
)
_rails_generate_arguments
_wanted
generate_arguments
expl
'all generate'
compadd
-
a
generate_arguments
;;
esac
plugins/rails/rails.plugin.zsh
View file @
9b37fcba
function
_rails_command
()
{
if
[
-e
"script/server"
]
;
then
ruby script/
$@
elif
[
-e
"script/rails"
]
;
then
ruby script/rails
$@
elif
[
-e
"bin/rails"
]
;
then
bin/rails
$@
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
rdbm
=
'rake db:migrate'
alias
rdbtp
=
'rake db:test:prepare'
alias
migrate
=
'rake db:migrate && rake db:test:prepare'
alias
sc
=
'ruby script/console'
alias
sd
=
'ruby script/server --debugger'
alias
devlog
=
'tail -f log/development.log'
alias
testlog
=
'tail -f log/test.log'
alias
prodlog
=
'tail -f log/production.log'
alias
-g
RET
=
'RAILS_ENV=test'
alias
-g
REP
=
'RAILS_ENV=production'
alias
-g
RED
=
'RAILS_ENV=development'
function
remote_console
()
{
/usr/bin/env ssh
$1
"( cd
$2
&& ruby script/console production )"
...
...
plugins/rails3/rails3.plugin.zsh
deleted
100644 → 0
View file @
e30a1243
# 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'
plugins/rails4/rails4.plugin.zsh
deleted
100644 → 0
View file @
e30a1243
# Rails 4 aliases
function
_rails_command
()
{
if
[
-e
"script/server"
]
;
then
ruby script/
$@
elif
[
-e
"script/rails"
]
;
then
ruby script/rails
$@
else
ruby bin/rails
$@
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
rdc
=
'rake db:create'
alias
rdr
=
'rake db:rollback'
alias
rds
=
'rake db:seed'
alias
rlc
=
'rake log:clear'
alias
rn
=
'rake notes'
alias
rr
=
'rake routes'
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment