Skip to content

Commit 042e428

Browse files
committed
Rewrite default task documentation
1 parent 52572bf commit 042e428

File tree

1 file changed

+50
-56
lines changed

1 file changed

+50
-56
lines changed

doc/rails.txt

Lines changed: 50 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Author: Tim Pope <http://tpo.pe/>
88
|rails-alternate-related| Alternate and Related Files
99
|rails-type-navigation| File Type Commands
1010
|rails-exec| Executable Wrappers
11-
|rails-rake| Rake
1211
|rails-refactoring| Refactoring Helpers
1312
|rails-partials| Partial Extraction
1413
|rails-migrations| Migration Inversion
@@ -290,8 +289,9 @@ back out of any of the above commands.
290289

291290
EXECUTABLE WRAPPERS *rails-exec*
292291

293-
The following commands are wrappers around the `rails` executable and
294-
subcommands.
292+
Several commands are provided that wrap the `rails` and `rake` executables.
293+
Additionally, `rake` can be invoked directly with |:make| (or dispatch.vim's
294+
|:Make|).
295295

296296
*rails-:Rails*
297297
:Rails {command} [options]
@@ -300,10 +300,11 @@ subcommands.
300300
"script/{command}". Unless the command is "console",
301301
"dbconsole", or "server", the results are loaded into
302302
the quickfix list using the "rails" |:compiler|
303-
included with the plugin. With no command, runs the
304-
default rake task. See |rails-default-task|. Unlike
305-
other commands, :Rails is available globally, for use
306-
with the "new" subcommand.
303+
included with the plugin. With no command, runs a
304+
default task based on the current file (see
305+
|rails-default-task|). Unlike other commands, :Rails
306+
is available globally, for use with the "new"
307+
subcommand.
307308

308309
*rails-:Rscript*
309310
:Rscript {command} [options]
@@ -318,7 +319,7 @@ subcommands.
318319
*rails-:Generate* *rails-:Rgenerate*
319320
:Generate {options} Invoke rails generate {options} and loads the
320321
generated files into the quickfix list. Use ! to
321-
surpress jumping to the first file.
322+
suppress jumping to the first file.
322323

323324
*rails-:Destroy* *rails-:Rdestroy*
324325
:Destroy {options} Invoke rails destroy {options} and loads the destroyed
@@ -351,10 +352,6 @@ subcommands.
351352
*rails-:Rpp*
352353
:[range]Rpp {code} Like :Rp, but with pp (pretty print).
353354

354-
RAKE *rails-rake*
355-
356-
Rake integration happens through the :Rake command.
357-
358355
*rails-:Rake*
359356
:[range]Rake {targets} Calls |:make!| {targets} (with 'makeprg' being rake)
360357
and opens the quickfix window if there were any
@@ -370,45 +367,41 @@ Rake integration happens through the :Rake command.
370367
*rails-default-task*
371368

