Skip to content

Commit bb0db21

Browse files
committed
General documentation cleanup.
1 parent cb50771 commit bb0db21

File tree

1 file changed

+59
-23
lines changed

1 file changed

+59
-23
lines changed

README.rdoc

Lines changed: 59 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
== Annotate (aka AnnotateModels)
22

3-
Add a comment summarizing the current schema to the top or bottom of each of your...
3+
Add a comment summarizing the current schema to the top or bottom of each of
4+
your...
45

56
- ActiveRecord models
67
- Fixture files
@@ -28,7 +29,8 @@ The schema comment looks like this:
2829
belongs_to :product
2930
. . .
3031

31-
It also annotates geometrical columns, geom type and srid, when using SpatialAdapter or PostgisAdapter:
32+
It also annotates geometrical columns, geom type and srid, when using
33+
`SpatialAdapter` or `PostgisAdapter`:
3234

3335
# == Schema Info
3436
#
@@ -37,9 +39,11 @@ It also annotates geometrical columns, geom type and srid, when using SpatialAda
3739
# local :geometry point, 4326
3840
# path :geometry line_string, 4326
3941

40-
Also, if you pass the -r option, it'll annotate routes.rb with the output of "rake routes".
42+
Also, if you pass the -r option, it'll annotate routes.rb with the output of
43+
`rake routes`.
4144

42-
== INSTALL
45+
46+
== Install
4347

4448
Into Gemfile from rubygems.org:
4549

@@ -60,7 +64,8 @@ Into environment gems from Github checkout:
6064
rake build
6165
gem install pkg/annotate-*.gem
6266

63-
== USAGE
67+
68+
== Usage
6469

6570
(If you used the Gemfile install, prefix the below commands with `bundle exec`.)
6671

@@ -69,7 +74,7 @@ To annotate all your models, tests, fixtures, and factories:
6974
cd /path/to/app
7075
annotate
7176

72-
To annotate your models, tests, and factories:
77+
To annotate just your models, tests, and factories:
7378

7479
annotate --exclude fixtures
7580

@@ -79,31 +84,54 @@ To annotate just your models:
7984

8085
To annotate routes.rb:
8186

82-
annotate -r
87+
annotate --routes
8388

8489
To remove model/test/fixture/factory annotations:
8590

86-
annotate -d
91+
annotate --delete
8792

8893
To remove routes.rb annotations:
8994

90-
annotate -r -d
91-
92-
To automatically annotate after running 'rake db:migrate', ensure you've added
93-
annotate_models to your Rails project's Gemfile, and run this:
95+
annotate --routes --delete
9496

95-
rails g annotate_models:install
9697

97-
This will produce a .rake file that will ensure annotation happens after
98-
migration (but only in development mode), and provide configuration options
99-
you can use to tailor the output.
98+
== Configuration
10099

101100
If you want to always skip annotations on a particular model, add this string
102101
anywhere in the file:
103102

104103
# -*- SkipSchemaAnnotations
105104

106-
== OPTIONS
105+
To generate a configuration file (in the form of a `.rake` file), to set
106+
default options:
107+
108+
rails g annotate:install
109+
110+
Edit this file to control things like output format, where annotations are
111+
added (top or bottom of file), and in which artifacts.
112+
113+
114+
== Rails Integration
115+
116+
By default, once you've generated a configuration file, annotate will be
117+
executed whenever you run `rake db:migrate` (but only in development mode).
118+
If you want to disable this behavior permanently, edit the `.rake` file and
119+
change:
120+
121+
'skip_on_db_migrate' => "false",
122+
123+
To:
124+
125+
'skip_on_db_migrate' => "try",
126+
127+
If you want to run `rake db:migrate` as a one-off without running annotate,
128+
you can do so with a simple environment variable, instead of editing the
129+
`.rake` file:
130+
131+
skip_on_db_migrate=1 rake db:migrate
132+
133+
134+
== Options
107135

108136
Usage: annotate [options] [model_file]*
109137
-d, --delete Remove annotations from all model files or the routes.rb file
@@ -134,12 +162,17 @@ anywhere in the file:
134162
--force Force new annotations even if there are no changes.
135163
--trace If unable to annotate a file, print the full stack trace, not just the exception message.
136164

137-
== SORTING
138165

139-
By default, columns will be sorted in database order (i.e. the order in which migrations were run).
166+
== Sorting
167+
168+
By default, columns will be sorted in database order (i.e. the order in which
169+
migrations were run).
140170

141171
If you prefer to sort alphabetically so that the results of
142-
annotation are consistent regardless of what order migrations are executed in, use --sort.
172+
annotation are consistent regardless of what order migrations are executed in,
173+
use --sort.
174+
175+
143176
== Markdown
144177

145178
The format produced is actually MultiMarkdown, making use of the syntax
@@ -164,7 +197,8 @@ to add additional text to an automatically created comment block.
164197

165198
BACK UP YOUR MODELS BEFORE USING THIS TOOL!
166199

167-
== LINKS
200+
201+
== Links
168202

169203
- Factory Girl: http://github.com/thoughtbot/factory_girl
170204
- Object Daddy: http://github.com/flogic/object_daddy
@@ -173,11 +207,13 @@ BACK UP YOUR MODELS BEFORE USING THIS TOOL!
173207
- SpatialAdapter: http://github.com/pdeffendol/spatial_adapter
174208
- PostgisAdapter: http://github.com/nofxx/postgis_adapter
175209

176-
== LICENSE:
210+
211+
== License
177212

178213
Released under the same license as Ruby. No Support. No Warranty.
179214

180-
== AUTHORS:
215+
216+
== Authors
181217

182218
- Original code by: Dave Thomas -- Pragmatic Programmers, LLC <http://agilewebdevelopment.com/plugins/annotate_models>
183219
- Overhauled by: Alex Chaffee <http://alexch.github.com> [email protected]

0 commit comments

Comments
 (0)