annotate 2.6.3 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc DELETED
@@ -1,246 +0,0 @@
1
- == Annotate (aka AnnotateModels)
2
-
3
- IMPORTANT: If you're upgrading from a previous version, including 2.5.0,
4
- re-run the generator task!
5
-
6
- Add a comment summarizing the current schema to the top or bottom of each of
7
- your...
8
-
9
- - ActiveRecord models
10
- - Fixture files
11
- - Tests and Specs
12
- - Object Daddy exemplars
13
- - Machinist blueprints
14
- - Fabrication fabricators
15
- - Thoughtbot's factory_girl factories, i.e. the (spec|test)/factories/<model>_factory.rb files
16
- - routes.rb file (for Rails projects)
17
-
18
- The schema comment looks like this:
19
-
20
- # == Schema Info
21
- #
22
- # Table name: line_items
23
- #
24
- # id :integer(11) not null, primary key
25
- # quantity :integer(11) not null
26
- # product_id :integer(11) not null
27
- # unit_price :float
28
- # order_id :integer(11)
29
- #
30
-
31
- class LineItem < ActiveRecord::Base
32
- belongs_to :product
33
- . . .
34
-
35
- It also annotates geometrical columns, geom type and srid, when using
36
- +SpatialAdapter+, +PostgisAdapter+ or +PostGISAdapter+:
37
-
38
- # == Schema Info
39
- #
40
- # Table name: trips
41
- #
42
- # local :geometry point, 4326
43
- # path :geometry line_string, 4326
44
-
45
- Also, if you pass the -r option, it'll annotate routes.rb with the output of
46
- +rake routes+.
47
-
48
-
49
- == Install
50
-
51
- Into Gemfile from rubygems.org:
52
-
53
- gem 'annotate', ">=2.6.0"
54
-
55
- Into Gemfile from Github:
56
-
57
- gem 'annotate', :git => 'git://github.com/ctran/annotate_models.git'
58
-
59
- Into environment gems from rubygems.org:
60
-
61
- gem install annotate
62
-
63
- Into environment gems from Github checkout:
64
-
65
- git clone git://github.com/ctran/annotate_models.git annotate_models
66
- cd annotate_models
67
- rake build
68
- gem install pkg/annotate-*.gem
69
-
70
-
71
- == Usage
72
-
73
- (If you used the Gemfile install, prefix the below commands with +bundle exec+.)
74
-
75
- === Usage in Rails
76
-
77
- To annotate all your models, tests, fixtures, and factories:
78
-
79
- cd /path/to/app
80
- annotate
81
-
82
- To annotate just your models, tests, and factories:
83
-
84
- annotate --exclude fixtures
85
-
86
- To annotate just your models:
87
-
88
- annotate --exclude tests,fixtures,factories
89
-
90
- To annotate routes.rb:
91
-
92
- annotate --routes
93
-
94
- To remove model/test/fixture/factory annotations:
95
-
96
- annotate --delete
97
-
98
- To remove routes.rb annotations:
99
-
100
- annotate --routes --delete
101
-
102
-
103
- == Configuration
104
-
105
-
106
- === Usage Outside of Rails
107
-
108
- Everything above applies, except that +--routes+ is not meaningful, and you will
109
- probably need to explicitly set one or more +--require+ option(s), and/or one
110
- or more +--model-dir+ options to inform annotate about the structure of your
111
- project and help it bootstrap and load the relevant code.
112
-
113
-
114
-
115
- == Configuration
116
-
117
- If you want to always skip annotations on a particular model, add this string
118
- anywhere in the file:
119
-
120
- # -*- SkipSchemaAnnotations
121
-
122
- === Configuration in Rails
123
-
124
- To generate a configuration file (in the form of a +.rake+ file), to set
125
- default options:
126
-
127
- rails g annotate:install
128
-
129
- Edit this file to control things like output format, where annotations are
130
- added (top or bottom of file), and in which artifacts.
131
-
132
- == Rails Integration
133
-
134
- By default, once you've generated a configuration file, annotate will be
135
- executed whenever you run +rake db:migrate+ (but only in development mode).
136
- If you want to disable this behavior permanently, edit the +.rake+ file and
137
- change:
138
-
139
- 'skip_on_db_migrate' => "false",
140
-
141
- To:
142
-
143
- 'skip_on_db_migrate' => "true",
144
-
145
- If you want to run +rake db:migrate+ as a one-off without running annotate,
146
- you can do so with a simple environment variable, instead of editing the
147
- +.rake+ file:
148
-
149
- skip_on_db_migrate=1 rake db:migrate
150
-
151
-
152
- == Options
153
-
154
- Usage: annotate [options] [model_file]*
155
- -d, --delete Remove annotations from all model files or the routes.rb file
156
- -p, --position [before|after] Place the annotations at the top (before) or the bottom (after) of the model/test/fixture/factory/routes file(s)
157
- --pc, --position-in-class [before|after]
158
- Place the annotations at the top (before) or the bottom (after) of the model file
159
- --pf, --position-in-factory [before|after]
160
- Place the annotations at the top (before) or the bottom (after) of any factory files
161
- --px, --position-in-fixture [before|after]
162
- Place the annotations at the top (before) or the bottom (after) of any fixture files
163
- --pt, --position-in-test [before|after]
164
- Place the annotations at the top (before) or the bottom (after) of any test files
165
- --pr, --position-in-routes [before|after]
166
- Place the annotations at the top (before) or the bottom (after) of the routes.rb file
167
- -r, --routes Annotate routes.rb with the output of 'rake routes'
168
- -v, --version Show the current version of this gem
169
- -m, --show-migration Include the migration version number in the annotation
170
- -i, --show-indexes List the table's database indexes in the annotation
171
- -s, --simple-indexes Concat the column's related indexes in the annotation
172
- --model-dir dir Annotate model files stored in dir rather than app/models
173
- --ignore-model-subdirects Ignore subdirectories of the models directory
174
- --sort Sort columns alphabetically, rather than in creation order
175
- -R, --require path Additional file to require before loading models, may be used multiple times
176
- -e [tests,fixtures,factories], Do not annotate fixtures, test files, and/or factories
177
- --exclude
178
- -f [bare|rdoc|markdown], Render Schema Infomation as plain/RDoc/Markdown
179
- --format
180
- --force Force new annotations even if there are no changes.
181
- --trace If unable to annotate a file, print the full stack trace, not just the exception message.
182
-
183
-
184
- == Sorting
185
-
186
- By default, columns will be sorted in database order (i.e. the order in which
187
- migrations were run).
188
-
189
- If you prefer to sort alphabetically so that the results of
190
- annotation are consistent regardless of what order migrations are executed in,
191
- use +--sort+.
192
-
193
-
194
- == Markdown
195
-
196
- The format produced is actually MultiMarkdown, making use of the syntax
197
- extension for tables. It's recommended you use +kramdown+ as your parser if
198
- you want to use this format. If you're using +yard+ to generate documentation,
199
- specify a format of markdown with +kramdown+ as the provider by adding this to
200
- your +.yardopts+ file:
201
-
202
- --markup markdown
203
- --markup-provider kramdown
204
-
205
- Be sure to add this to your +Gemfile+ as well:
206
-
207
- gem 'kramdown', :groups => [:development], :require => false
208
-
209
-
210
- == WARNING
211
-
212
- <b>Don't add text after an automatically-created comment block.</b> This tool
213
- will blow away the initial/final comment block in your models if it looks like
214
- it was previously added by this gem.
215
-
216
- Be sure to check the changes that this tool makes! If you are using Git,
217
- you may simply check your project's status after running +annotate+:
218
-
219
- $ git status
220
-
221
- If you are not using a VCS (like Git, Subversion or similar), please tread
222
- extra carefully, and consider using one.
223
-
224
- == Links
225
-
226
- - Factory Girl: http://github.com/thoughtbot/factory_girl
227
- - Object Daddy: http://github.com/flogic/object_daddy
228
- - Machinist: http://github.com/notahat/machinist
229
- - Fabrication: http://github.com/paulelliott/fabrication
230
- - SpatialAdapter: http://github.com/pdeffendol/spatial_adapter
231
- - PostgisAdapter: http://github.com/nofxx/postgis_adapter
232
- - PostGISAdapter: https://github.com/dazuma/activerecord-postgis-adapter
233
-
234
-
235
- == License
236
-
237
- Released under the same license as Ruby. No Support. No Warranty.
238
-
239
- == Code Status
240
- {<img src="https://travis-ci.org/ctran/annotate_models.png" />}[https://travis-ci.org/ctran/annotate_models]
241
- {<img src="https://gemnasium.com/ctran/annotate_models.png" />}[https://gemnasium.com/ctran/annotate_models]
242
-
243
-
244
- == Authors
245
-
246
- {See AUTHORS.rdoc}[link:AUTHORS.rdoc].
data/TODO.rdoc DELETED
@@ -1,12 +0,0 @@
1
- == TODO
2
-
3
- - clean up history
4
- - change default position back to "top" for all annotations
5
- - add "top" and "bottom" as synonyms for "before" and "after"
6
- - change 'exclude' to 'only' (double negatives are not unconfusing)
7
-
8
- == TODO (proposed)
9
-
10
- - push two identical gems, named 'annotate' and 'annotate_models'
11
- - supply two binaries, named 'annotate' and 'annotate_models', since there's already a unix tool named 'annotate'
12
- - test EVERYTHING
@@ -1,33 +0,0 @@
1
- # These tasks are added to the project if you install annotate as a Rails plugin.
2
- # (They are not used to build annotate itself.)
3
-
4
- # Append annotations to Rake tasks for ActiveRecord, so annotate automatically gets
5
- # run after doing db:migrate.
6
- # Unfortunately it relies on ENV for options; it'd be nice to be able to set options
7
- # in a per-project config file so this task can read them.
8
- namespace :db do
9
- task :migrate do
10
- Annotate::Migration.update_annotations
11
- end
12
-
13
- namespace :migrate do
14
- [:change, :up, :down, :reset, :redo].each do |t|
15
- task t do
16
- Annotate::Migration.update_annotations
17
- end
18
- end
19
- end
20
- end
21
-
22
- module Annotate
23
- class Migration
24
- @@working = false
25
-
26
- def self.update_annotations
27
- unless @@working || (ENV['skip_on_db_migrate'] =~ /(true|t|yes|y|1)$/i)
28
- @@working = true
29
- Rake::Task['annotate_models'].invoke
30
- end
31
- end
32
- end
33
- end