3 This plugin adds completion for [Ruby On Rails Framework](https://rubyonrails.org/) and
4 [Rake](https://ruby.github.io/rake/) commands, as well as some aliases for logs and environment variables.
6 To use it, add `rails` to the plugins array in your zshrc file:
16 | Alias | Command | Description |
17 | ------- | -------------------------------- | ------------------------------------------------------ |
18 | `rc` | `rails console` | Interact with your Rails app from the CLI |
19 | `rcs` | `rails console --sandbox` | Test code in a sandbox, without changing any data |
20 | `rd` | `rails destroy` | Undo a generate operation |
21 | `rdb` | `rails dbconsole` | Interact with your db from the console |
22 | `rdc` | `rails db:create` | Create the database |
23 | `rdd` | `rails db:drop` | Delete the database |
24 | `rdm` | `rails db:migrate` | Run pending db migrations |
25 | `rdmd` | `rails db:migrate:down` | Undo specific db migration |
26 | `rdmr` | `rails db:migrate:redo` | Redo specific db migration |
27 | `rdms` | `rails db:migrate:status` | Show current db migration status |
28 | `rdmtc` | `rails db:migrate db:test:clone` | Run pending migrations and clone db into test database |
29 | `rdmu` | `rails db:migrate:up` | Run specific db migration |
30 | `rdr` | `rails db:rollback` | Roll back the last migration |
31 | `rdrs` | `rails db:reset` | Delete the database and set it up again |
32 | `rds` | `rails db:seed` | Seed the database |
33 | `rdsl` | `rails db:schema:load` | Load the database schema |
34 | `rdtc` | `rails db:test:clone` | Clone the database into the test database |
35 | `rdtp` | `rails db:test:prepare` | Duplicate the db schema into your test database |
36 | `rgen` | `rails generate` | Generate boilerplate code |
37 | `rgm` | `rails generate migration` | Generate a db migration |
38 | `rlc` | `rails log:clear` | Clear Rails logs |
39 | `rmd` | `rails middleware` | Interact with Rails middlewares |
40 | `rn` | `rails notes` | Search for notes (`FIXME`, `TODO`) in code comments |
41 | `rp` | `rails plugin` | Run a Rails plugin command |
42 | `rr` | `rails routes` | List all defined routes |
43 | `rrg` | `rails routes \| grep` | List and filter the defined routes |
44 | `rs` | `rails server` | Launch a web server |
45 | `rsb` | `rails server --bind` | Launch a web server binding it to a specific IP |
46 | `rsd` | `rails server --debugger` | Launch a web server with debugger |
47 | `rsp` | `rails server --port` | Launch a web server and specify the listening port |
48 | `rsts` | `rails stats` | Print code statistics |
49 | `rt` | `rails test` | Run Rails tests |
50 | `ru` | `rails runner` | Run Ruby code in the context of Rails |
54 | Alias | Command | Description |
55 | ------ | --------------- | ----------------------------------------- |
56 | `fmns` | `foreman start` | Interact with your Rails app from the CLI |
60 | Alias | Command | Description |
61 | --------- | ----------------------------- | ---------------------------------------------- |
62 | `devlog` | `tail -f log/development.log` | Show and follow changes to the development log |
63 | `prodlog` | `tail -f log/production.log` | Show and follow changes to the production log |
64 | `testlog` | `tail -f log/test.log` | Show and follow changes to the test log |
66 ### Environment settings
68 | Alias | Command | Description |
69 | ----- | ----------------------- | ------------------------------- |
70 | `RED` | `RAILS_ENV=development` | Sets `RAILS_ENV` to development |
71 | `REP` | `RAILS_ENV=production` | Sets `RAILS_ENV` to production |
72 | `RET` | `RAILS_ENV=test` | Sets `RAILS_ENV` to test |
74 These are global aliases. Use in combination with a command or just run them
75 separately. For example: `REP rake db:migrate` will migrate the production db.
81 The following commands are run [using `rails` instead of `rake` since Rails v5][1], but are preserved under the
82 prefix `rk` for backwards compatibility.
84 [1]: https://guides.rubyonrails.org/v5.2/command_line.html#bin-rails
86 | Alias | Command | Description |
87 | -------- | ------------------------------- | ------------------------------------------------------ |
88 | `rkdc` | `rake db:create` | Create the database |
89 | `rkdd` | `rake db:drop` | Delete the database |
90 | `rkdm` | `rake db:migrate` | Run pending db migrations |
91 | `rkdms` | `rake db:migrate:status` | Show current db migration status |
92 | `rkdmtc` | `rake db:migrate db:test:clone` | Run pending migrations and clone db into test database |
93 | `rkdr` | `rake db:rollback` | Roll back the last migration |
94 | `rkdrs` | `rake db:reset` | Delete the database and set it up again |
95 | `rkds` | `rake db:seed` | Seed the database |
96 | `rkdsl` | `rake db:schema:load` | Load the database schema |
97 | `rkdtc` | `rake db:test:clone` | Clone the database into the test database |
98 | `rkdtp` | `rake db:test:prepare` | Duplicate the db schema into your test database |
99 | `rklc` | `rake log:clear` | Clear Rails logs |
100 | `rkmd` | `rake middleware` | Interact with Rails middlewares |
101 | `rkn` | `rake notes` | Search for notes (`FIXME`, `TODO`) in code comments |
102 | `rksts` | `rake stats` | Print code statistics |
103 | `rkt` | `rake test` | Run Rails tests |
108 | ------- | ---------------------------------- |
109 | `sc` | `ruby script/console` |
110 | `sd` | `ruby script/destroy` |
111 | `sd` | `ruby script/server --debugger` |
112 | `sg` | `ruby script/generate` |
113 | `sp` | `ruby script/plugin` |
114 | `sr` | `ruby script/runner` |
115 | `ssp` | `ruby script/spec` |
116 | `sstat` | `thin --stats "/thin/stats" start` |
118 - `remote_console <server> <directory>`: runs `ruby script/console production` on a remote server.