From 905eb815fa380d561d23af33bbbda6175025c343 Mon Sep 17 00:00:00 2001 From: David Librera Date: Sat, 4 Nov 2017 18:33:57 +0100 Subject: Check first for bin/stubs directory in _rails_command and _rake_command (#6372) --- plugins/rails/rails.plugin.zsh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'plugins/rails') diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh index c8974b5f4..eb3f30360 100644 --- a/plugins/rails/rails.plugin.zsh +++ b/plugins/rails/rails.plugin.zsh @@ -1,5 +1,7 @@ function _rails_command () { - if [ -e "bin/rails" ]; then + if [ -e "bin/stubs/rails" ]; then + bin/stubs/rails $@ + elif [ -e "bin/rails" ]; then bin/rails $@ elif [ -e "script/rails" ]; then ruby script/rails $@ @@ -11,7 +13,9 @@ function _rails_command () { } function _rake_command () { - if [ -e "bin/rake" ]; then + if [ -e "bin/stubs/rake" ]; then + bin/stubs/rake $@ + elif [ -e "bin/rake" ]; then bin/rake $@ elif type bundle &> /dev/null && [ -e "Gemfile" ]; then bundle exec rake $@ -- cgit v1.2.3-70-g09d2 From c117d241cb4157204e9bda5285786d95e9c2fb36 Mon Sep 17 00:00:00 2001 From: oooooooo Date: Tue, 24 Apr 2018 03:36:55 +0900 Subject: $ rails runner [TAB] *complete* (#5881) --- plugins/rails/_rails | 3 +++ 1 file changed, 3 insertions(+) (limited to 'plugins/rails') diff --git a/plugins/rails/_rails b/plugins/rails/_rails index 96f57ce64..ad7505506 100644 --- a/plugins/rails/_rails +++ b/plugins/rails/_rails @@ -51,6 +51,9 @@ _arguments \ if (( CURRENT == 1 )); then _describe -t commands "rails subcommand" _1st_arguments return +else + _files + return fi case "$words[1]" in -- cgit v1.2.3-70-g09d2 From 8d95f76050b3e936f83f23d244f226b01693f73c Mon Sep 17 00:00:00 2001 From: Ivan Polchenko Date: Mon, 15 Apr 2019 10:29:49 -0700 Subject: rails: create README (#5841) --- plugins/rails/README.md | 83 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 plugins/rails/README.md (limited to 'plugins/rails') diff --git a/plugins/rails/README.md b/plugins/rails/README.md new file mode 100644 index 000000000..7a3db3d64 --- /dev/null +++ b/plugins/rails/README.md @@ -0,0 +1,83 @@ +# Rails + +This plugin adds completion for [Ruby On Rails Framework](https://rubyonrails.org/) and [Rake](https://ruby.github.io/rake/) commands, as well as some aliases for logs and environment variables. + +To use it, add `rails` to the plugins array in your zshrc file: + +```zsh +plugins=(... rails) +``` + +## List of Aliases + +### Rails aliases + +| Alias | Command | Description | +|-------|----------------------------|----------------------------------------------------| +| `rc` | `rails console` | Interact with your Rails app from the CLI | +| `rcs` | `rails console --sandbox` | Test code in a sandbox, without changing any data | +| `rd` | `rails destroy` | Undo a generate operation | +| `rdb` | `rails dbconsole` | Interact with your db from the console | +| `rg` | `rails generate` | Generate boilerplate code | +| `rgm` | `rails generate migration` | Generate a db migration | +| `rp` | `rails plugin` | Run a Rails plugin command | +| `ru` | `rails runner` | Run Ruby code in the context of Rails | +| `rs` | `rails server` | Launch a web server | +| `rsd` | `rails server --debugger` | Launch a web server with debugger | +| `rsp` | `rails server --port` | Launch a web server and specify the listening port | + +### Rake aliases + +| Alias | Command | Description | +|---------|---------------------------------|--------------------------------------------------------| +| `rdm` | `rake db:migrate` | Run pending db migrations | +| `rdms` | `rake db:migrate:status` | Show current db migration status | +| `rdmtc` | `rake db:migrate db:test:clone` | Run pending migrations and clone db into test database | +| `rdr` | `rake db:rollback` | Roll back the last migration | +| `rdc` | `rake db:create` | Create the database | +| `rds` | `rake db:seed` | Seed the database | +| `rdd` | `rake db:drop` | Delete the database | +| `rdrs` | `rake db:reset` | Delete the database and set it up again | +| `rdtc` | `rake db:test:clone` | Clone the database into the test database | +| `rdtp` | `rake db:test:prepare` | Duplicate the db schema into your test database | +| `rdsl` | `rake db:schema:load` | Load the database schema | +| `rlc` | `rake log:clear` | Clear Rails logs | +| `rn` | `rake notes` | Search for notes (`FIXME`, `TODO`) in code comments | +| `rr` | `rake routes` | List all defined routes | +| `rrg` | `rake routes | grep` | List and filter the defined routes | +| `rt` | `rake test` | Run Rails tests | +| `rmd` | `rake middleware` | Interact with Rails middlewares | +| `rsts` | `rake stats` | Print code statistics | + +### Utility aliases + +| Alias | Command | Description | +|-----------|-------------------------------|------------------------------------------------| +| `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 | +| `testlog` | `tail -f log/test.log` | Show and follow changes to the test log | + +### Environment settings + +| Alias | Command | Description | +|-------|-------------------------|---------------------------------| +| `RED` | `RAILS_ENV=development` | Sets `RAILS_ENV` to development | +| `REP` | `RAILS_ENV=production` | Sets `RAILS_ENV` to production | +| `RET` | `RAILS_ENV=test` | Sets `RAILS_ENV` to test | + +These are global aliases. Use in combination with a command or just run them +separately. For example: `RED rake db:migrate` will migrate the production db. + +### Legacy stuff + +| Alias | Command | +|---------|------------------------------------| +| `sstat` | `thin --stats "/thin/stats" start` | +| `sg` | `ruby script/generate` | +| `sd` | `ruby script/destroy` | +| `sp` | `ruby script/plugin` | +| `sr` | `ruby script/runner` | +| `ssp` | `ruby script/spec` | +| `sc` | `ruby script/console` | +| `sd` | `ruby script/server --debugger` | + -- cgit v1.2.3-70-g09d2 From 5aa62461d91546ce1fd5dcc6531569d0e6e6f17f Mon Sep 17 00:00:00 2001 From: Mert Simsek Date: Fri, 17 May 2019 15:36:20 +0300 Subject: rails: change rg alias to `rgen` (#7858) The rg alias conflicted with ripgrep. --- plugins/rails/README.md | 2 +- plugins/rails/rails.plugin.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins/rails') diff --git a/plugins/rails/README.md b/plugins/rails/README.md index 7a3db3d64..51742b2a3 100644 --- a/plugins/rails/README.md +++ b/plugins/rails/README.md @@ -18,7 +18,7 @@ plugins=(... rails) | `rcs` | `rails console --sandbox` | Test code in a sandbox, without changing any data | | `rd` | `rails destroy` | Undo a generate operation | | `rdb` | `rails dbconsole` | Interact with your db from the console | -| `rg` | `rails generate` | Generate boilerplate code | +| `rgen` | `rails generate` | Generate boilerplate code | | `rgm` | `rails generate migration` | Generate a db migration | | `rp` | `rails plugin` | Run a Rails plugin command | | `ru` | `rails runner` | Run Ruby code in the context of Rails | diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh index eb3f30360..a8ec79db2 100644 --- a/plugins/rails/rails.plugin.zsh +++ b/plugins/rails/rails.plugin.zsh @@ -43,7 +43,7 @@ alias rc='rails console' alias rcs='rails console --sandbox' alias rd='rails destroy' alias rdb='rails dbconsole' -alias rg='rails generate' +alias rgen='rails generate' alias rgm='rails generate migration' alias rp='rails plugin' alias ru='rails runner' -- cgit v1.2.3-70-g09d2 From 078f64dcf9c56f45d1d5e9e49dd5709baedc1386 Mon Sep 17 00:00:00 2001 From: Viktor Fonic Date: Thu, 13 Jun 2019 00:45:43 +0700 Subject: rails: fix typo in README (#7923) --- plugins/rails/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/rails') diff --git a/plugins/rails/README.md b/plugins/rails/README.md index 51742b2a3..5549ba18b 100644 --- a/plugins/rails/README.md +++ b/plugins/rails/README.md @@ -66,7 +66,7 @@ plugins=(... rails) | `RET` | `RAILS_ENV=test` | Sets `RAILS_ENV` to test | These are global aliases. Use in combination with a command or just run them -separately. For example: `RED rake db:migrate` will migrate the production db. +separately. For example: `REP rake db:migrate` will migrate the production db. ### Legacy stuff -- cgit v1.2.3-70-g09d2 From 74165aba4ad500e6467973c5037e1379c55e9560 Mon Sep 17 00:00:00 2001 From: Angelos Orfanakos Date: Fri, 18 Oct 2019 22:56:30 +0300 Subject: rails: detect gems.rb in _rake_command (#8223) --- plugins/rails/rails.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/rails') diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh index a8ec79db2..1fd5f0f86 100644 --- a/plugins/rails/rails.plugin.zsh +++ b/plugins/rails/rails.plugin.zsh @@ -17,7 +17,7 @@ function _rake_command () { bin/stubs/rake $@ elif [ -e "bin/rake" ]; then bin/rake $@ - elif type bundle &> /dev/null && [ -e "Gemfile" ]; then + elif type bundle &> /dev/null && ([ -e "Gemfile" ] || [ -e "gems.rb" ]); then bundle exec rake $@ else command rake $@ -- cgit v1.2.3-70-g09d2