From 3c11de63f5f8b6ddef75c06d6c8f4faaf8c7df07 Mon Sep 17 00:00:00 2001 From: Alex Chaffee Date: Tue, 8 Sep 2015 16:02:21 -0400 Subject: [PATCH] more documentation for auto-annotate and rake tasks the docs for auto-annotating were kind of buried inside the Rails Config section, so I extended them and added a reference to them inside the Usage section --- README.rdoc | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/README.rdoc b/README.rdoc index f2c24bad4..ac85a4b92 100755 --- a/README.rdoc +++ b/README.rdoc @@ -51,7 +51,7 @@ Also, if you pass the -r option, it'll annotate routes.rb with the output of Into Gemfile from rubygems.org: - gem 'annotate', '~> 2.6.10' + gem 'annotate' Into Gemfile from Github: @@ -100,9 +100,7 @@ To remove routes.rb annotations: annotate --routes --delete - -== Configuration - +To automatically annotate every time you run +db:migrate+, either run +rails g annotate:install+ or add +Annotate.load_tasks+ to your `Rakefile`. See the [configuration in Rails](#configuration-in-rails) section for more info. === Usage Outside of Rails @@ -112,7 +110,6 @@ or more +--model-dir+ options to inform annotate about the structure of your project and help it bootstrap and load the relevant code. - == Configuration If you want to always skip annotations on a particular model, add this string @@ -130,7 +127,13 @@ default options: Edit this file to control things like output format, where annotations are added (top or bottom of file), and in which artifacts. -== Rails Integration +The generated rakefile +lib/tasks/auto_annotate_models.rake+ also contains +`Annotate.load_tasks`. This adds a few rake tasks which duplicate command-line +functionality: + + rake annotate_models # Add schema information (as comments) to model and fixture files + rake annotate_routes # Adds the route map to routes.rb + rake remove_annotation # Remove schema information from model and fixture files By default, once you've generated a configuration file, annotate will be executed whenever you run +rake db:migrate+ (but only in development mode).