You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* mrjoy: (177 commits)
Updating authorship.
Resolve conflict between generated rakefile and CLI tool.
Minor fixups.
Updating readme to be RDoc compliant.
fixed a few typos
Updating docs to point to this fork.
Update docs.
Yep, I'm tired.
Revert "Version bump to 0.0.0"
Version bump to 0.0.0
Changing my mind on project name issue...
Making project name match Github project name.
Bumping version.
Wider type column output, play nice with Rake CLI.
Fixing behavior with some model sub-classes, adding skip-annotations feature.
Making ActiveSupport dependency float, updating gemspec.
Updating change log, readme and TODO list.
Update generated .rake file with new options.
Renaming bin to avoid conflict with ImageMagick.
Accept string or symbol for positions.
...
Conflicts:
Gemfile
Gemfile.lock
History.txt
README.rdoc
Rakefile
VERSION.yml
annotate.gemspec
annotate_models.gemspec
lib/annotate/annotate_models.rb
lib/tasks/annotate_models.rake
lib/tasks/annotate_routes.rake
spec/annotate/annotate_models_spec.rb
spec/spec_helper.rb
todo.txt
@@ -61,60 +62,61 @@ Into environment gems from Github checkout:
61
62
To annotate all your models, tests, fixtures, etc.:
62
63
63
64
cd /path/to/app
64
-
annotate
65
+
annotate_models
65
66
66
67
To annotate your models and tests:
67
68
68
-
annotate --exclude fixtures
69
+
annotate_models --exclude fixtures
69
70
70
71
To annotate just your models:
71
72
72
-
annotate --exclude tests,fixtures
73
+
annotate_models --exclude tests,fixtures
73
74
74
75
To annotate routes.rb:
75
76
76
-
annotate -r
77
+
annotate_models -r
77
78
78
-
To automatically annotate after running 'rake db:migrate':
79
-
80
-
[*needs more clarity*] unpack the gem into vendor/plugins, or maybe vendor/gems, or maybe just require tasks/migrate.rake.
79
+
To remove annotations:
81
80
82
-
If you install annotate_models as a plugin, it will automatically
83
-
adjust your <tt>rake db:migrate</tt> tasks so that they update the
84
-
annotations in your model files for you once the migration is
85
-
completed. To get the same behavior from a gem, add the following to
86
-
your Rakefile:
81
+
annotate_models -d
87
82
88
-
require 'annotate/tasks'
83
+
To automatically annotate after running 'rake db:migrate', ensure you've added
84
+
annotate_models to your Rails project's Gemfile, and run this:
89
85
90
-
To customize the behavior of annotate when it is running as a Rake
91
-
task, use the following (in your Rakefile or wherever):
86
+
rails g annotate_models:install
92
87
93
-
ENV['position_in_class'] = "before"
94
-
ENV['position_in_fixture'] = "before"
95
-
ENV['show_indexes'] = "false"
96
-
ENV['include_version'] = "false"
97
-
ENV['exclude_tests'] = "false"
98
-
ENV['exclude_fixtures'] = "false"
99
-
ENV['skip_on_db_migrate'] = "false"
88
+
This will produce a .rake file that will ensure annotation happens after
89
+
migration (but only in development mode), and provide configuration options
90
+
you can use to tailor the output.
100
91
101
-
Warning: ImageMagick installs a tool called `annotate` too (if you're using MacPorts it's in `/opt/local/bin/annotate`. So if you see Usage: annotate imagein.jpg imageout.jpg then put `/usr/bin` ahead on the path and you'll get ours instead.
92
+
If you want to always skip annotations on a particular model, add this string
93
+
anywhere in the file:
102
94
95
+
# -*- SkipSchemaAnnotations
103
96
104
97
== OPTIONS
105
98
106
-
Usage: annotate [options] [model_file]*
99
+
Usage: annotate_models [options] [model_file]*
107
100
-d, --delete Remove annotations from all model files
108
101
-p, --position [before|after] Place the annotations at the top (before) or the bottom (after) of the model file
109
102
-r, --routes Annotate routes.rb with the output of 'rake routes'
110
103
-v, --version Show the current version of this gem
111
104
-m, --show-migration Include the migration version number in the annotation
112
-
-i, --show-indexes List the table's database indexes in the annotation
113
-
-s, --simple-indexes Concat the column's related indexes in the annotation
105
+
-i, --show-indexes List the indexes for the table in the annotation
106
+
-s, --simple-indexes Include information about indexes inline with the relevant column
114
107
--model-dir dir Annotate model files stored in dir rather than app/models
108
+
--ignore-model-subdirs Ignore sub-directories of the models directory.
115
109
-R, --require path Additional files to require before loading models
116
-
-e, --exclude [tests,fixtures] Do not annotate fixtures, test files, or both
110
+
-e [tests,fixtures] Skip annotation of fixtures/factories/test files
111
+
--exclude
112
+
-n --no-sort Sort by column creation order rather than alphabetical order
117
113
114
+
== SORTING
115
+
116
+
By default, columns will be sorted alphabetically so that the results of
117
+
annotation are consistent regardless of what order migrations are executed in.
118
+
119
+
If you prefer the old behavior, use --no-sort.
118
120
119
121
== WARNING
120
122
@@ -123,16 +125,16 @@ block in your models if it looks like it was previously added
123
125
by annotate models, so you don't want to add additional text
0 commit comments