forked from extern/ohmyzsh
feat(rails)!: run old rake aliases with rails
(#9601)
BREAKING CHANGE: we've updated the aliases that run `rake` to use `rails` instead because that's how they are run since Rails v5. The old `rake` aliases can still be run by using the `rk` prefix (e.g. the `rake test` alias has been changed from `rt` to `rkt`). Closes #9601 Closes #9813 Fixes #10696 Co-authored-by: Vsevolod Voloshyn <seva.voloshin@gmail.com>
This commit is contained in:
parent
4f0b680248
commit
3075d0c0ab
@ -12,47 +12,46 @@ plugins=(... rails)
|
|||||||
|
|
||||||
### Rails aliases
|
### Rails aliases
|
||||||
|
|
||||||
| Alias | Command | Description |
|
| Alias | Command | Description |
|
||||||
|-------|----------------------------|----------------------------------------------------|
|
| ------- | -------------------------------- | ------------------------------------------------------ |
|
||||||
| `rc` | `rails console` | Interact with your Rails app from the CLI |
|
| `rc` | `rails console` | Interact with your Rails app from the CLI |
|
||||||
| `rcs` | `rails console --sandbox` | Test code in a sandbox, without changing any data |
|
| `rcs` | `rails console --sandbox` | Test code in a sandbox, without changing any data |
|
||||||
| `rd` | `rails destroy` | Undo a generate operation |
|
| `rd` | `rails destroy` | Undo a generate operation |
|
||||||
| `rdb` | `rails dbconsole` | Interact with your db from the console |
|
| `rdb` | `rails dbconsole` | Interact with your db from the console |
|
||||||
| `rgen`| `rails generate` | Generate boilerplate code |
|
| `rdc` | `rails db:create` | Create the database |
|
||||||
| `rgm` | `rails generate migration` | Generate a db migration |
|
| `rdd` | `rails db:drop` | Delete the database |
|
||||||
| `rp` | `rails plugin` | Run a Rails plugin command |
|
| `rdm` | `rails db:migrate` | Run pending db migrations |
|
||||||
| `rr` | `rails routes` | List all defined routes |
|
| `rdmd` | `rails db:migrate:down` | Undo specific db migration |
|
||||||
| `rrg` | `rails routes \| grep` | List and filter the defined routes |
|
| `rdmr` | `rails db:migrate:redo` | Redo specific db migration |
|
||||||
| `ru` | `rails runner` | Run Ruby code in the context of Rails |
|
| `rdms` | `rails db:migrate:status` | Show current db migration status |
|
||||||
| `rs` | `rails server` | Launch a web server |
|
| `rdmtc` | `rails db:migrate db:test:clone` | Run pending migrations and clone db into test database |
|
||||||
| `rsd` | `rails server --debugger` | Launch a web server with debugger |
|
| `rdmu` | `rails db:migrate:up` | Run specific db migration |
|
||||||
| `rsp` | `rails server --port` | Launch a web server and specify the listening port |
|
| `rdr` | `rails db:rollback` | Roll back the last migration |
|
||||||
|
| `rdrs` | `rails db:reset` | Delete the database and set it up again |
|
||||||
### Rake aliases
|
| `rds` | `rails db:seed` | Seed the database |
|
||||||
|
| `rdsl` | `rails db:schema:load` | Load the database schema |
|
||||||
| Alias | Command | Description |
|
| `rdtc` | `rails db:test:clone` | Clone the database into the test database |
|
||||||
|---------|---------------------------------|--------------------------------------------------------|
|
| `rdtp` | `rails db:test:prepare` | Duplicate the db schema into your test database |
|
||||||
| `rdm` | `rake db:migrate` | Run pending db migrations |
|
| `rgen` | `rails generate` | Generate boilerplate code |
|
||||||
| `rdms` | `rake db:migrate:status` | Show current db migration status |
|
| `rgm` | `rails generate migration` | Generate a db migration |
|
||||||
| `rdmtc` | `rake db:migrate db:test:clone` | Run pending migrations and clone db into test database |
|
| `rlc` | `rails log:clear` | Clear Rails logs |
|
||||||
| `rdr` | `rake db:rollback` | Roll back the last migration |
|
| `rmd` | `rails middleware` | Interact with Rails middlewares |
|
||||||
| `rdc` | `rake db:create` | Create the database |
|
| `rn` | `rails notes` | Search for notes (`FIXME`, `TODO`) in code comments |
|
||||||
| `rds` | `rake db:seed` | Seed the database |
|
| `rp` | `rails plugin` | Run a Rails plugin command |
|
||||||
| `rdd` | `rake db:drop` | Delete the database |
|
| `rr` | `rails routes` | List all defined routes |
|
||||||
| `rdrs` | `rake db:reset` | Delete the database and set it up again |
|
| `rrg` | `rails routes \| grep` | List and filter the defined routes |
|
||||||
| `rdtc` | `rake db:test:clone` | Clone the database into the test database |
|
| `rs` | `rails server` | Launch a web server |
|
||||||
| `rdtp` | `rake db:test:prepare` | Duplicate the db schema into your test database |
|
| `rsb` | `rails server --bind` | Launch a web server binding it to a specific IP |
|
||||||
| `rdsl` | `rake db:schema:load` | Load the database schema |
|
| `rsd` | `rails server --debugger` | Launch a web server with debugger |
|
||||||
| `rlc` | `rake log:clear` | Clear Rails logs |
|
| `rsp` | `rails server --port` | Launch a web server and specify the listening port |
|
||||||
| `rn` | `rake notes` | Search for notes (`FIXME`, `TODO`) in code comments |
|
| `rsts` | `rails stats` | Print code statistics |
|
||||||
| `rt` | `rake test` | Run Rails tests |
|
| `rt` | `rails test` | Run Rails tests |
|
||||||
| `rmd` | `rake middleware` | Interact with Rails middlewares |
|
| `ru` | `rails runner` | Run Ruby code in the context of Rails |
|
||||||
| `rsts` | `rake stats` | Print code statistics |
|
|
||||||
|
|
||||||
### Utility aliases
|
### Utility aliases
|
||||||
|
|
||||||
| Alias | Command | Description |
|
| Alias | Command | Description |
|
||||||
|-----------|-------------------------------|------------------------------------------------|
|
| --------- | ----------------------------- | ---------------------------------------------- |
|
||||||
| `devlog` | `tail -f log/development.log` | Show and follow changes to the development log |
|
| `devlog` | `tail -f log/development.log` | Show and follow changes to the development log |
|
||||||
| `prodlog` | `tail -f log/production.log` | Show and follow changes to the production log |
|
| `prodlog` | `tail -f log/production.log` | Show and follow changes to the production log |
|
||||||
| `testlog` | `tail -f log/test.log` | Show and follow changes to the test log |
|
| `testlog` | `tail -f log/test.log` | Show and follow changes to the test log |
|
||||||
@ -60,7 +59,7 @@ plugins=(... rails)
|
|||||||
### Environment settings
|
### Environment settings
|
||||||
|
|
||||||
| Alias | Command | Description |
|
| Alias | Command | Description |
|
||||||
|-------|-------------------------|---------------------------------|
|
| ----- | ----------------------- | ------------------------------- |
|
||||||
| `RED` | `RAILS_ENV=development` | Sets `RAILS_ENV` to development |
|
| `RED` | `RAILS_ENV=development` | Sets `RAILS_ENV` to development |
|
||||||
| `REP` | `RAILS_ENV=production` | Sets `RAILS_ENV` to production |
|
| `REP` | `RAILS_ENV=production` | Sets `RAILS_ENV` to production |
|
||||||
| `RET` | `RAILS_ENV=test` | Sets `RAILS_ENV` to test |
|
| `RET` | `RAILS_ENV=test` | Sets `RAILS_ENV` to test |
|
||||||
@ -68,15 +67,41 @@ plugins=(... rails)
|
|||||||
These are global aliases. Use in combination with a command or just run them
|
These are global aliases. Use in combination with a command or just run them
|
||||||
separately. For example: `REP rake db:migrate` will migrate the production db.
|
separately. For example: `REP rake db:migrate` will migrate the production db.
|
||||||
|
|
||||||
|
### Legacy rake aliases
|
||||||
|
|
||||||
|
The following commands are run [using `rails` instead of `rake` since Rails v5][1], but are preserved under the
|
||||||
|
prefix `rk` for backwards compatibility.
|
||||||
|
|
||||||
|
[1]: https://guides.rubyonrails.org/v5.2/command_line.html#bin-rails
|
||||||
|
|
||||||
|
| Alias | Command | Description |
|
||||||
|
| -------- | ------------------------------- | ------------------------------------------------------ |
|
||||||
|
| `rkdc` | `rake db:create` | Create the database |
|
||||||
|
| `rkdd` | `rake db:drop` | Delete the database |
|
||||||
|
| `rkdm` | `rake db:migrate` | Run pending db migrations |
|
||||||
|
| `rkdms` | `rake db:migrate:status` | Show current db migration status |
|
||||||
|
| `rkdmtc` | `rake db:migrate db:test:clone` | Run pending migrations and clone db into test database |
|
||||||
|
| `rkdr` | `rake db:rollback` | Roll back the last migration |
|
||||||
|
| `rkdrs` | `rake db:reset` | Delete the database and set it up again |
|
||||||
|
| `rkds` | `rake db:seed` | Seed the database |
|
||||||
|
| `rkdsl` | `rake db:schema:load` | Load the database schema |
|
||||||
|
| `rkdtc` | `rake db:test:clone` | Clone the database into the test database |
|
||||||
|
| `rkdtp` | `rake db:test:prepare` | Duplicate the db schema into your test database |
|
||||||
|
| `rklc` | `rake log:clear` | Clear Rails logs |
|
||||||
|
| `rkmd` | `rake middleware` | Interact with Rails middlewares |
|
||||||
|
| `rkn` | `rake notes` | Search for notes (`FIXME`, `TODO`) in code comments |
|
||||||
|
| `rksts` | `rake stats` | Print code statistics |
|
||||||
|
| `rkt` | `rake test` | Run Rails tests |
|
||||||
|
|
||||||
### Legacy stuff
|
### Legacy stuff
|
||||||
|
|
||||||
| Alias | Command |
|
| Alias | Command |
|
||||||
|---------|------------------------------------|
|
| ------- | ---------------------------------- |
|
||||||
| `sstat` | `thin --stats "/thin/stats" start` |
|
| `sc` | `ruby script/console` |
|
||||||
| `sg` | `ruby script/generate` |
|
|
||||||
| `sd` | `ruby script/destroy` |
|
| `sd` | `ruby script/destroy` |
|
||||||
|
| `sd` | `ruby script/server --debugger` |
|
||||||
|
| `sg` | `ruby script/generate` |
|
||||||
| `sp` | `ruby script/plugin` |
|
| `sp` | `ruby script/plugin` |
|
||||||
| `sr` | `ruby script/runner` |
|
| `sr` | `ruby script/runner` |
|
||||||
| `ssp` | `ruby script/spec` |
|
| `ssp` | `ruby script/spec` |
|
||||||
| `sc` | `ruby script/console` |
|
| `sstat` | `thin --stats "/thin/stats" start` |
|
||||||
| `sd` | `ruby script/server --debugger` |
|
|
||||||
|
@ -43,47 +43,67 @@ alias rc='rails console'
|
|||||||
alias rcs='rails console --sandbox'
|
alias rcs='rails console --sandbox'
|
||||||
alias rd='rails destroy'
|
alias rd='rails destroy'
|
||||||
alias rdb='rails dbconsole'
|
alias rdb='rails dbconsole'
|
||||||
|
alias rdc='rails db:create'
|
||||||
|
alias rdd='rails db:drop'
|
||||||
|
alias rdm='rails db:migrate'
|
||||||
|
alias rdmd='rails db:migrate:down'
|
||||||
|
alias rdmr='rails db:migrate:redo'
|
||||||
|
alias rdms='rails db:migrate:status'
|
||||||
|
alias rdmtc='rails db:migrate db:test:clone'
|
||||||
|
alias rdmu='rails db:migrate:up'
|
||||||
|
alias rdr='rails db:rollback'
|
||||||
|
alias rdrs='rails db:reset'
|
||||||
|
alias rds='rails db:seed'
|
||||||
|
alias rdsl='rails db:schema:load'
|
||||||
|
alias rdtc='rails db:test:clone'
|
||||||
|
alias rdtp='rails db:test:prepare'
|
||||||
alias rgen='rails generate'
|
alias rgen='rails generate'
|
||||||
alias rgm='rails generate migration'
|
alias rgm='rails generate migration'
|
||||||
|
alias rlc='rails log:clear'
|
||||||
|
alias rmd='rails middleware'
|
||||||
|
alias rn='rails notes'
|
||||||
alias rp='rails plugin'
|
alias rp='rails plugin'
|
||||||
alias rr='rails routes'
|
alias rr='rails routes'
|
||||||
alias rrg='rails routes | grep'
|
alias rrg='rails routes | grep'
|
||||||
alias ru='rails runner'
|
|
||||||
alias rs='rails server'
|
alias rs='rails server'
|
||||||
|
alias rsb='rails server --bind'
|
||||||
alias rsd='rails server --debugger'
|
alias rsd='rails server --debugger'
|
||||||
alias rsp='rails server --port'
|
alias rsp='rails server --port'
|
||||||
alias rsb='rails server --bind'
|
alias rsts='rails stats'
|
||||||
|
alias rt='rails test'
|
||||||
|
alias ru='rails runner'
|
||||||
|
|
||||||
|
|
||||||
# Rake aliases
|
# Rake aliases
|
||||||
alias rdm='rake db:migrate'
|
alias rkdc='rake db:create'
|
||||||
alias rdmr='rake db:migrate:redo'
|
alias rkdd='rake db:drop'
|
||||||
alias rdmd='rake db:migrate:down'
|
alias rkdm='rake db:migrate'
|
||||||
alias rdms='rake db:migrate:status'
|
alias rkdmd='rake db:migrate:down'
|
||||||
alias rdmu='rake db:migrate:up'
|
alias rkdmr='rake db:migrate:redo'
|
||||||
alias rdr='rake db:rollback'
|
alias rkdms='rake db:migrate:status'
|
||||||
alias rdc='rake db:create'
|
alias rkdmtc='rake db:migrate db:test:clone'
|
||||||
alias rds='rake db:seed'
|
alias rkdmu='rake db:migrate:up'
|
||||||
alias rdd='rake db:drop'
|
alias rkdr='rake db:rollback'
|
||||||
alias rdrs='rake db:reset'
|
alias rkdrs='rake db:reset'
|
||||||
alias rdtc='rake db:test:clone'
|
alias rkds='rake db:seed'
|
||||||
alias rdtp='rake db:test:prepare'
|
alias rkdsl='rake db:schema:load'
|
||||||
alias rdmtc='rake db:migrate db:test:clone'
|
alias rkdtc='rake db:test:clone'
|
||||||
alias rdsl='rake db:schema:load'
|
alias rkdtp='rake db:test:prepare'
|
||||||
alias rlc='rake log:clear'
|
alias rklc='rake log:clear'
|
||||||
alias rn='rake notes'
|
alias rkmd='rake middleware'
|
||||||
alias rt='rake test'
|
alias rkn='rake notes'
|
||||||
alias rmd='rake middleware'
|
alias rksts='rake stats'
|
||||||
alias rsts='rake stats'
|
alias rkt='rake test'
|
||||||
|
|
||||||
# legacy stuff
|
# legacy stuff
|
||||||
alias sstat='thin --stats "/thin/stats" start'
|
alias sc='ruby script/console'
|
||||||
alias sg='ruby script/generate'
|
|
||||||
alias sd='ruby script/destroy'
|
alias sd='ruby script/destroy'
|
||||||
|
alias sd='ruby script/server --debugger'
|
||||||
|
alias sg='ruby script/generate'
|
||||||
alias sp='ruby script/plugin'
|
alias sp='ruby script/plugin'
|
||||||
alias sr='ruby script/runner'
|
alias sr='ruby script/runner'
|
||||||
alias ssp='ruby script/spec'
|
alias ssp='ruby script/spec'
|
||||||
alias sc='ruby script/console'
|
alias sstat='thin --stats "/thin/stats" start'
|
||||||
alias sd='ruby script/server --debugger'
|
|
||||||
|
|
||||||
function remote_console() {
|
function remote_console() {
|
||||||
/usr/bin/env ssh $1 "( cd $2 && ruby script/console production )"
|
/usr/bin/env ssh $1 "( cd $2 && ruby script/console production )"
|
||||||
|
Loading…
Reference in New Issue
Block a user