annotate 3.0.3 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 559a54cd715c8d97ed5eea63d85822d2a4f8ceef35c34256fac6243a6bd7c01c
4
- data.tar.gz: 9378a8a21e2eba4bccf5f7b77eedf894d4b569121da31f05670aafee6dbd09fc
3
+ metadata.gz: ff5fdb0f67e1790c14efff769d33ea5bd83e0120a2aa90ed3c738d04a8247266
4
+ data.tar.gz: 07d173cb24fe0476aba4152feb618c29a303705e882301718177ed7ad34501e4
5
5
  SHA512:
6
- metadata.gz: fefbdc4b01c33e20c403186b54b5a550515e110ffe33848a8f112ec402d2bee40c7946205a401e5b974ebda361216ec22faef62b8eaec98d4fc12827620bfbc4
7
- data.tar.gz: 0fd4cb8eb60753311f0b33b845fefa14534c3791cb7047b04e493210b159cf8a091c0d9bc87c9580f7fa7c71ed2df738556d2f4701c0e54cc1f660e70150b552
6
+ metadata.gz: 8c2e1d4d012e7d65b1282bc8497db61d9d95bdfa1ea1709d362d3b1c35609d659183f58a42ae3e48833a6be9519daf09e2b538b06b7ccf1706d2c963c4301027
7
+ data.tar.gz: 8ac9930d48f5ed72d1f6b453956882c637360323b31bc465d0ff3803f015c1adc93275c0a4eb46d29431588bc1b8110e8a5408f81d417e0b65d5132e318c25a4
@@ -1,4 +1,4 @@
1
- == Authors
1
+ ## Authors
2
2
 
3
3
  - Original code by: Dave Thomas -- Pragmatic Programmers, LLC <http://agilewebdevelopment.com/plugins/annotate_models>
4
4
  - Overhauled by: Alex Chaffee <http://alexch.github.com> alex@stinky.com
@@ -6,7 +6,7 @@
6
6
  - Maintained by: Alex Chaffee and Cuong Tran
7
7
  - Homepage: http://github.com/ctran/annotate_models
8
8
 
9
- With help from:
9
+ ### With help from:
10
10
 
11
11
  - Jack Danger - http://github.com/JackDanger
12
12
  - Michael Bumann - http://github.com/bumi