372369
Invoking |rails-:Rails| or |rails-:Rake| with no arguments runs a default
373-
task. Generally, the default task is one that runs the test you'd expect.
374-
For example, if you're in a view in an RSpec application, the view spec is
375-
run, but if it's a Test::Unit application, the functional test for the
376-
corresponding controller is run. The following table lists the most
377-
interesting mappings:
378-
379-
File Task ~
380-
unit test test:units TEST=...
381-
functional test test:functionals TEST=...
382-
integration test test:integration TEST=...
383-
spec spec SPEC=...
384-
feature cucumber FEATURE=...
385-
model test:units TEST=... spec SPEC=...
386-
controller test:functionals TEST=... spec SPEC=...
387-
helper test:functionals TEST=... spec SPEC=...
388-
view test:functionals TEST=... spec SPEC=...
389-
fixtures db:fixtures:load FIXTURES=...
390-
migration db:migrate:redo VERSION=...
391-
config/routes.rb routes
392-
db/schema.rb db:migrate:status
393-
db/seeds.rb db:seed
394-
README about
395-
396-
Additionally, when :Rails or :Rake is given a line number (e.g., :.Rake), the
397-
following additional tasks can be invoked:
398-
399-
File Task ~
400-
unit test test:units TEST=... TESTOPTS=-n...
401-
functional test test:functionals TEST=... TESTOPTS=-n...
402-
integration test test:integration TEST=... TESTOPTS=-n...
403-
spec spec SPEC=...:...
404-
feature cucumber FEATURE=...:...
405-
controller routes CONTROLLER=...
406-
fixtures db:fixtures:identify LABEL=...
407-
migration db:migrate:down VERSION=...
408-
task ... (try to guess currently edited declaration)
409-
410-
Finally, you can override the default task with a comment like "# rake ..."
411-
before the method pointed to by [range] or at the top of the file.
370+
task. This is typically the associated test task, but can also be a closely
371+
related utility task.
372+
373+
File Task ~
374+
test/*_test.rb test TEST=test/*_test.rb
375+
spec/*_spec.rb spec SPEC=spec/*_spec.rb
376+
features/*.feature cucumber FEATURE=features/*.feature
377+
app/*.rb test TEST=... | spec SPEC=...
378+
test/fixtures/*.yml db:fixtures:load FIXTURES=*
379+
config.ru middleware
380+
config/routes.rb routes
381+
db/migrate/*_*.rb db:migrate:redo VERSION=*
382+
db/schema.rb db:migrate:status
383+
db/seeds.rb db:seed
384+
README about
385+
386+
For some files, giving the command a range (e.g., :.Rails) triggers a variant
387+
of the task to be performed.
388+
389+
File Task when given range ~
390+
test/*_test.rb test TEST=test/*_test.rb TESTOPTS=-n<method>
391+
spec/*_spec.rb spec SPEC=spec/*_spec.rb:<line>
392+
features/*.feature cucumber FEATURE=features/*.feature:<line>
393+
app/controllers/*_controller.rb routes CONTROLLER=*
394+
test/fixtures/*.yml db:fixtures:identify LABEL=<label>
395+
db/migrate/*_*.rb db:migrate:down VERSION=*
396+
lib/tasks/*.rake <try to guess currently edited task>
397+
398+
You can override the default task with a comment like "# rails <task>" either
399+
at the top of the file or before the method referenced by the given line
400+
number.
401+
402+
If dispatch.vim is installed, you can also run the default task by calling
403+
|:Dispatch| with no arguments. Use :.FocusDispatch and :0FocusDispatch to see
404+
the default task with and without a range given.
412405

413406
REFACTORING HELPERS *rails-refactoring*
414407

@@ -480,7 +473,7 @@ MISCELLANEOUS COMMANDS *rails-misc*
480473
last line. |R| is remapped to reload the list, and
481474
|G| remapped to do the same before it's usual behavior
482475
of jumping to the last line. If the delay in loading
483-
is too long, you might consider :Rake log:clear.
476+
is too long, you might consider :Rails log:clear.
484477

485478
*rails-:Rlog*
486479
:Rlog [environment] Open the log file in the preview window using
@@ -589,7 +582,7 @@ The presence of a spec directory causes several additional behaviors to
589582
activate. :A knows about specs and will jump to them (but Test::Unit files
590583
still get priority). The associated controller or model of a spec is
591584
detected, so all navigation commands should work as expected inside a spec
592-
file. :Rake in a spec runs just that spec, and in a model, controller, or
585+
file. :Rails in a spec runs just that spec, and in a model, controller, or
593586
helper, runs the associated spec.
594587

595588
|:Eunittest| and |:Efunctionaltest| lead double lives, handling model/helper
@@ -759,8 +752,9 @@ The full list of available options is as follows:
759752
current 'define' match (typically a method).
760753
*rails-projection-test*
761754
"test" ~
762-
Determines the default test file to run with |rails-:Runner| and
763-
|rails-:Rake|. Also serves as a default for "alternate".
755+
Determines the default test file to run with |rails-:Runner|,
756+
|rails-:Rails|, and |rails-:Rake|. Also serves as a default for
757+
"alternate".
764758
*rails-projection-task*
765759
"task" ~
766760
Determines the default rake task to run. Provide {lnum} or {define}
@@ -813,7 +807,7 @@ If you would like to set your own custom Vim settings whenever a Rails file is
813807
loaded, you can use an autocommand like the following in your vimrc: >
814808
815809
autocmd User Rails silent! Lcd
816-
autocmd User Rails map <buffer> <F9> :Rake<CR>
810+
autocmd User Rails map <buffer> <F9> :Rails<CR>
817811
818812
There used to be autocommands that fire based on the "type" or file name of
819813
the buffer, but they have been removed. If you still need to execute code for

0 commit comments

Comments
 (0)