|
14 | 14 | |rails-controller-navigation| Controller Navigation Commands |
15 | 15 | |rails-misc-navigation| Miscellaneous Navigation Commands |
16 | 16 | |rails-custom-navigation| Custom Navigation Commands |
| 17 | +|rails-rake| Rake |
17 | 18 | |rails-scripts| Script Wrappers |
18 | 19 | |rails-refactoring| Refactoring Helpers |
19 | 20 | |rails-partials| Partial Extraction |
@@ -62,19 +63,24 @@ Rails application development. |
62 | 63 | method names, 'completefunc' is set to enable syntax based completion on |
63 | 64 | |i_CTRL-X_CTRL-U|. |rails-syntax| |
64 | 65 |
|
65 | | -5. Interface to script/*. Generally, use ":Rscript about" to call |
| 66 | +5. Interface to rake. Use :Rake to run the current test, spec, or feature. |
| 67 | + Use :.Rake to do a focused run of just the method, example, or scenario on |
| 68 | + the current line. :Rake can also run arbitrary migrations, load individual |
| 69 | + fixtures, and more. |rails-rake| |
| 70 | + |
| 71 | +6. Interface to script/*. Generally, use ":Rscript about" to call |
66 | 72 | "script/about". Most commands have wrappers with additional features: |
67 | 73 | ":Rgenerate controller Blog" generates a blog controller and edits |
68 | 74 | app/controllers/blog_controller.rb. |rails-scripts| |
69 | 75 |
|
70 | | -6. Partial extraction and migration inversion. |:Rextract| {file} replaces |
| 76 | +7. Partial extraction and migration inversion. |:Rextract| {file} replaces |
71 | 77 | the desired range (ideally selected in visual line mode) with "render |
72 | 78 | :partial => '{file}'", which is automatically created with your content. |
73 | 79 | The @{file} instance variable is replaced with the {file} local variable. |
74 | 80 | |:Rinvert| takes a self.up migration and writes a self.down. |
75 | 81 | |rails-refactoring| |
76 | 82 |
|
77 | | -7. Integration with other plugins. |:Rtree| spawns NERDTree.vim or creates a |
| 83 | +8. Integration with other plugins. |:Rtree| spawns NERDTree.vim or creates a |
78 | 84 | new project.vim project. If dbext.vim is installed, it will be |
79 | 85 | transparently configured to reflect database.yml. Cream users get some |
80 | 86 | additional mappings, and all GUI users get a menu. |rails-integration| |
@@ -133,28 +139,6 @@ actually edit a file from a Rails application. |
133 | 139 | is active for the current buffer, also show the type |
134 | 140 | of Rails file detected. |
135 | 141 |
|
136 | | - *rails-:Rake* |
137 | | -:[range]Rake {targets} Like calling |:make| {targets} (with 'makeprg' being |
138 | | - rake). However, in some contexts, if {targets} are |
139 | | - omitted, :Rake defaults to something sensible (like |
140 | | - db:migrate in a migration, or your current test). |
141 | | - In tests (and specs), giving a line argument runs only |
142 | | - the test method (or example) at that line. Use :.Rake |
143 | | - to run the test method at the cursor position. Use |
144 | | - :.Rake inside a self.up or self.down method in a |
145 | | - migration to run the db:migrate:up or db:migrate:down |
146 | | - task for that particular migration. You can override |
147 | | - the default task with a comment like "# rake ..." |
148 | | - before the method pointed to by [range] or at the top |
149 | | - of the file. |
150 | | - |
151 | | - *rails-:Rake!* |
152 | | -:[range]Rake! {targets} Called with a bang, :Rake will use an alternate |
153 | | - 'errorformat' which attempts to parse the full stack |
154 | | - backtrace. For purely informative rake tasks (stats, |
155 | | - routes, notes, etc), the preview pane is opened with |
156 | | - the full output of the command. |
157 | | - |
158 | 142 | *rails-:Rcd* |
159 | 143 | :Rcd [{directory}] |:cd| to /path/to/railsapp/{directory}. |
160 | 144 |
|
@@ -560,6 +544,63 @@ Finally, one Vim feature that proves helpful in conjunction with all of the |
560 | 544 | above is |CTRL-^|. This keystroke edits the previous file, and is helpful to |
561 | 545 | back out of any of the above commands. |
562 | 546 |
|
| 547 | +============================================================================== |
| 548 | +RAKE *rails-rake* |
| 549 | + |
| 550 | +Rake integration happens through the :Rake command. |
| 551 | + |
| 552 | + *rails-:Rake* |
| 553 | +:[range]Rake {targets} Calls |:make!| {targets} (with 'makeprg' being rake) |
| 554 | + and opens the quickfix window if there were any |
| 555 | + errors. If {targets} are omitted, :Rake defaults to |
| 556 | + something sensible as described below. Giving a line |
| 557 | + number argument may affect that default. |
| 558 | + |
| 559 | + *rails-:Rake!* |
| 560 | +:[range]Rake! {targets} Called with a bang, :Rake will forgo opening the |
| 561 | + quickfix window. |
| 562 | + |
| 563 | + *rails-rake-defaults* |
| 564 | + |
| 565 | +Generally, the default task is one that runs the test you'd expect. For |
| 566 | +example, if you're in a view in an RSpec application, the view spec is run, |
| 567 | +but if it's a Test::Unit application, the functional test for the |
| 568 | +corresponding controller is run. The following table lists the most |
| 569 | +interesting mappings: |
| 570 | + |
| 571 | +File Task ~ |
| 572 | +unit test test:units TEST=... |
| 573 | +functional test test:functionals TEST=... |
| 574 | +integration test test:integration TEST=... |
| 575 | +spec spec SPEC=... |
| 576 | +feature cucumber FEATURE=... |
| 577 | +model test:units TEST=... spec SPEC=... |
| 578 | +controller test:functionals TEST=... spec SPEC=... |
| 579 | +helper test:functionals TEST=... spec SPEC=... |
| 580 | +view test:functionals TEST=... spec SPEC=... |
| 581 | +fixtures db:fixtures:load FIXTURES=... |
| 582 | +migration db:migrate VERSION=... |
| 583 | +config/routes.rb routes |
| 584 | +db/seeds.rb db:seed |
| 585 | + |
| 586 | +Additionally, when :Rake is given a line number (e.g., :.Rake), the following |
| 587 | +additional tasks can be invoked: |
| 588 | + |
| 589 | +File Task ~ |
| 590 | +unit test test:units TEST=... TESTOPTS=-n... |
| 591 | +functional test test:functionals TEST=... TESTOPTS=-n... |
| 592 | +integration test test:integration TEST=... TESTOPTS=-n... |
| 593 | +spec spec SPEC=... SPEC_OPTS=--line=... |
| 594 | +feature cucumber FEATURE=...:... |
| 595 | +fixtures db:fixtures:identify LABEL=... |
| 596 | +migration in self.up db:migrate:up VERSION=... |
| 597 | +migration in self.down db:migrate:down VERSION=... |
| 598 | +migration elsewhere db:migrate:redo VERSION=... |
| 599 | +task ... (try to guess currently edited declaration) |
| 600 | + |
| 601 | +Finally, you can override the default task with a comment like "# rake ..." |
| 602 | +before the method pointed to by [range] or at the top of the file. |
| 603 | + |
563 | 604 | ============================================================================== |
564 | 605 | SCRIPT WRAPPERS *rails-scripts* |
565 | 606 |
|
|
0 commit comments