@@ -0,0 +1,312 @@
1
+ ## 3.1.0
2
+ Changes
3
+ - Fix new lines after comments for rubocop compatibility [#757](https://github.com/ctran/annotate_models/pull/757)
4
+ - Fix messages from AnnotateRoutes [#737](https://github.com/ctran/annotate_models/pull/737)
5
+ - Support YARD notation [#724](https://github.com/ctran/annotate_models/pull/724)
6
+ - Refactor AnnotateRoutes.routes_file_exist? [#716](https://github.com/ctran/annotate_models/pull/716)
7
+ - Refactor namespace Annotate [#719](https://github.com/ctran/annotate_models/pull/719)
8
+ - Add columns managed by Globalize gem [#602](https://github.com/ctran/annotate_models/pull/602)
9
+
10
+ Bug Fixes
11
+ - Fix additional_file_patterns parsing [#756](https://github.com/ctran/annotate_models/pull/756)
12
+ - Fix typo in README [#752](https://github.com/ctran/annotate_models/pull/752)
13
+ - Fix bin/annotate NoMethodError [#745](https://github.com/ctran/annotate_models/pull/745)
14
+ - Fix README for YARD format [#740](https://github.com/ctran/annotate_models/pull/740)
15
+ - Fix constant names that were not renamed in #721 [#739](https://github.com/ctran/annotate_models/pull/739)
16
+ - Replace soft-deprecated constant `HashWithIndifferentAccess` to `ActiveSupport::HashWithIndifferentAccess` [#699](https://github.com/ctran/annotate_models/pull/699)
17
+ - [Fix #570](https://github.com/ctran/annotate_models/issues/570) Change of foreign key should be considered as a column change
18
+ - [Fix #430](https://github.com/ctran/annotate_models/issues/430) Handle columns from activerecord-postgis-adapter [#694](https://github.com/ctran/annotate_models/pull/694)
19
+ - Add ActiveAdmin option to template [#693](https://github.com/ctran/annotate_models/pull/693)
20
+ - Fix foreign key issue with Rails 6 and Sqlite3 [#695](https://github.com/ctran/annotate_models/pull/695)
21
+ - Fix Serializers Test Directory [#625](https://github.com/ctran/annotate_models/pull/625)
22
+ - [Fix #624](https://github.com/ctran/annotate_models/issues/624) Correct default values for columns when ActiveRecord::Enum is used [#677](https://github.com/ctran/annotate_models/pull/677)
23
+ - [Fix #675](https://github.com/ctran/annotate_models/issues/675) Correct indentation for double-byte characters [#676](https://github.com/ctran/annotate_models/pull/676)
24
+ - FIX: Ensure only one line is around the annotation [#669](https://github.com/ctran/annotate_models/pull/669)
25
+ - Fix shifted when format_markdown option enabled and used non-ascii [#650](https://github.com/ctran/annotate_models/pull/650)
26
+
27
+ Project improvements
28
+ - Refactor RSpec for AnnotateModels - structuralize test cases [#755](https://github.com/ctran/annotate_models/pull/755)
29
+ - Refactor test cases of AnnotateRoutes as for Rake versions [#754](https://github.com/ctran/annotate_models/pull/754)
30
+ - Add integration tests to project [#747](https://github.com/ctran/annotate_models/pull/747)
31
+ - Refactor test cases for AnnotateRoutes.remove_annotations [#748](https://github.com/ctran/annotate_models/pull/748)
32
+ - Refactor RSpec for AnnotateModels - with Globalize gem [#749](https://github.com/ctran/annotate_models/pull/749)
33
+ - Fixed CHANGELOG.md to add link to each PR [#751](https://github.com/ctran/annotate_models/pull/751)
34
+ - Delete integration test fixtures [#746](https://github.com/ctran/annotate_models/pull/746)
35
+ - Remove remaining integration test files [#744](https://github.com/ctran/annotate_models/pull/744)
36
+ - Remove unworking integration tests [#725](https://github.com/ctran/annotate_models/pull/725)
37
+ - Refactor Annotate::Parser [#742](https://github.com/ctran/annotate_models/pull/742)
38
+ - Refactor RSpec for AnnotateModels (4) - AnnotateModels.get_schema_info (without custom options) [#735](https://github.com/ctran/annotate_models/pull/735)
39
+ - Refactor RSpec for AnnotateRoutes (1) [#736](https://github.com/ctran/annotate_models/pull/736)
40
+ - Refactor AnnotateRoutes.rewrite_contents [#734](https://github.com/ctran/annotate_models/pull/734)
41
+ - AnnotateModels.get_schema_info (with custom options) [#732](https://github.com/ctran/annotate_models/pull/732)
42
+ - Fix typo in RSpec of AnnotateModels [#731](https://github.com/ctran/annotate_models/pull/731)
43
+ - Remove AnnotateRoutes.rewrite_contents_with_header [#730](https://github.com/ctran/annotate_models/pull/730)
44
+ - Refactor AnnotateRoutes.annotate_routes and .rewrite_contents_with_header [#729](https://github.com/ctran/annotate_models/pull/729)
45
+ - Refactor AnnotateModels::Parser [#728](https://github.com/ctran/annotate_models/pull/728)
46
+ - Remove invalid document of AnnotateRoutes.rewrite_contents [#727](https://github.com/ctran/annotate_models/pull/727)
47
+ - Refactor RSpec for AnnotateModels (1) [#726](https://github.com/ctran/annotate_models/pull/726)
48
+ - Refactor AnnotateModels::Helpers [#723](https://github.com/ctran/annotate_models/pull/723)
49
+ - Refactor AnnotateRoutes.remove_annotations [#715](https://github.com/ctran/annotate_models/pull/715)
50
+ - Fix AnnotateRoutes.extract_magic_comments_from_array [#712](https://github.com/ctran/annotate_models/pull/712)
51
+ - Rename FactoryGirl to FactoryBot [#721](https://github.com/ctran/annotate_models/pull/721)
52
+ - Refactor AnnotateRoutes.header [#714](https://github.com/ctran/annotate_models/pull/714)
53
+ - Freeze constant AnnotateRoutes::HEADER_ROW [#713](https://github.com/ctran/annotate_models/pull/713)
54
+ - Add constants MAGIC_COMMENT_MATCHER [#711](https://github.com/ctran/annotate_models/pull/711)
55
+ - Rename method and variable of AnnotateRoutes for readability [#709](https://github.com/ctran/annotate_models/pull/709)
56
+ - Refactor lib/annotate.rb [#707](https://github.com/ctran/annotate_models/pull/707)
57
+ - Delete TODO.md [#700](https://github.com/ctran/annotate_models/pull/700)
58
+ - Tidy README [#701](https://github.com/ctran/annotate_models/pull/701)
59
+ - Convert documentation files to Markdown [#697](https://github.com/ctran/annotate_models/pull/697)
60
+ - Upgrade and fix CI [#698](https://github.com/ctran/annotate_models/pull/698)
61
+ - Add upgrade instructions to README [#687](https://github.com/ctran/annotate_models/pull/687)
62
+ - Fix Github release action [#682](https://github.com/ctran/annotate_models/pull/682)
63
+
64
+ ## 3.0.3
65
+ - Use a less error-prone way of specifying gem files [#662](https://github.com/ctran/annotate_models/pull/662)
66
+ - Update rake requirement from `>= 10.4, < 13.0` to `>= 10.4, < 14.0` [#659](https://github.com/ctran/annotate_models/pull/659)
67
+ - Bump nokogiri from 1.6.6.2 to 1.10.4 in /spec/integration/rails_4.2.0 [#655](https://github.com/ctran/annotate_models/pull/655)
68
+ - Default annotate models to true in config generated by `rails g annotate:install` [#671](https://github.com/ctran/annotate_models/pull/671)
69
+ - Bump loofah from 2.3.0 to 2.3.1 in /spec/integration/rails_4.2.0 [#681](https://github.com/ctran/annotate_models/pull/681)
70
+
71
+ ## 3.0.2
72
+ - Fixes `LoadError` due to gemspec not referencing `parser.rb`, issue [#657](https://github.com/ctran/annotate_models/issues/657) [#660](https://github.com/ctran/annotate_models/pull/660)
73
+ - Changes `--additional_file_patterns` to use dashes `--additional-file-patterns` for consistency [#649](https://github.com/ctran/annotate_models/pull/649)
74
+ - Refactor: moving constants into `constants.rb` [#653](https://github.com/ctran/annotate_models/pull/653)
75
+
76
+ ## 3.0.1
77
+ - Skipped as an official release, used the 3.0.1 patch for setting up Github Actions [#619](https://github.com/ctran/annotate_models/pull/619)
78
+
79
+ ## 3.0.0
80
+ - **Breaking:** when option `models` is not set - models will not be annotated by default.
81
+
82
+ Add `'models'=>'true'` to your config manually or use `--models` option if using CLI.
83
+
84
+ - Added `--models` CLI option fixing issue [#563](https://github.com/ctran/annotate_models/issues/563) [#647](https://github.com/ctran/annotate_models/pull/647)
85
+ - Added `--additional_file_patterns` option for additional file patterns [#633](https://github.com/ctran/annotate_models/pull/633) [#636](https://github.com/ctran/annotate_models/pull/636) [#637](https://github.com/ctran/annotate_models/pull/637)
86
+ - Refactored CLI parser [#646](https://github.com/ctran/annotate_models/pull/646)
87
+ - Fixed `BigDecimal.new` deprecation warning [#634](https://github.com/ctran/annotate_models/pull/634)
88
+ - Fixed annotations for columns with long data types [#622](https://github.com/ctran/annotate_models/pull/622)
89
+ - Made methods private in AnnotateRoutes [#598](https://github.com/ctran/annotate_models/pull/598)
90
+
91
+ See https://github.com/ctran/annotate_models/releases/tag/v3.0.0
92
+
93
+ ## 2.7.5
94
+ See https://github.com/ctran/annotate_models/releases/tag/v2.7.5
95
+
96
+ ## 2.7.3
97
+ See https://github.com/ctran/annotate_models/releases/tag/v2.7.3
98
+
99
+ ## 2.7.2
100
+ See https://github.com/ctran/annotate_models/releases/tag/v2.7.2
101
+
102
+ ## 2.7.1
103
+ See https://github.com/ctran/annotate_models/releases/tag/v2.7.1
104
+
105
+ ## 2.7.0
106
+ See https://github.com/ctran/annotate_models/releases/tag/v2.7.0
107
+
108
+ ## 2.6.9
109
+ - Support foreigh key [#241](https://github.com/ctran/annotate_models/pull/241)
110
+ - Check if model has skip tag in annotate_model_file [#167](https://github.com/ctran/annotate_models/pull/167)
111
+ - Fix issue where serializer-related flags weren't being honored [#246](https://github.com/ctran/annotate_models/issues/246)
112
+ - Prefer SQL column type over normalized AR type [#231](https://github.com/ctran/annotate_models/issues/231)
113
+
114
+ ## 2.6.8
115
+ - Nothing annotated unless `options[:model_dir]` is specified, [#234](https://github.com/ctran/annotate_models/pull/234)
116
+
117
+ ## 2.6.7
118
+ - Nothing annotated unless `options[:model_dir]` is specified, [#234](https://github.com/ctran/annotate_models/pull/234)
119
+
120
+ ## 2.6.6
121
+ - Makes it possible to wrap annotations, [#225](https://github.com/ctran/annotate_models/pull/225)
122
+ - Fix single model generation, [#214](https://github.com/ctran/annotate_models/pull/214)
123
+ - Fix default value for Rails 4.2, [#212](https://github.com/ctran/annotate_models/issues/212)
124
+ - Don't crash on inherited models in subdirectories, [#232](https://github.com/ctran/annotate_models/issues/232)
125
+ - Process model_dir in rake task, [#197](https://github.com/ctran/annotate_models/pull/197)
126
+
127
+ ## 2.6.4
128
+ - Skip "models/concerns", [#194](https://github.com/ctran/annotate_models/pull/194)
129
+ - Fix [#173](https://github.com/ctran/annotate_models/issues/173) where annotate says "Nothing to annotate" in rails 4.2
130
+ - Display an error message if not run from the root of the project, [#186](https://github.com/ctran/annotate_models/pull/186)
131
+ - Support rails 4.0 new default test directory, [#182](https://github.com/ctran/annotate_models/issues/182)
132
+ - Add an option to show timestamp in routes "-timestamp", [#136](https://github.com/ctran/annotate_models/issues/136)
133
+ - Skip plain ruby objects if they have the same class name as an ActiveRecord object, [#121](https://github.com/ctran/annotate_models/issues/121)
134
+
135
+ ## 2.6.3
136
+ - Fix bug of annotate position in routes [#158](https://github.com/ctran/annotate_models/issues/158)
137
+
138
+ ## 2.6.2
139
+ - Retain the current annotate block unless --force is specified
140
+ - Always load models, since they may not be autoloaded by Rails
141
+ - The pg array type is now detected (see [#158](https://github.com/ctran/annotate_models/pull/158))
142
+
143
+ ## 2.6.0.beta2
144
+ - support for composite_primary_keys (garysweaver)
145
+ - bug fix for annotate_one_file (vlado)
146
+
147
+
148
+ ## 2.6.0.beta1
149
+
150
+ - It's now possible to use Annotate in standalone ActiveRecord (non-Rails) projects again.
151
+ - Adding note that Markdown is actually MultiMarkdown, and recommending the use
152
+ of the `kramdown` engine for parsing it.
153
+ - Improved Markdown formatting considerably.
154
+ - Bugfix: Needed to use inline-code tag for column and table names,
155
+ otherwise underscores would cause havok with the formatting.
156
+ - Bugfix: Markdown syntax was incorrect
157
+ (can't have trailing spaces before the closing marker for an emphasis tag).
158
+ - Bugfix: Remove-annotations wasn't properly finding test/spec files,
159
+ and wasn't even looking for FactoryGirl factories under the new naming convention.
160
+ - Bugfix: Load the Rakefile from the current directory, not the first
161
+ Rakefile in our load path.
162
+ - Added support for new FactoryGirl naming convention.
163
+ - Fix behavior of route annotations in newer versions of Rake that don't
164
+ spit out the CWD as their first line of output.
165
+ - Overhauled integration testing system to be much easier to work with,
166
+ better compartmentalized, and so forth -- at the cost that you must be
167
+ using RVM to utilize it. (It'll spit out appropriate pending messages if
168
+ you don't.) Also includes a mode for "tinkering" by hand with a scenario,
169
+ and won't let you run it through rspect if the repo is in a dirty state.
170
+ Added appropriate rake tasks to help with all of this.
171
+ - Routes can now be appended, pre-pended, or removed -- and do sane things in all cases.
172
+ - Expose all `position_*` variables as CLI params.
173
+ - Make `ENV ['position']` work as a default for all the `ENV ['position_*']` variables.
174
+ - Make rake tasks more resilient to unusual circumstances / code loading behavior.
175
+ - Resolve annotate vs. annotate_models ambiguity once and for all by
176
+ settling on `annotate_models` *and* `annotate_routes`. This avoids a name
177
+ collision with RMagick while not needlessly overloading the term.
178
+ - Fixed that schema kept prepending additional newlines
179
+ - Updates to make annotate smarter about when to touch a model
180
+ - Recognize column+type, and don't change a file unless the column+type
181
+ combination of the new schema are different than that of the old (i.e.,
182
+ don't regenerate if columns happen to be in a different order. That's just
183
+ how life is sometimes)
184
+ - Change annotate to use options hash instead of ENV.
185
+
186
+
187
+ ## 2.5.0
188
+
189
+ - Works better with Rails 3
190
+ - Bugfix: schema kept prepending additional newlines
191
+ - Updates to make annotate smarter about when to touch a model
192
+ - Recognize column+type, and don't change a file unless the column+type
193
+ combination of the new schema are different than that of the old (i.e.,
194
+ don't regenerate if columns happen to be in a different order. That's just
195
+ how life is sometimes.)
196
+ - Grab old specification even if it has `\r\n` as line endings rather than pure `\n`s
197
+ - Various warning and specification fixes
198
+ - Fix "no such file to load -- annotate/annotate_models (MissingSourceFile)"
199
+ error (require statements in tasks now use full path to lib files)
200
+ - warn about macros, to mitigate when we're included during a production
201
+ run, not just a rakefile run -- possibly at the expense of too much noise
202
+ - Adding rake as a runtime dependency
203
+ - If the schema is already in the model file, it will be replaced into the same location.
204
+ If it didn't previously exist, it'll be placed according to the "position", as before.
205
+ - Allow task loading from Rakefile for gems (plugin installation already auto-detects).
206
+ - Add skip_on_db_migrate option as well for people that don't want it
207
+ - Fix options parsing to convert strings to proper booleans
208
+ - Add support for Fabrication fabricators
209
+ - Leave magic encoding comment intact
210
+ - Fix issue #14 - RuntimeError: Already memoized
211
+ - Count a model as 'annotated' if any of its tests/fixtures are annotated
212
+ - Support FactoryGirl
213
+ - Support :change migrations (Rails 3.1)
214
+ - Allow models with non-standard capitalization
215
+ - Widen type column so we can handle longtexts with chopping things off.
216
+ - Skip trying to get list of models from commandline when running via Rake
217
+ (was preventing the use of multiple rake tasks in one command if one of them was `db:migrate`).
218
+ - Add ability to skip annotations for a model by adding
219
+ `# -*- SkipSchemaAnnotations` anywhere in the file.
220
+ - Don't show column limits for integer and boolean types.
221
+ - Add sorting for columns and indexes.
222
+ (Helpful for out-of-order migration execution. Use `--sort` if you want this.)
223
+ - Annotate unit tests in subfolders.
224
+ - Add generator to install rakefile that automatically annotates on `db:migrate`.
225
+ - Correct Gemfile to clarify which environments need which gems.
226
+ - Add an .rvmrc to facilitate clean development.
227
+ - Refactor out ActiveRecord monkey-patch to permit extending without side-effects.
228
+ - Use ObjectSpace to locate models to facilitate handling of models with
229
+ non-standard capitalization.
230
+ Note that this still requires that the inflector be configured to understand
231
+ the special case.
232
+ - Shore up test cases a bit.
233
+ - Merge against many of the older branches on Github whose functionality is
234
+ already reflected to reduce confusion about what is and is not implemented here.
235
+ - Accept String or Symbol for :position (et al) options.
236
+ - Add RDoc output formatting as an option.
237
+ - Add Markdown output formatting as an option.
238
+ - Add option to force annotation regeneration.
239
+ - Add new configuration option for controlling where info is placed in
240
+ fixtures/factories.
241
+ - Fix for models without tables.
242
+ - Fix gemspec generation now that Jeweler looks at Gemfile.
243
+ - Fix warning: `NOTE: Gem::Specification#default_executable= is deprecated
244
+ with no replacement. It will be removed on or after 2011-10-01.`
245
+ - Fix handling of files with no trailing newline when putting annotations at
246
+ the end of the file.
247
+ - Now works on tables with no primary key.
248
+ - `--format=markdown` option
249
+ - `--trace` option to help debug "Unable to annotate" errors
250
+ - "Table name" annotation (if table name is different from model name)
251
+ - "Human name" annotation (enabling translation to non-English locales)
252
+ - Fix JRuby ObjectSpace compatibility bug (https://github.com/ctran/annotate_models/pull/85)
253
+ - Fix FactoryGirl compatibility bug (https://github.com/ctran/annotate_models/pull/82)
254
+
255
+
256
+ ## 2.4.2 2009-11-21
257
+ - Annotates `(spec|test)/factories/<model>_factory.rb` files
258
+
259
+ ## 2.4.1 2009-11-20
260
+
261
+ - Annotates thoughtbot's factory_girl factories (`test/factories/<model>_factory.rb`)
262
+ - Move default annotation position back to top
263
+
264
+
265
+ ## 2.4.0 2009-12-13
266
+ - Incorporated lots of patches from the Github community,
267
+ including support for Blueprints fixtures
268
+ - Several bug fixes
269
+
270
+ ## 2.1 2009-10-18
271
+
272
+ - New options
273
+ - `-R` to require additional files before loading the models
274
+ - `-i` to show database indexes in annotations
275
+ - `-e` to exclude annotating tests or fixtures
276
+ - `-m` to include the migration version number in the annotation
277
+ - `--model-dir` to annotate model files stored a different place than `app/models`
278
+
279
+ - Ignore unknown macros ('acts_as_whatever')
280
+
281
+
282
+ ## 2.0 2009-02-03
283
+
284
+ - Add annotate_models plugin fork additions
285
+ - Annotates Rspec and Test Unit models
286
+ - Annotates Object Daddy exemplars
287
+ - Annotates geometrical columns
288
+
289
+ - Add AnnotateRoutes rake task
290
+ - Up gem structure to newgem defaults
291
+
292
+
293
+ ## 1.0.4 2008-09-04
294
+
295
+ - Only update modified models since last run, thanks to sant0sk1
296
+
297
+ ## 1.0.3 2008-05-02
298
+
299
+ - Add misc changes from Dustin Sallings and Henrik N
300
+ - Remove trailing whitespace
301
+ - More intuitive info messages
302
+ - Update README file with update-to-date example
303
+
304
+ ## 1.0.2 2008-03-22
305
+
306
+ - Add contributions from Michael Bumann (http://github.com/bumi)
307
+ - added an option "position" to choose to put the annotation,
308
+ - spec/fixtures now also get annotated
309
+ - added a task to remove the annotations
310
+ - these options can be specified from command line as `-d` and `-p [before|after]`
311
+
312
+
@@ -1,15 +1,14 @@
1
- == Annotate (aka AnnotateModels)
1
+ ## Annotate (aka AnnotateModels)
2
2
 
3
- {<img src="https://badge.fury.io/rb/annotate.svg" alt="Gem Version" />}[http://badge.fury.io/rb/annotate]
4
- {<img src="https://img.shields.io/gem/dt/annotate.svg?style=flat" />}[https://rubygems.org/gems/annotate]
5
- {<img src="https://travis-ci.org/ctran/annotate_models.svg?branch=develop" />}[https://travis-ci.org/ctran/annotate_models]
6
- {<img src="https://github.com/ctran/annotate_models/workflows/CI/badge.svg" />}[https://github.com/ctran/annotate_models/actions?workflow=CI]
7
- {<img src="https://coveralls.io/repos/ctran/annotate_models/badge.svg?branch=develop" />}[https://coveralls.io/r/ctran/annotate_models?branch=develop]
8
- {<img src="https://codeclimate.com/github/ctran/annotate_models/badges/gpa.svg" />}[https://codeclimate.com/github/ctran/annotate_models]
9
- {<img src="http://inch-ci.org/github/ctran/annotate_models.svg?branch=develop" alt="Inline docs" />}[http://inch-ci.org/github/ctran/annotate_models]
3
+ [![Gem Version](https://badge.fury.io/rb/annotate.svg)](http://badge.fury.io/rb/annotate)
4
+ [![Downloads count](https://img.shields.io/gem/dt/annotate.svg?style=flat)](https://rubygems.org/gems/annotate)
5
+ [![Build status](https://travis-ci.org/ctran/annotate_models.svg?branch=develop)](https://travis-ci.org/ctran/annotate_models)
6
+ [![CI Status](https://github.com/ctran/annotate_models/workflows/CI/badge.svg)](https://github.com/ctran/annotate_models/actions?workflow=CI)
7
+ [![Coveralls](https://coveralls.io/repos/ctran/annotate_models/badge.svg?branch=develop)](https://coveralls.io/r/ctran/annotate_models?branch=develop)
8
+ [![Maintenability](https://codeclimate.com/github/ctran/annotate_models/badges/gpa.svg)](https://codeclimate.com/github/ctran/annotate_models)
9
+ [![Inline docs](http://inch-ci.org/github/ctran/annotate_models.svg?branch=develop)](http://inch-ci.org/github/ctran/annotate_models)
10
10
 
11
- Add a comment summarizing the current schema to the top or bottom of each of
12
- your...
11
+ Add a comment summarizing the current schema to the top or bottom of each of your...
13
12
 
14
13
  - ActiveRecord models
15
14
  - Fixture files
@@ -17,53 +16,85 @@ your...
17
16
  - Object Daddy exemplars
18
17
  - Machinist blueprints
19
18
  - Fabrication fabricators
20
- - Thoughtbot's factory_bot factories, i.e. the (spec|test)/factories/<model>_factory.rb files
21
- - routes.rb file (for Rails projects)
19
+ - Thoughtbot's factory_bot factories, i.e. the `(spec|test)/factories/<model>_factory.rb` files
20
+ - `routes.rb` file (for Rails projects)
21
+
22
22
 
23
23
  The schema comment looks like this:
24
24
 
25
- # == Schema Info
26
- #
27
- # Table name: line_items
28
- #
29
- # id :integer(11) not null, primary key
30
- # quantity :integer(11) not null
31
- # product_id :integer(11) not null
32
- # unit_price :float
33
- # order_id :integer(11)
34
- #
25
+ ```ruby
26
+ # == Schema Info
27
+ #
28
+ # Table name: line_items
29
+ #
30
+ # id :integer(11) not null, primary key
31
+ # quantity :integer(11) not null
32
+ # product_id :integer(11) not null
33
+ # unit_price :float
34
+ # order_id :integer(11)
35
+ #
36
+
37
+ class LineItem < ActiveRecord::Base
38
+ belongs_to :product
39
+ . . .
40
+ ```
41
+
42
+ It also annotates geometrical columns, `geom` type and `srid`,
43
+ when using `SpatialAdapter`, `PostgisAdapter` or `PostGISAdapter`:
44
+
45
+ ```ruby
46
+ # == Schema Info
47
+ #
48
+ # Table name: trips
49
+ #
50
+ # local :geometry point, 4326
51
+ # path :geometry line_string, 4326
52
+ ```
53
+
54
+ Also, if you pass the `-r` option, it'll annotate `routes.rb` with the output of `rake routes`.
55
+
56
+
57
+ ## Upgrading to 3.X and annotate models not working?
35
58
 
36
- class LineItem < ActiveRecord::Base
37
- belongs_to :product
38
- . . .
59
+ In versions 2.7.X the annotate gem defaulted to annotating models if no arguments were passed in.
60
+ The annotate gem by default would not allow for routes and models to be annotated together.
61
+ A [change was added in #647](https://github.com/ctran/annotate_models/pull/647).
62
+ You [can read more here](https://github.com/ctran/annotate_models/issues/663).
39
63
 
40
- It also annotates geometrical columns, geom type and srid, when using
41
- +SpatialAdapter+, +PostgisAdapter+ or +PostGISAdapter+:
64
+ There are a few ways of fixing this:
42
65
 
43
- # == Schema Info
44
- #
45
- # Table name: trips
46
- #
47
- # local :geometry point, 4326
48
- # path :geometry line_string, 4326
66
+ - If using CLI explicitly pass in models flag using `--models`
49
67
 
50
- Also, if you pass the -r option, it'll annotate routes.rb with the output of
51
- <code>rake routes</code>.
68
+ OR
52
69
 
70
+ a) Running `rails g annotate:install` will overwrite your defaults with the annotating `models` option set to `'true'`.
53
71
 
54
- == Install
72
+ b) In `lib/tasks/auto_annotate_models.rake` add the `models` key-value option:
73
+
74
+ ```ruby
75
+ Annotate.set_defaults(
76
+ ...
77
+ 'models' => 'true',
78
+ ...
79
+ ```
80
+
81
+ ## Install
55
82
 
56
83
  Into Gemfile from rubygems.org:
57
84
 
58
- group :development do
59
- gem 'annotate'
60
- end
85
+ ```ruby
86
+ group :development do
87
+ gem 'annotate'
88
+ end
89
+ ```
61
90
 
62
91
  Into Gemfile from Github:
63
92
 
64
- group :development do
65
- gem 'annotate', git: 'https://github.com/ctran/annotate_models.git'
66
- end
93
+ ```ruby
94
+ group :development do
95
+ gem 'annotate', git: 'https://github.com/ctran/annotate_models.git'
96
+ end
97
+ ```
67
98
 
68
99
  Into environment gems from rubygems.org:
69
100
 
@@ -76,12 +107,11 @@ Into environment gems from Github checkout:
76
107
  rake build
77
108
  gem install pkg/annotate-*.gem
78
109
 
110
+ ## Usage
79
111
 
80
- == Usage
81
-
82
- (If you used the Gemfile install, prefix the below commands with <code>bundle exec</code>.)
112
+ (If you used the Gemfile install, prefix the below commands with `bundle exec`.)
83
113
 
84
- === Usage in Rails
114
+ ### Usage in Rails
85
115
 
86
116
  To annotate all your models, tests, fixtures, and factories:
87
117
 
@@ -108,26 +138,28 @@ To remove routes.rb annotations:
108
138
 
109
139
  annotate --routes --delete
110
140
 
111
- To automatically annotate every time you run <code>db:migrate</code>, either run <code>rails g annotate:install</code> or add +Annotate.load_tasks+ to your `Rakefile`. See the {configuration in Rails}[link:README.rdoc#configuration-in-rails] section for more info.
141
+ To automatically annotate every time you run `db:migrate`,
142
+ either run `rails g annotate:install`
143
+ or add `Annotate.load_tasks` to your `Rakefile`.
112
144
 
113
- === Usage Outside of Rails
145
+ See the [configuration in Rails](#configuration-in-rails) section for more info.
114
146
 
115
- Everything above applies, except that +--routes+ is not meaningful, and you will
116
- probably need to explicitly set one or more +--require+ option(s), and/or one
117
- or more +--model-dir+ options to inform annotate about the structure of your
118
- project and help it bootstrap and load the relevant code.
147
+ ### Usage Outside of Rails
119
148
 
149
+ Everything above applies, except that `--routes` is not meaningful,
150
+ and you will probably need to explicitly set one or more `--require` option(s), and/or one or more `--model-dir` options
151
+ to inform `annotate` about the structure of your project and help it bootstrap and load the relevant code.
120
152
 
121
- == Configuration
153
+ ## Configuration
122
154
 
123
155
  If you want to always skip annotations on a particular model, add this string
124
156
  anywhere in the file:
125
157
 
126
158
  # -*- SkipSchemaAnnotations
127
159
 
128
- === Configuration in Rails
160
+ ### Configuration in Rails
129
161
 
130
- To generate a configuration file (in the form of a +.rake+ file), to set
162
+ To generate a configuration file (in the form of a `.rake` file), to set
131
163
  default options:
132
164
 
133
165
  rails g annotate:install
@@ -135,7 +167,7 @@ default options:
135
167
  Edit this file to control things like output format, where annotations are
136
168
  added (top or bottom of file), and in which artifacts.
137
169
 
138
- The generated rakefile +lib/tasks/auto_annotate_models.rake+ also contains
170
+ The generated rakefile `lib/tasks/auto_annotate_models.rake` also contains
139
171
  `Annotate.load_tasks`. This adds a few rake tasks which duplicate command-line
140
172
  functionality:
141
173
 
@@ -144,27 +176,30 @@ functionality:
144
176
  rake remove_annotation # Remove schema information from model and fixture files
145
177
 
146
178
  By default, once you've generated a configuration file, annotate will be
147
- executed whenever you run <code>rake db:migrate</code> (but only in development mode).
148
- If you want to disable this behavior permanently, edit the +.rake+ file and
149
- change:
179
+ executed whenever you run `rake db:migrate` (but only in development mode).
180
+ If you want to disable this behavior permanently,
181
+ edit the `.rake` file and change:
150
182
 
183
+ ```ruby
151
184
  'skip_on_db_migrate' => 'false',
185
+ ```
152
186
 
153
187
  To:
154
188
 
189
+ ```ruby
155
190
  'skip_on_db_migrate' => 'true',
191
+ ```
156
192
 
157
- If you want to run <code>rake db:migrate</code> as a one-off without running annotate,
193
+ If you want to run `rake db:migrate` as a one-off without running annotate,
158
194
  you can do so with a simple environment variable, instead of editing the
159
- +.rake+ file:
195
+ `.rake` file:
160
196
 
161
197
  ANNOTATE_SKIP_ON_DB_MIGRATE=1 rake db:migrate
162
198
 
163
-
164
- == Options
199
+ ## Options
165
200
 
166
201
  Usage: annotate [options] [model_file]*
167
- --additional_file_patterns Additional file paths or globs to annotate, separated by commas (e.g. `/foo/bar/%model_name%/*.rb,/baz/%model_name%.rb`)
202
+ --additional-file-patterns Additional file paths or globs to annotate, separated by commas (e.g. `/foo/bar/%model_name%/*.rb,/baz/%model_name%.rb`)
168
203
  -d, --delete Remove annotations from all model files or the routes.rb file
169
204
  -p [before|top|after|bottom], Place the annotations at the top (before) or the bottom (after) of the model/test/fixture/factory/route/serializer file(s)
170
205
  --position
@@ -202,7 +237,7 @@ you can do so with a simple environment variable, instead of editing the
202
237
  -R, --require path Additional file to require before loading models, may be used multiple times
203
238
  -e [tests,fixtures,factories,serializers],
204
239
  --exclude Do not annotate fixtures, test files, factories, and/or serializers
205
- -f [bare|rdoc|markdown], Render Schema Infomation as plain/RDoc/Markdown
240
+ -f [bare|rdoc|yard|markdown], Render Schema Infomation as plain/RDoc/YARD/Markdown
206
241
  --format
207
242
  --force Force new annotations even if there are no changes.
208
243
  --frozen Do not allow to change annotations. Exits non-zero if there are going to be changes to files.
@@ -217,82 +252,80 @@ you can do so with a simple environment variable, instead of editing the
217
252
  --ignore-unknown-models don't display warnings for bad model files
218
253
  --with-comment include database comments in model annotations
219
254
 
220
- === Option: +additional_file_patterns+
255
+ ### Option: `additional_file_patterns`
221
256
 
222
- CLI: +--additional_file_patterns+<br>
223
- Ruby: +:additional_file_patterns+
257
+ CLI: `--additional-file-patterns`<br>
258
+ Ruby: `:additional_file_patterns`
224
259
 
225
- Provide additional paths for the gem to annotate. These paths can include globs.
226
- It is recommended to use absolute paths. Here are some examples:
260
+ Provide additional paths for the gem to annotate. These paths can include
261
+ globs. It is recommended to use absolute paths. Here are some examples:
227
262
 
263
+ * `/app/lib/decorates/%MODEL_NAME%/*.rb`
264
+ * `/app/lib/forms/%PLURALIZED_MODEL_NAME%/**/*.rb`
265
+ * `/app/lib/forms/%TABLE_NAME%/*.rb`
228
266
 
229
- - <code>/app/lib/decorates/%MODEL_NAME%/&ast;.rb</code>
230
- - <code>/app/lib/forms/%PLURALIZED_MODEL_NAME%/&ast;&ast;/&ast;.rb</code>
231
- - <code>/app/lib/forms/%TABLE_NAME%/&ast;.rb</code>
232
267
 
233
- The appropriate model will be inferred using the <code>%*%</code> syntax, annotating any matching files.
234
- It works with existing filename resolutions (options for which can be found in the +resolve_filename+ method of
235
- +annotate_models.rb+).
268
+ The appropriate model will be inferred using the `%*%` syntax, annotating any
269
+ matching files. It works with existing filename resolutions (options for which
270
+ can be found in the `resolve_filename` method of `annotate_models.rb`).
236
271
 
237
272
  When using in a Rails config, you can use the following:
238
273
 
239
- <code>File.join(Rails.application.root, 'app/lib/forms/%PLURALIZED_MODEL_NAME%/**/*.rb')</code>
274
+ `File.join(Rails.application.root,
275
+ 'app/lib/forms/%PLURALIZED_MODEL_NAME%/***/**.rb')`
240
276
 
241
- == Sorting
277
+ ## Sorting
242
278
 
243
279
  By default, columns will be sorted in database order (i.e. the order in which
244
280
  migrations were run).
245
281
 
246
- If you prefer to sort alphabetically so that the results of
247
- annotation are consistent regardless of what order migrations are executed in,
248
- use +--sort+.
249
-
282
+ If you prefer to sort alphabetically so that the results of annotation are
283
+ consistent regardless of what order migrations are executed in, use `--sort`.
250
284
 
251
- == Markdown
285
+ ## Markdown
252
286
 
253
287
  The format produced is actually MultiMarkdown, making use of the syntax
254
- extension for tables. It's recommended you use +kramdown+ as your parser if
255
- you want to use this format. If you're using +yard+ to generate documentation,
256
- specify a format of markdown with +kramdown+ as the provider by adding this to
257
- your +.yardopts+ file:
288
+ extension for tables. It's recommended you use `kramdown` as your parser if
289
+ you want to use this format. If you're using `yard` to generate
290
+ documentation, specify a format of markdown with `kramdown` as the provider by
291
+ adding this to your `.yardopts` file:
258
292
 
259
293
  --markup markdown
260
294
  --markup-provider kramdown
261
295
 
262
- Be sure to add this to your +Gemfile+ as well:
263
-
264
- gem 'kramdown', :groups => [:development], :require => false
296
+ Be sure to add this to your `Gemfile` as well:
265
297
 
298
+ gem 'kramdown', groups => [:development], require => false
266
299
 
267
- == WARNING
300
+ ## WARNING
268
301
 
269
- <b>Don't add text after an automatically-created comment block.</b> This tool
302
+ **Don't add text after an automatically-created comment block.** This tool
270
303
  will blow away the initial/final comment block in your models if it looks like
271
304
  it was previously added by this gem.
272
305
 
273
- Be sure to check the changes that this tool makes! If you are using Git,
274
- you may simply check your project's status after running +annotate+:
306
+ Be sure to check the changes that this tool makes! If you are using Git, you
307
+ may simply check your project's status after running `annotate`:
275
308
 
276
309
  $ git status
277
310
 
278
311
  If you are not using a VCS (like Git, Subversion or similar), please tread
279
312
  extra carefully, and consider using one.
280
313
 
281
- == Links
314
+ ## Links
282
315
 
283
- - Factory Bot: http://github.com/thoughtbot/factory_bot
284
- - Object Daddy: http://github.com/flogic/object_daddy
285
- - Machinist: http://github.com/notahat/machinist
286
- - Fabrication: http://github.com/paulelliott/fabrication
287
- - SpatialAdapter: http://github.com/pdeffendol/spatial_adapter
288
- - PostgisAdapter: http://github.com/nofxx/postgis_adapter
289
- - PostGISAdapter: https://github.com/dazuma/activerecord-postgis-adapter
316
+ * Factory Bot: http://github.com/thoughtbot/factory_bot
317
+ * Object Daddy: http://github.com/flogic/object_daddy
318
+ * Machinist: http://github.com/notahat/machinist
319
+ * Fabrication: http://github.com/paulelliott/fabrication
320
+ * SpatialAdapter: http://github.com/pdeffendol/spatial_adapter
321
+ * PostgisAdapter: http://github.com/nofxx/postgis_adapter
322
+ * PostGISAdapter: https://github.com/dazuma/activerecord-postgis-adapter
290
323
 
291
324
 
292
- == License
325
+ ## License
293
326
 
294
327
  Released under the same license as Ruby. No Support. No Warranty.
295
328
 
296
- == Authors
329
+ ## Authors
297
330
 
298
- {See AUTHORS.rdoc}[link:AUTHORS.rdoc].
331
+ [See AUTHORS.md](AUTHORS.md).